コード例 #1
0
ファイル: AP_Motors_test.cpp プロジェクト: qqchen/ardupilot
// setup
void setup()
{
    hal.console->println("AP_Motors library test ver 1.0");

    // motor initialisation
    motors.set_update_rate(490);
    // motors.set_frame_orientation(AP_MOTORS_X_FRAME);
    motors.set_frame_orientation(AP_MOTORS_PLUS_FRAME);
    motors.set_min_throttle(130);
    motors.set_hover_throttle(500);
    motors.Init();      // initialise motors

    // setup radio
    if (rc3.radio_min == 0) {
	    // cope with AP_Param not being loaded
	    rc3.radio_min = 1000;
    }
    if (rc3.radio_max == 0) {
	    // cope with AP_Param not being loaded
	    rc3.radio_max = 2000;
    }
    // set rc channel ranges
    rc1.set_angle(4500);
    rc2.set_angle(4500);
    rc3.set_range(130, 1000);
    rc4.set_angle(4500);

    motors.enable();
    motors.output_min();

    hal.scheduler->delay(1000);
}
コード例 #2
0
void apmotors_output_init(void) {

    angular_channel_setup(&s_roll);
    angular_channel_setup(&s_pitch);
    angular_channel_setup(&s_yaw);
    throttle_channel_setup(&s_throttle);

    motors.set_update_rate(50); /* Is this appropriate with IOAR?
                                     Otherwise? */
    motors.set_frame_orientation(AP_MOTORS_X_FRAME);
    motors.Init();
    motors.set_min_throttle(THROTTLE_MINIMUM);
    motors.set_max_throttle(THROTTLE_MAXIMUM);

    motors.enable();
    motors.output_min();
    motors.auto_armed(true);
}