mavlink: switch to events

This commit is contained in:
Beat Küng
2021-09-11 14:08:41 -04:00
committed by Daniel Agar
parent 90940c3672
commit b31276a4f5
4 changed files with 118 additions and 49 deletions
+21 -7
View File
@@ -585,7 +585,9 @@ void MavlinkReceiver::handle_message_command_both(mavlink_message_t *msg, const
if (_mavlink->get_data_rate() < 5000) {
send_ack = true;
result = vehicle_command_ack_s::VEHICLE_RESULT_DENIED;
_mavlink->send_statustext_critical("Not enough bandwidth to enable log streaming");
_mavlink->send_statustext_critical("Not enough bandwidth to enable log streaming\t");
events::send<uint32_t>(events::ID("mavlink_log_not_enough_bw"), events::Log::Error,
"Not enough bandwidth to enable log streaming ({1} \\< 5000)", _mavlink->get_data_rate());
} else {
// we already instanciate the streaming object, because at this point we know on which
@@ -957,8 +959,10 @@ MavlinkReceiver::handle_message_set_position_target_local_ned(mavlink_message_t
setpoint.z = NAN;
} else {
mavlink_log_critical(&_mavlink_log_pub, "SET_POSITION_TARGET_LOCAL_NED coordinate frame %" PRIu8 " unsupported",
mavlink_log_critical(&_mavlink_log_pub, "SET_POSITION_TARGET_LOCAL_NED coordinate frame %" PRIu8 " unsupported\t",
target_local_ned.coordinate_frame);
events::send<uint8_t>(events::ID("mavlink_rcv_sp_target_unsup_coord"), events::Log::Error,
"SET_POSITION_TARGET_LOCAL_NED: coordinate frame {1} unsupported", target_local_ned.coordinate_frame);
return;
}
@@ -977,7 +981,9 @@ MavlinkReceiver::handle_message_set_position_target_local_ned(mavlink_message_t
|| PX4_ISFINITE(setpoint.acceleration[2]);
if (ocm.acceleration && (type_mask & POSITION_TARGET_TYPEMASK_FORCE_SET)) {
mavlink_log_critical(&_mavlink_log_pub, "SET_POSITION_TARGET_LOCAL_NED force not supported");
mavlink_log_critical(&_mavlink_log_pub, "SET_POSITION_TARGET_LOCAL_NED force not supported\t");
events::send(events::ID("mavlink_rcv_sp_target_unsup_force"), events::Log::Error,
"SET_POSITION_TARGET_LOCAL_NED: FORCE is not supported");
return;
}
@@ -996,7 +1002,9 @@ MavlinkReceiver::handle_message_set_position_target_local_ned(mavlink_message_t
}
} else {
mavlink_log_critical(&_mavlink_log_pub, "SET_POSITION_TARGET_LOCAL_NED invalid");
mavlink_log_critical(&_mavlink_log_pub, "SET_POSITION_TARGET_LOCAL_NED invalid\t");
events::send(events::ID("mavlink_rcv_sp_target_invalid"), events::Log::Error,
"SET_POSITION_TARGET_LOCAL_NED: invalid, missing position, velocity or acceleration");
}
}
}
@@ -1065,8 +1073,10 @@ MavlinkReceiver::handle_message_set_position_target_global_int(mavlink_message_t
}
} else {
mavlink_log_critical(&_mavlink_log_pub, "SET_POSITION_TARGET_GLOBAL_INT invalid coordinate frame %" PRIu8,
mavlink_log_critical(&_mavlink_log_pub, "SET_POSITION_TARGET_GLOBAL_INT invalid coordinate frame %" PRIu8 "\t",
target_global_int.coordinate_frame);
events::send<uint8_t>(events::ID("mavlink_rcv_sp_target_gl_invalid_coord"), events::Log::Error,
"SET_POSITION_TARGET_GLOBAL_INT invalid coordinate frame {1}", target_global_int.coordinate_frame);
return;
}
@@ -1101,7 +1111,9 @@ MavlinkReceiver::handle_message_set_position_target_global_int(mavlink_message_t
|| PX4_ISFINITE(setpoint.acceleration[2]);
if (ocm.acceleration && (type_mask & POSITION_TARGET_TYPEMASK_FORCE_SET)) {
mavlink_log_critical(&_mavlink_log_pub, "SET_POSITION_TARGET_LOCAL_NED force not supported");
mavlink_log_critical(&_mavlink_log_pub, "SET_POSITION_TARGET_GLOBAL_INT force not supported\t");
events::send(events::ID("mavlink_rcv_sp_target_gl_unsup_force"), events::Log::Error,
"SET_POSITION_TARGET_GLOBAL_INT: FORCE is not supported");
return;
}
@@ -2399,8 +2411,10 @@ MavlinkReceiver::handle_message_landing_target(mavlink_message_t *msg)
} else if (landing_target.position_valid) {
// We only support MAV_FRAME_LOCAL_NED. In this case, the frame was unsupported.
mavlink_log_critical(&_mavlink_log_pub, "landing target: coordinate frame %" PRIu8 " unsupported",
mavlink_log_critical(&_mavlink_log_pub, "landing target: coordinate frame %" PRIu8 " unsupported\t",
landing_target.frame);
events::send<uint8_t>(events::ID("mavlink_rcv_lnd_target_unsup_coord"), events::Log::Error,
"landing target: unsupported coordinate frame {1}", landing_target.frame);
} else {
irlock_report_s irlock_report{};