mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-28 08:50:35 +08:00
adsb: warnings fixes & remove UTM_GLOBAL_POSITION (#21663)
- warn about full traffic conflict buffer at 1/60hz. - add conflict expiry for buffer. - use only events for buffer full warning. mavlink_log_critical no longer needed. - use icao address for conflict warnings id, stop using uas_id. UTM_GLOBAL_POSITION assumed deprecated. - stop spamming when buffer is full - fix warning wording if buffer is full. - remove UTM_GLOBAL_POSITION Fixes failing unit test: * [adsbTest] Reduce conflict timestamps - not enough time has passed in ci - failed ci output - (passes locally with make tests TESTFILTER=AdsbConflict) - Timestamp: 6000000000 - Time now: 457720038 - Time since timestamp: 0 - Old Conflict warning expired: 0 - -------------------- - adsb_conflict._traffic_state 0 - ../../src/lib/adsb/AdsbConflictTest.cpp:244: Failure - Value of: adsb_conflict._traffic_state == TRAFFIC_STATE::REMIND_CONFLICT - Actual: false - Expected: true
This commit is contained in:
@@ -1440,7 +1440,6 @@ Mavlink::configure_streams_to_default(const char *configure_single_stream)
|
||||
configure_stream_local("SERVO_OUTPUT_RAW_0", 1.0f);
|
||||
configure_stream_local("SYS_STATUS", 1.0f);
|
||||
configure_stream_local("TIME_ESTIMATE_TO_TARGET", 1.0f);
|
||||
configure_stream_local("UTM_GLOBAL_POSITION", 0.5f);
|
||||
configure_stream_local("VFR_HUD", 4.0f);
|
||||
configure_stream_local("VIBRATION", 0.1f);
|
||||
configure_stream_local("WIND_COV", 0.5f);
|
||||
@@ -1510,7 +1509,6 @@ Mavlink::configure_streams_to_default(const char *configure_single_stream)
|
||||
configure_stream_local("SYSTEM_TIME", 1.0f);
|
||||
configure_stream_local("TIME_ESTIMATE_TO_TARGET", 1.0f);
|
||||
configure_stream_local("TRAJECTORY_REPRESENTATION_WAYPOINTS", 5.0f);
|
||||
configure_stream_local("UTM_GLOBAL_POSITION", 1.0f);
|
||||
configure_stream_local("VFR_HUD", 10.0f);
|
||||
configure_stream_local("VIBRATION", 0.5f);
|
||||
configure_stream_local("WIND_COV", 10.0f);
|
||||
@@ -1576,7 +1574,6 @@ Mavlink::configure_streams_to_default(const char *configure_single_stream)
|
||||
configure_stream_local("SERVO_OUTPUT_RAW_0", 1.0f);
|
||||
configure_stream_local("SYS_STATUS", 5.0f);
|
||||
configure_stream_local("TRAJECTORY_REPRESENTATION_WAYPOINTS", 5.0f);
|
||||
configure_stream_local("UTM_GLOBAL_POSITION", 1.0f);
|
||||
configure_stream_local("VFR_HUD", 4.0f);
|
||||
configure_stream_local("VIBRATION", 0.5f);
|
||||
configure_stream_local("WIND_COV", 1.0f);
|
||||
@@ -1675,7 +1672,6 @@ Mavlink::configure_streams_to_default(const char *configure_single_stream)
|
||||
configure_stream_local("SYS_STATUS", 1.0f);
|
||||
configure_stream_local("SYSTEM_TIME", 1.0f);
|
||||
configure_stream_local("TIME_ESTIMATE_TO_TARGET", 1.0f);
|
||||
configure_stream_local("UTM_GLOBAL_POSITION", 1.0f);
|
||||
configure_stream_local("VFR_HUD", 20.0f);
|
||||
configure_stream_local("VIBRATION", 2.5f);
|
||||
configure_stream_local("WIND_COV", 10.0f);
|
||||
@@ -1760,7 +1756,6 @@ Mavlink::configure_streams_to_default(const char *configure_single_stream)
|
||||
configure_stream_local("SYSTEM_TIME", 2.0f);
|
||||
configure_stream_local("TIME_ESTIMATE_TO_TARGET", 1.0f);
|
||||
configure_stream_local("TRAJECTORY_REPRESENTATION_WAYPOINTS", 5.0f);
|
||||
configure_stream_local("UTM_GLOBAL_POSITION", 1.0f);
|
||||
configure_stream_local("VFR_HUD", 4.0f);
|
||||
configure_stream_local("VIBRATION", 0.5f);
|
||||
configure_stream_local("WIND_COV", 1.0f);
|
||||
|
||||
@@ -150,7 +150,6 @@
|
||||
# include "streams/SCALED_PRESSURE3.hpp"
|
||||
# include "streams/UAVIONIX_ADSB_OUT_CFG.hpp"
|
||||
# include "streams/UAVIONIX_ADSB_OUT_DYNAMIC.hpp"
|
||||
# include "streams/UTM_GLOBAL_POSITION.hpp"
|
||||
#endif // !CONSTRAINED_FLASH
|
||||
|
||||
// ensure PX4 rotation enum and MAV_SENSOR_ROTATION align
|
||||
@@ -419,9 +418,6 @@ static const StreamListItem streams_list[] = {
|
||||
#if defined(ADSB_VEHICLE_HPP)
|
||||
create_stream_list_item<MavlinkStreamADSBVehicle>(),
|
||||
#endif // ADSB_VEHICLE_HPP
|
||||
#if defined(UTM_GLOBAL_POSITION_HPP)
|
||||
create_stream_list_item<MavlinkStreamUTMGlobalPosition>(),
|
||||
#endif // UTM_GLOBAL_POSITION_HPP
|
||||
#if defined(COLLISION_HPP)
|
||||
create_stream_list_item<MavlinkStreamCollision>(),
|
||||
#endif // COLLISION_HPP
|
||||
|
||||
@@ -224,10 +224,6 @@ MavlinkReceiver::handle_message(mavlink_message_t *msg)
|
||||
handle_message_adsb_vehicle(msg);
|
||||
break;
|
||||
|
||||
case MAVLINK_MSG_ID_UTM_GLOBAL_POSITION:
|
||||
handle_message_utm_global_position(msg);
|
||||
break;
|
||||
|
||||
case MAVLINK_MSG_ID_COLLISION:
|
||||
handle_message_collision(msg);
|
||||
break;
|
||||
@@ -2540,91 +2536,6 @@ MavlinkReceiver::handle_message_adsb_vehicle(mavlink_message_t *msg)
|
||||
_transponder_report_pub.publish(t);
|
||||
}
|
||||
|
||||
void
|
||||
MavlinkReceiver::handle_message_utm_global_position(mavlink_message_t *msg)
|
||||
{
|
||||
mavlink_utm_global_position_t utm_pos;
|
||||
mavlink_msg_utm_global_position_decode(msg, &utm_pos);
|
||||
|
||||
bool is_self_published = false;
|
||||
|
||||
|
||||
#ifndef BOARD_HAS_NO_UUID
|
||||
px4_guid_t px4_guid;
|
||||
board_get_px4_guid(px4_guid);
|
||||
is_self_published = sizeof(px4_guid) == sizeof(utm_pos.uas_id)
|
||||
&& memcmp(px4_guid, utm_pos.uas_id, sizeof(px4_guid_t)) == 0;
|
||||
#else
|
||||
|
||||
is_self_published = msg->sysid == _mavlink->get_system_id();
|
||||
#endif /* BOARD_HAS_NO_UUID */
|
||||
|
||||
|
||||
//Ignore selfpublished UTM messages
|
||||
if (is_self_published) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert cm/s to m/s
|
||||
float vx = utm_pos.vx / 100.0f;
|
||||
float vy = utm_pos.vy / 100.0f;
|
||||
float vz = utm_pos.vz / 100.0f;
|
||||
|
||||
transponder_report_s t{};
|
||||
t.timestamp = hrt_absolute_time();
|
||||
mav_array_memcpy(t.uas_id, utm_pos.uas_id, PX4_GUID_BYTE_LENGTH);
|
||||
t.icao_address = msg->sysid;
|
||||
t.lat = utm_pos.lat * 1e-7;
|
||||
t.lon = utm_pos.lon * 1e-7;
|
||||
t.altitude = utm_pos.alt / 1000.0f;
|
||||
t.altitude_type = ADSB_ALTITUDE_TYPE_GEOMETRIC;
|
||||
// UTM_GLOBAL_POSIION uses NED (north, east, down) coordinates for velocity, in cm / s.
|
||||
t.heading = atan2f(vy, vx);
|
||||
t.hor_velocity = sqrtf(vy * vy + vx * vx);
|
||||
t.ver_velocity = -vz;
|
||||
// TODO: Callsign
|
||||
// For now, set it to all 0s. This is a null-terminated string, so not explicitly giving it a null
|
||||
// terminator could cause problems.
|
||||
memset(&t.callsign[0], 0, sizeof(t.callsign));
|
||||
t.emitter_type = ADSB_EMITTER_TYPE_UAV; // TODO: Is this correct?x2?
|
||||
|
||||
// The Mavlink docs do not specify what to do if tslc (time since last communication) is out of range of
|
||||
// an 8-bit int, or if this is the first communication.
|
||||
// Here, I assume that if this is the first communication, tslc = 0.
|
||||
// If tslc > 255, then tslc = 255.
|
||||
unsigned long time_passed = (t.timestamp - _last_utm_global_pos_com) / 1000000;
|
||||
|
||||
if (_last_utm_global_pos_com == 0) {
|
||||
time_passed = 0;
|
||||
|
||||
} else if (time_passed > UINT8_MAX) {
|
||||
time_passed = UINT8_MAX;
|
||||
}
|
||||
|
||||
t.tslc = (uint8_t) time_passed;
|
||||
|
||||
t.flags = 0;
|
||||
|
||||
if (utm_pos.flags & UTM_DATA_AVAIL_FLAGS_POSITION_AVAILABLE) {
|
||||
t.flags |= transponder_report_s::PX4_ADSB_FLAGS_VALID_COORDS;
|
||||
}
|
||||
|
||||
if (utm_pos.flags & UTM_DATA_AVAIL_FLAGS_ALTITUDE_AVAILABLE) {
|
||||
t.flags |= transponder_report_s::PX4_ADSB_FLAGS_VALID_ALTITUDE;
|
||||
}
|
||||
|
||||
if (utm_pos.flags & UTM_DATA_AVAIL_FLAGS_HORIZONTAL_VELO_AVAILABLE) {
|
||||
t.flags |= transponder_report_s::PX4_ADSB_FLAGS_VALID_HEADING;
|
||||
t.flags |= transponder_report_s::PX4_ADSB_FLAGS_VALID_VELOCITY;
|
||||
}
|
||||
|
||||
// Note: t.flags has deliberately NOT set VALID_CALLSIGN or VALID_SQUAWK, because UTM_GLOBAL_POSITION does not
|
||||
// provide these.
|
||||
_transponder_report_pub.publish(t);
|
||||
|
||||
_last_utm_global_pos_com = t.timestamp;
|
||||
}
|
||||
|
||||
void
|
||||
MavlinkReceiver::handle_message_collision(mavlink_message_t *msg)
|
||||
{
|
||||
|
||||
@@ -1273,6 +1273,9 @@ void Navigator::check_traffic()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_adsb_conflict.remove_expired_conflicts();
|
||||
|
||||
}
|
||||
|
||||
bool Navigator::abort_landing()
|
||||
@@ -1544,7 +1547,7 @@ controller.
|
||||
PRINT_MODULE_USAGE_NAME("navigator", "controller");
|
||||
PRINT_MODULE_USAGE_COMMAND("start");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("fencefile", "load a geofence file from SD card, stored at etc/geofence.txt");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("fake_traffic", "publishes 4 fake transponder_report_s uORB messages");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("fake_traffic", "publishes 24 fake transponder_report_s uORB messages");
|
||||
PRINT_MODULE_USAGE_DEFAULT_COMMANDS();
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user