|
|
|
@ -1219,6 +1219,10 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
@@ -1219,6 +1219,10 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MAV_CMD_PREFLIGHT_CALIBRATION: |
|
|
|
|
if(hal.util->get_soft_armed()) { |
|
|
|
|
result = MAV_RESULT_FAILED; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
plane.in_calibration = true; |
|
|
|
|
if (is_equal(packet.param1,1.0f)) { |
|
|
|
|
plane.ins.init_gyro(); |
|
|
|
@ -1238,21 +1242,18 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
@@ -1238,21 +1242,18 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
|
|
|
|
|
plane.trim_radio(); |
|
|
|
|
result = MAV_RESULT_ACCEPTED; |
|
|
|
|
} else if (is_equal(packet.param5,1.0f)) { |
|
|
|
|
float trim_roll, trim_pitch; |
|
|
|
|
AP_InertialSensor_UserInteract_MAVLink interact(this); |
|
|
|
|
result = MAV_RESULT_ACCEPTED; |
|
|
|
|
// start with gyro calibration
|
|
|
|
|
plane.ins.init_gyro(); |
|
|
|
|
// reset ahrs gyro bias
|
|
|
|
|
if (plane.ins.gyro_calibrated_ok_all()) { |
|
|
|
|
plane.ahrs.reset_gyro_drift(); |
|
|
|
|
} |
|
|
|
|
if(plane.ins.calibrate_accel(&interact, trim_roll, trim_pitch)) { |
|
|
|
|
// reset ahrs's trim to suggested values from calibration routine
|
|
|
|
|
plane.ahrs.set_trim(Vector3f(trim_roll, trim_pitch, 0)); |
|
|
|
|
result = MAV_RESULT_ACCEPTED; |
|
|
|
|
} else { |
|
|
|
|
result = MAV_RESULT_FAILED; |
|
|
|
|
} |
|
|
|
|
plane.ins.acal_init(); |
|
|
|
|
plane.ins.get_acal()->start(this); |
|
|
|
|
|
|
|
|
|
} else if (is_equal(packet.param5,2.0f)) { |
|
|
|
|
// start with gyro calibration
|
|
|
|
|
plane.ins.init_gyro(); |
|
|
|
@ -1521,7 +1522,6 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
@@ -1521,7 +1522,6 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case MAVLINK_MSG_ID_SET_MODE: |
|
|
|
|
{ |
|
|
|
|
handle_set_mode(msg, FUNCTOR_BIND(&plane, &Plane::mavlink_set_mode, bool, uint8_t)); |
|
|
|
|