diff --git a/docs/en/advanced/rtk_gps.md b/docs/en/advanced/rtk_gps.md index 1db86a12781..f673e8ce0d2 100644 --- a/docs/en/advanced/rtk_gps.md +++ b/docs/en/advanced/rtk_gps.md @@ -65,6 +65,14 @@ Current limitations: - Stale partial state is dropped after 1 second if the rest of the fragments do not arrive. - The legacy exact-multiple compatibility fallback only works if another `sequence_id` arrives before that 1 second timeout. Otherwise the buffered partial message is dropped. +### Corrections from ROS 2 + +ROS 2 applications can send corrections over [uXRCE-DDS](../middleware/uxrce_dds.md) by publishing [`px4_msgs/msg/RtcmData`](../msg_docs/RtcmData.md) on `/fmu/in/rtcm_corrections`: + +- Split the correction byte stream into consecutive messages of up to 300 bytes (`data`, `len`). Message boundaries need not match RTCM frame boundaries. +- Give each source its own constant `device_id`. Each value is routed to its own `rtcm_corrections` instance, so two sources sharing an ID interleave their streams. +- A `timestamp` of 0 is replaced with the time of receipt. + ### RTCM messages QGroundControl configures the RTK base station to output the following RTCM3.2 frames, each with 1 Hz, unless otherwise stated: diff --git a/docs/en/releases/main.md b/docs/en/releases/main.md index e1dc3f9e473..96726670e48 100644 --- a/docs/en/releases/main.md +++ b/docs/en/releases/main.md @@ -144,6 +144,7 @@ Please continue reading for [upgrade instructions](#upgrade-guide). ### uXRCE-DDS / Zenoh / ROS 2 - (uXRCE-DDS): SITL multi vehicle automatic namespace prefix is now `uav_{px4_instance}` and it is aligned with the behaviour of `UXRCE_DDS_NS_IDX`. ([PX4-Autopilot#28338](https://github.com/PX4/PX4-Autopilot/pull/28338)) +- (uXRCE-DDS): RTK corrections can be published from ROS 2 on `/fmu/in/rtcm_corrections` ([RtcmData](../msg_docs/RtcmData.md)); see [Corrections from ROS 2](../advanced/rtk_gps.md#corrections-from-ros-2). ([PX4-Autopilot#29368](https://github.com/PX4/PX4-Autopilot/pull/29368)) ### MAVLink diff --git a/msg/RtcmData.msg b/msg/RtcmData.msg index 09728a720fc..aa3ceea9284 100644 --- a/msg/RtcmData.msg +++ b/msg/RtcmData.msg @@ -3,7 +3,7 @@ # Published under two topic names that share this definition (see TOPICS below): # # rtcm_corrections - external fixed-base corrections fed into the vehicle (MAVLink -# GPS_RTCM_DATA, UAVCAN RTCMStream, GPS drivers in dump mode). Multiple +# GPS_RTCM_DATA, UAVCAN RTCMStream, uXRCE-DDS, GPS drivers in dump mode). Multiple # sources are allowed, one uORB instance each; consumers select one instance. # # rtcm_moving_baseline - moving-base GPS output (RTCM 4072 or equivalent) intended for a rover. diff --git a/src/drivers/uavcan/sensors/gnss.cpp b/src/drivers/uavcan/sensors/gnss.cpp index 2016c987180..966d9f9057c 100644 --- a/src/drivers/uavcan/sensors/gnss.cpp +++ b/src/drivers/uavcan/sensors/gnss.cpp @@ -628,7 +628,8 @@ void UavcanGnssBridge::drainRtcmCorrections() have_msg = false; num_injections++; - PublishRTCMStream(msg.data, msg.len); + // uXRCE-DDS passes the publisher's len through unchecked + PublishRTCMStream(msg.data, math::min(msg.len, sizeof(msg.data))); _rtcm_injection_rate_message_count++; _last_rtcm_injection_time = hrt_absolute_time(); } @@ -655,7 +656,7 @@ void UavcanGnssBridge::drainMovingBaseline() last_generation, _rtcm_moving_baseline_sub.get_last_generation()); } - PublishMovingBaselineData(msg.data, msg.len); + PublishMovingBaselineData(msg.data, math::min(msg.len, sizeof(msg.data))); } } diff --git a/src/modules/uxrce_dds_client/dds_topics.yaml b/src/modules/uxrce_dds_client/dds_topics.yaml index 5b2c08acdf9..656c301769e 100644 --- a/src/modules/uxrce_dds_client/dds_topics.yaml +++ b/src/modules/uxrce_dds_client/dds_topics.yaml @@ -248,3 +248,8 @@ subscriptions_multi: type: px4_msgs::msg::AuxGlobalPosition route_field: id max_instances: 4 + + - topic: /fmu/in/rtcm_corrections + type: px4_msgs::msg::RtcmData + route_field: device_id + max_instances: 4