How to make time syncrhronization before start simulator

Hello, I am working on a project to show drone flight on the web using px4 simulation.
While I’m working on a project, I’m experiencing a phenomenon where the drone teleports whenever the warning below appears.

WARN  [timesync] time jump detected. Resetting time synchroniser.
WARN  [uxrce_dds_client] time sync no longer converged
INFO  [uxrce_dds_client] time sync converged

and I found ROS 2 User Guide | PX4 Guide (main), so I checked I can make time sync with

run ros-humble-ros-gzharmonic
making ros2 node use_sim_time true
making UXRCE_DDS_SYNCT to `false`

However, to do this, I must click to change the value in the system parameter(UXRCE_DDS_SYNCT) through QGroundControl’s GUI.

What I want to do is to create a parameter file in advance before the simulation starts and have the corresponding system parameters applied automatically.

Originally, I could change the parameters of QGC and continue using it, but since we are using doker, it is impossible to manipulate the GUI. That’s why I need a way to change parameters without clicking.

Is there a way to change the UXRCE_DDS_SYNCT parameter without GUI manipulation?

parameter is here Parameter Reference | PX4 Guide (main).

I found PX4-Autopilot/src/modules/uxrce_dds_client/module.yaml at e194a52907083783f7e67ff93504016ca1275ce8 · PX4/PX4-Autopilot · GitHub, and fixed UXRCE_DDS_SYNCT default: 0, but nothing changed.

Hi @rkdwhddud1, thanks for reporting. Can you please share the following:

  • What version of PX4 are you running?
  • Where are the client and agent running? Please share more regarding your network topology

Typically, the time jump occurs when something goes wrong somewhere else. You shouldn’t tolerate those or make adjustments unless you 100% know what you are doing.

If you could also share a log it would be easier to review what you are doing and possibly help you.

1 Like

thanks for reply! Im using ubuntu 22.04, px4 with version 1.15.0, ros2 humble. Im newbie of px4 simulation, so I don’t know specific knowledge. I just ran

MicroXRCEAgent udp4 -p 8888
./QGroundControl

and started simulation via

HEADLESS=1 PX4_SYS_AUTOSTART=4001 PX4_GZ_MODEL_POSE='{y_disp},{x_disp}' PX4_GZ_MODEL=x500 ./build/px4_sitl_default/bin/px4 -i {instance_id}

with my ros2 node. I always experienced timesync like below.

and I fixed this by setting value UXRCE_DDS_SYNCT default: 0 in PX4-Autopilot/src/modules/uxrce_dds_client/module.yaml at e194a52907083783f7e67ff93504016ca1275ce8 · PX4/PX4-Autopilot · GitHub
before running

make px4_sitl

, and run ros2_gz_bridge

ros2 run ros_gz_bridge parameter_bridge /clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock

and setting my ros2 node param use_sim_time to true.

If there is another way to fix this without such complicated settings, please let me know.

thanks for reading.

If this is all running on your laptop, your system may be running out of resources and slowing down SITL

1 Like