|
|
|
@ -957,6 +957,10 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
@@ -957,6 +957,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; |
|
|
|
|
} |
|
|
|
|
if (is_equal(packet.param1,1.0f)) { |
|
|
|
|
rover.ins.init_gyro(); |
|
|
|
|
if (rover.ins.gyro_calibrated_ok_all()) { |
|
|
|
@ -972,21 +976,18 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
@@ -972,21 +976,18 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
|
|
|
|
|
rover.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
|
|
|
|
|
rover.ins.init_gyro(); |
|
|
|
|
// reset ahrs gyro bias
|
|
|
|
|
if (rover.ins.gyro_calibrated_ok_all()) { |
|
|
|
|
rover.ahrs.reset_gyro_drift(); |
|
|
|
|
} |
|
|
|
|
if(rover.ins.calibrate_accel(&interact, trim_roll, trim_pitch)) { |
|
|
|
|
// reset ahrs's trim to suggested values from calibration routine
|
|
|
|
|
rover.ahrs.set_trim(Vector3f(trim_roll, trim_pitch, 0)); |
|
|
|
|
result = MAV_RESULT_ACCEPTED; |
|
|
|
|
} else { |
|
|
|
|
result = MAV_RESULT_FAILED; |
|
|
|
|
} |
|
|
|
|
rover.ins.acal_init(); |
|
|
|
|
rover.ins.get_acal()->start(this); |
|
|
|
|
|
|
|
|
|
} else if (is_equal(packet.param5,2.0f)) { |
|
|
|
|
// start with gyro calibration
|
|
|
|
|
rover.ins.init_gyro(); |
|
|
|
@ -1128,7 +1129,6 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
@@ -1128,7 +1129,6 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case MAVLINK_MSG_ID_SET_MODE: |
|
|
|
|
{ |
|
|
|
|
handle_set_mode(msg, FUNCTOR_BIND(&rover, &Rover::mavlink_set_mode, bool, uint8_t)); |
|
|
|
|