|
|
|
@ -528,7 +528,7 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
@@ -528,7 +528,7 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
|
|
|
|
|
switch(id) { |
|
|
|
|
case MSG_HEARTBEAT: |
|
|
|
|
CHECK_PAYLOAD_SIZE(HEARTBEAT); |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].last_heartbeat_time = AP_HAL::millis(); |
|
|
|
|
last_heartbeat_time = AP_HAL::millis(); |
|
|
|
|
sub.send_heartbeat(chan); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
@ -539,13 +539,13 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
@@ -539,13 +539,13 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
|
|
|
|
|
CHECK_PAYLOAD_SIZE(SYS_STATUS); |
|
|
|
|
sub.send_extended_status1(chan); |
|
|
|
|
CHECK_PAYLOAD_SIZE(POWER_STATUS); |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].send_power_status(); |
|
|
|
|
send_power_status(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MSG_EXTENDED_STATUS2: |
|
|
|
|
CHECK_PAYLOAD_SIZE(MEMINFO); |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].send_meminfo(); |
|
|
|
|
send_meminfo(); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MSG_ATTITUDE: |
|
|
|
@ -569,11 +569,11 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
@@ -569,11 +569,11 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MSG_GPS_RAW: |
|
|
|
|
return sub.gcs[chan-MAVLINK_COMM_0].send_gps_raw(sub.gps); |
|
|
|
|
send_gps_raw(sub.gps); |
|
|
|
|
|
|
|
|
|
case MSG_SYSTEM_TIME: |
|
|
|
|
CHECK_PAYLOAD_SIZE(SYSTEM_TIME); |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].send_system_time(sub.gps); |
|
|
|
|
send_system_time(sub.gps); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MSG_SERVO_OUT: |
|
|
|
@ -583,7 +583,7 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
@@ -583,7 +583,7 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
|
|
|
|
|
|
|
|
|
|
case MSG_RADIO_IN: |
|
|
|
|
CHECK_PAYLOAD_SIZE(RC_CHANNELS_RAW); |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].send_radio_in(sub.receiver_rssi); |
|
|
|
|
send_radio_in(sub.receiver_rssi); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MSG_RADIO_OUT: |
|
|
|
@ -598,17 +598,17 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
@@ -598,17 +598,17 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
|
|
|
|
|
|
|
|
|
|
case MSG_RAW_IMU1: |
|
|
|
|
CHECK_PAYLOAD_SIZE(RAW_IMU); |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].send_raw_imu(sub.ins, sub.compass); |
|
|
|
|
send_raw_imu(sub.ins, sub.compass); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MSG_RAW_IMU2: |
|
|
|
|
CHECK_PAYLOAD_SIZE(SCALED_PRESSURE); |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].send_scaled_pressure(sub.barometer); |
|
|
|
|
send_scaled_pressure(sub.barometer); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MSG_RAW_IMU3: |
|
|
|
|
CHECK_PAYLOAD_SIZE(SENSOR_OFFSETS); |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].send_sensor_offsets(sub.ins, sub.compass, sub.barometer); |
|
|
|
|
send_sensor_offsets(sub.ins, sub.compass, sub.barometer); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MSG_CURRENT_WAYPOINT: |
|
|
|
@ -618,12 +618,12 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
@@ -618,12 +618,12 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
|
|
|
|
|
|
|
|
|
|
case MSG_NEXT_PARAM: |
|
|
|
|
CHECK_PAYLOAD_SIZE(PARAM_VALUE); |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].queued_param_send(); |
|
|
|
|
queued_param_send(); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MSG_NEXT_WAYPOINT: |
|
|
|
|
CHECK_PAYLOAD_SIZE(MISSION_REQUEST); |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].queued_waypoint_send(); |
|
|
|
|
queued_waypoint_send(); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MSG_RANGEFINDER: |
|
|
|
@ -665,7 +665,7 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
@@ -665,7 +665,7 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
|
|
|
|
|
|
|
|
|
|
case MSG_AHRS: |
|
|
|
|
CHECK_PAYLOAD_SIZE(AHRS); |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].send_ahrs(sub.ahrs); |
|
|
|
|
send_ahrs(sub.ahrs); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MSG_SIMSTATE: |
|
|
|
@ -674,7 +674,7 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
@@ -674,7 +674,7 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
|
|
|
|
|
sub.send_simstate(chan); |
|
|
|
|
#endif |
|
|
|
|
CHECK_PAYLOAD_SIZE(AHRS2); |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].send_ahrs2(sub.ahrs); |
|
|
|
|
send_ahrs2(sub.ahrs); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MSG_HWSTATUS: |
|
|
|
@ -691,13 +691,13 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
@@ -691,13 +691,13 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
|
|
|
|
|
|
|
|
|
|
case MSG_BATTERY2: |
|
|
|
|
CHECK_PAYLOAD_SIZE(BATTERY2); |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].send_battery2(sub.battery); |
|
|
|
|
send_battery2(sub.battery); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MSG_OPTICAL_FLOW: |
|
|
|
|
#if OPTFLOW == ENABLED |
|
|
|
|
CHECK_PAYLOAD_SIZE(OPTICAL_FLOW); |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].send_opticalflow(sub.ahrs, sub.optflow); |
|
|
|
|
send_opticalflow(sub.ahrs, sub.optflow); |
|
|
|
|
#endif |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
@ -1574,7 +1574,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
@@ -1574,7 +1574,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
|
|
|
|
|
|
|
|
|
|
case MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES: { |
|
|
|
|
if (is_equal(packet.param1,1.0f)) { |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].send_autopilot_version(FIRMWARE_VERSION); |
|
|
|
|
send_autopilot_version(FIRMWARE_VERSION); |
|
|
|
|
result = MAV_RESULT_ACCEPTED; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
@ -1607,6 +1607,76 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
@@ -1607,6 +1607,76 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Solo user presses Fly button */ |
|
|
|
|
case MAV_CMD_SOLO_BTN_FLY_CLICK: { |
|
|
|
|
result = MAV_RESULT_ACCEPTED; |
|
|
|
|
|
|
|
|
|
if (sub.failsafe.radio) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// set mode to Loiter or fall back to AltHold
|
|
|
|
|
if (!sub.set_mode(LOITER, MODE_REASON_GCS_COMMAND)) { |
|
|
|
|
sub.set_mode(ALT_HOLD, MODE_REASON_GCS_COMMAND); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Solo user holds down Fly button for a couple of seconds */ |
|
|
|
|
case MAV_CMD_SOLO_BTN_FLY_HOLD: { |
|
|
|
|
result = MAV_RESULT_ACCEPTED; |
|
|
|
|
|
|
|
|
|
if (sub.failsafe.radio) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!sub.motors.armed()) { |
|
|
|
|
// if disarmed, arm motors
|
|
|
|
|
sub.init_arm_motors(true); |
|
|
|
|
} else if (sub.ap.land_complete) { |
|
|
|
|
// if armed and landed, takeoff
|
|
|
|
|
if (sub.set_mode(LOITER, MODE_REASON_GCS_COMMAND)) { |
|
|
|
|
sub.do_user_takeoff(packet.param1*100, true); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// if flying, land
|
|
|
|
|
sub.set_mode(LAND, MODE_REASON_GCS_COMMAND); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Solo user presses pause button */ |
|
|
|
|
case MAV_CMD_SOLO_BTN_PAUSE_CLICK: { |
|
|
|
|
result = MAV_RESULT_ACCEPTED; |
|
|
|
|
|
|
|
|
|
if (sub.failsafe.radio) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (sub.motors.armed()) { |
|
|
|
|
if (sub.ap.land_complete) { |
|
|
|
|
// if landed, disarm motors
|
|
|
|
|
sub.init_disarm_motors(); |
|
|
|
|
} else { |
|
|
|
|
// assume that shots modes are all done in guided.
|
|
|
|
|
// NOTE: this may need to change if we add a non-guided shot mode
|
|
|
|
|
bool shot_mode = (!is_zero(packet.param1) && sub.control_mode == GUIDED); |
|
|
|
|
|
|
|
|
|
if (!shot_mode) { |
|
|
|
|
if (sub.set_mode(BRAKE, MODE_REASON_GCS_COMMAND)) { |
|
|
|
|
sub.brake_timeout_to_loiter_ms(2500); |
|
|
|
|
} else { |
|
|
|
|
sub.set_mode(ALT_HOLD, MODE_REASON_GCS_COMMAND); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// SoloLink is expected to handle pause in shots
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
result = MAV_RESULT_UNSUPPORTED; |
|
|
|
|
break; |
|
|
|
@ -1970,7 +2040,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
@@ -1970,7 +2040,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST: |
|
|
|
|
sub.gcs[chan-MAVLINK_COMM_0].send_autopilot_version(FIRMWARE_VERSION); |
|
|
|
|
send_autopilot_version(FIRMWARE_VERSION); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MAVLINK_MSG_ID_LED_CONTROL: |
|
|
|
|