Beispiel #1
0
// デバイス終了用フック関数
// この関数はSTOPまたはEXITボタンが押された時に実行されます。
void ecrobot_device_terminate()
{
	// センサ、モータなどの各デバイスの終了関数を
	// ここで実装することができます。
	// ⇒ 光センサ赤色LEDをOFFにする
	ecrobot_set_light_sensor_inactive(NXT_PORT_S3);
	ecrobot_term_bt_connection(); /*BlueTooth通信を終了*/
}
//*****************************************************************************
// 関数名 : ecrobot_device_terminate
// 引数 : なし
// 戻り値 : なし
// 概要 : ECROBOTデバイス終了処理フック関数
//*****************************************************************************
void ecrobot_device_terminate()
{
	nxt_motor_set_speed(NXT_PORT_C,0,0);
	nxt_motor_set_speed(NXT_PORT_B,0,0);
	nxt_motor_set_speed(NXT_PORT_A,0,0);

	ecrobot_set_light_sensor_inactive(NXT_PORT_S3); /* 光センサ赤色LEDをOFF */
	ecrobot_term_sonar_sensor(NXT_PORT_S2); /* 超音波センサ(I2C通信)を終了 */
	ecrobot_term_bt_connection(); /* Bluetooth通信を終了 */
}
//後始末処理
void ecrobot_device_terminate(void)
{
	tail_mode = RN_TAILUP;
	ecrobot_set_motor_speed(NXT_PORT_A, 0);
	ecrobot_set_motor_speed(NXT_PORT_B, 0);
	ecrobot_set_motor_speed(NXT_PORT_C, 0);
	ecrobot_set_light_sensor_inactive(NXT_PORT_S3);
	ecrobot_term_sonar_sensor(NXT_PORT_S2);
	ecrobot_term_bt_connection();
}
Beispiel #4
0
void ecrobot_device_terminate(){
	// センサ、モータなどの各デバイスの終了関数を
	// ここで実装することができます。
	// ⇒ 光センサ赤色LEDをOFFにする
	ecrobot_set_light_sensor_inactive(NXT_PORT_S1);
	// ⇒ 超音波センサ(I2C通信)を終了
	ecrobot_term_sonar_sensor(NXT_PORT_S3 );
	
	ecrobot_term_bt_connection();
}
//後始末処理関数(プログラム終了時呼び出し)
void ecrobot_device_terminate(void)
{
	ecrobot_set_light_sensor_inactive(NXT_PORT_S3);	//光センサ終了
	ecrobot_term_bt_connection();					//Bluetooth終了

	//モータリセット
	ecrobot_set_motor_rev(NXT_PORT_A,0);
	ecrobot_set_motor_rev(NXT_PORT_B,0);
	ecrobot_set_motor_rev(NXT_PORT_C,0);
	ecrobot_set_motor_speed(NXT_PORT_A, 0);			
	ecrobot_set_motor_speed(NXT_PORT_B, 0);
	ecrobot_set_motor_speed(NXT_PORT_C, 0);
}
//後始末処理関数(プログラム終了時呼び出し)
void ecrobot_device_terminate(void){
	tail_mode = RN_TAILUP;							//尻尾を上げる(意味あるのか?)

	ecrobot_set_light_sensor_inactive(NXT_PORT_S3);	//光センサ終了
	ecrobot_term_sonar_sensor(NXT_PORT_S2);			//超音波センサ終了
	ecrobot_term_bt_connection();					//Bluetooth終了

	//モータリセット
	ecrobot_set_motor_rev(NXT_PORT_A,0);
	ecrobot_set_motor_rev(NXT_PORT_B,0);
	ecrobot_set_motor_rev(NXT_PORT_C,0);
	ecrobot_set_motor_speed(NXT_PORT_A, 0);			
	ecrobot_set_motor_speed(NXT_PORT_B, 0);
	ecrobot_set_motor_speed(NXT_PORT_C, 0);
}
Beispiel #7
0
/*!*********************************************************
 *  @brief
 *
 *  @param
 *
 *  @retval
 *
 *  @return
 *
**********************************************************/
static  U32     garage_tail_down(
                    void
                )
{
    U32 ret         = RET_REMAIN;
    U32 garage_ret;
    int tail;
    int motor_r;
    int motor_l;
    F32 forward;
    static U32 cnt  = 0;

    motor_r = nxt_motor_get_count(PORT_MOTOR_R);
    motor_l = nxt_motor_get_count(PORT_MOTOR_L);
    if (motor_r - gkGarageInfo.motor_r < 100 || motor_l - gkGarageInfo.motor_l < 100) {
        forward = 1;
    } else {
        forward = -1;
    }

    garage_ret = garage_stand(forward, 0, GYRO_OFFSET);

    /* 尻尾制御 */
    tail = nxt_motor_get_count(PORT_MOTOR_TAIL);
    if (tail > GARAGE_COCK_START_ANGLE) {
        nxt_motor_set_speed(PORT_MOTOR_TAIL, (S8)0, 1);

        if ((motor_r - gkGarageInfo.motor_r) > 100 || (motor_l - gkGarageInfo.motor_l) > 100) {
            cnt++;
            if (cnt > 50) {
                if (garage_ret == GAGAGE_RET_REAR) {
                    //garage_stand((F32)0, (F32)0, (GYRO_OFFSET - 40));
                    nxt_motor_set_speed(PORT_MOTOR_R, (S8)0, 1);
                    nxt_motor_set_speed(PORT_MOTOR_L, (S8)0, 1);
                    ecrobot_set_light_sensor_inactive(PORT_LIGHT);
                    ret = RET_FINISH;
                } else { /* nothing */ }
            } else { /* nothing */ }
        }
    } else { /* nothing */ }

    return ret;
}
Beispiel #8
0
void emergency_stop(char* errMsgLine1, char* errMsgLine2) {
	motor_set_speed(NXT_PORT_A,0,1);
	motor_set_speed(NXT_PORT_B,0,1);
	motor_set_speed(NXT_PORT_C,0,1);
	print_clear_display();
	print_str(0,1,errMsgLine1);
	print_str(0,2,errMsgLine2);

	int i;
	for(i = 0; i < 3; i++) {
		print_str(6,4,"ERROR");
		print_update();
		ecrobot_set_light_sensor_active(NXT_PORT_S1);
		ecrobot_set_light_sensor_active(NXT_PORT_S2);
		ecrobot_set_light_sensor_active(NXT_PORT_S3);
		ecrobot_sound_tone(1000,500,15);
		systick_wait_ms(750);
		print_clear_line(4);
		print_update();
		ecrobot_set_light_sensor_inactive(NXT_PORT_S1);
		ecrobot_set_light_sensor_inactive(NXT_PORT_S2);
		ecrobot_set_light_sensor_inactive(NXT_PORT_S3);
		ecrobot_sound_tone(500,500,15);
		systick_wait_ms(750);
	}

	motor_set_speed(NXT_PORT_A,0,0);
	motor_set_speed(NXT_PORT_B,0,0);
	motor_set_speed(NXT_PORT_C,0,0);

	while(true) {
		print_str(6,4,"ERROR");
		print_update();
		ecrobot_set_light_sensor_active(NXT_PORT_S1);
		ecrobot_set_light_sensor_active(NXT_PORT_S2);
		ecrobot_set_light_sensor_active(NXT_PORT_S3);
		systick_wait_ms(750);
		print_clear_line(4);
		print_update();
		ecrobot_set_light_sensor_inactive(NXT_PORT_S1);
		ecrobot_set_light_sensor_inactive(NXT_PORT_S2);
		ecrobot_set_light_sensor_inactive(NXT_PORT_S3);
		systick_wait_ms(750);
	}
}
/*
 *後始末処理
 */
void ecrobot_device_terminate(void)
{
	ecrobot_set_motor_speed(NXT_PORT_B, 0);
	ecrobot_set_motor_speed(NXT_PORT_C, 0);
	ecrobot_set_light_sensor_inactive(NXT_PORT_S3);
}
Beispiel #10
0
void ecrobot_device_terminate() {
  ecrobot_set_light_sensor_inactive(NXT_PORT_S1);
}
Beispiel #11
0
void ShutdownHook(StatusType error)
{
    ecrobot_term_sonar_sensor(NXT_PORT_S4);
    ecrobot_set_light_sensor_inactive(NXT_PORT_S3);
}
Beispiel #12
0
void ecrobot_device_terminate()
{

	ecrobot_set_light_sensor_inactive(NXT_PORT_S4);
	ecrobot_term_bt_connection();
}
Beispiel #13
0
void ecrobot_device_terminate()
{
	// Finalizar los sensores activos
	ecrobot_set_light_sensor_inactive(NXT_PORT_S1);
}
Beispiel #14
0
void ecrobot_device_terminate(void)
{
	ecrobot_set_light_sensor_inactive(LIGHT_SENSOR_PORT);
}
//*****************************************************************************
// �֐��� : ecrobot_device_terminate
// �� : �Ȃ�
// �߂�l : �Ȃ�
// �T�v : ECROBOT�f�o�C�X�I�������t�b�N�֐�
//*****************************************************************************
void ecrobot_device_terminate()
{
	ecrobot_set_light_sensor_inactive(NXT_PORT_S3); /* ���Z���T�ԐFLED��OFF */
	ecrobot_term_sonar_sensor(NXT_PORT_S2); /* �����g�Z���T(I2C�ʐM)���I�� */
	ecrobot_term_bt_connection(); /* Bluetooth�ʐM���I�� */
}