-
Notifications
You must be signed in to change notification settings - Fork 207
Description
While running the sensor_combined_listener node, I noticed a curious behavior: most of the time, I receive a smooth stream of high-frequency messages, but occasionally there’s a full-second gap, followed by DDS delivering a burst of messages almost back-to-back.
I’m surprised by the variability in the rate — especially the long gap between bursts.
Does anyone have insights into what might cause this and why?
I plan to use this data in a control loop by publishing commands to /fmu/in topics, and I wonder whether the inconsistent timing could affect control performance.
For reproducibility:
- OS: Ubuntu 22.04.5 LTS
- ROS 2: Humble
- Hardware: Pixhawk 4
- Firmware: px4_fmu-v5_default v1.16.0rc
- Transport: Serial at 921600 baud
MicroXRCEAgent serial --dev /dev/ttyUSB0 -b 921600
I modified the printout in the node to measure the time difference between consecutive messages delivered by ROS 2 to the callback:
In the constructor:
subscription_ = this->create_subscription<px4_msgs::msg::SensorCombined>("/fmu/out/sensor_combined", qos,
[this](const px4_msgs::msg::SensorCombined::UniquePtr msg) {
auto now = this->now();
double dt = (now - last_time).seconds();
last_time = now;
RCLCPP_INFO(this->get_logger(), "Δt=%.4f s (%.2f Hz)", dt, 1.0/dt);
});
In the private:
rclcpp::Time last_time = this->now();
Sample output:
[INFO] [1755130751.472511915] [sensor_combined_listener]: Δt=0.0121 s (82.59 Hz)
[INFO] [1755130751.477661205] [sensor_combined_listener]: Δt=0.0052 s (194.17 Hz)
[INFO] [1755130751.486728175] [sensor_combined_listener]: Δt=0.0091 s (110.29 Hz)
[INFO] [1755130751.500486821] [sensor_combined_listener]: Δt=0.0138 s (72.68 Hz)
[INFO] [1755130751.511492155] [sensor_combined_listener]: Δt=0.0110 s (90.86 Hz)
[INFO] [1755130752.513047220] [sensor_combined_listener]: Δt=1.0016 s (1.00 Hz) <=== This is surprising!
[INFO] [1755130752.533087806] [sensor_combined_listener]: Δt=0.0200 s (49.90 Hz)
[INFO] [1755130752.547164256] [sensor_combined_listener]: Δt=0.0141 s (71.04 Hz)
[INFO] [1755130752.560954517] [sensor_combined_listener]: Δt=0.0138 s (72.51 Hz)
[INFO] [1755130752.569757364] [sensor_combined_listener]: Δt=0.0088 s (113.60 Hz)
[INFO] [1755130752.579939969] [sensor_combined_listener]: Δt=0.0102 s (98.19 Hz)