Skip to content

uORB Topic Frequency and Gazebo Real Time Ratio in PX4 SITL #1062

@heleidsn

Description

@heleidsn

Hi,

I am using PX4 SITL to control actuators via ROS2 as my MPC output motor force for the quadrotor. Specifically, I am sending commands to the /fmu/in/actuator_motors topic at 1000Hz. However, I have observed different behaviours depending on the control mode:

Position Control Mode:

The corresponding actuator_motors uORB topic in PX4 runs at 1250Hz.

The real-time ratio in Gazebo remains at 1, which is perfect.

I suspect that this 1250Hz frequency results from the default 250Hz position control in PX4 combined with my 1000Hz ROS2 commands.

Image

Off-Board Mode:

The actuator_motors uORB topic frequency matches my input rate of 1000Hz, as expected.

However, the Gazebo real-time ratio drops to about 0.8 to 0.9, which is not very stable, and the frequency of other uORB topics decreases. When sending motor command via ROS2 at 500Hz, it will drop to about 0.4.

Image

Possible Cause

I suspect this issue might be related to a clock synchronization mismatch between the simulation clock in PX4 SITL and the ROS2 system clock.

Questions

  1. Why does the real-time ratio drop in Gazebo when switching to Off-Board mode, while it remains stable in Position Control mode?

  2. Is the clock synchronization between ROS2 and PX4 SITL affecting the frequency of uORB topics?

  3. Between px4_sitl and px4_sitl_nolockstep, which one is better suited for actuator_motors level control simulation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions