PX4-SITL_gazebo-classic icon indicating copy to clipboard operation
PX4-SITL_gazebo-classic copied to clipboard

Multiple aircraft behave with PX4_SIM_SPEED_FACTOR

Open SpBills opened this issue 1 year ago • 4 comments

This problem originates from setting global real_time_update_rate without checking if it has been set before.

To fix this, we check if we've done the calculation before, then do the calculation to update, then then check to see if the updated real_time_update_rate is still valid.

SpBills avatar Jul 13 '22 14:07 SpBills

To replicate this, clone down the PX4 repo (https://github.com/PX4/PX4-Autopilot), run make px4_sitl gazebo, then run PX4_SIM_SPEED_FACTOR=4 Tools/gazebo_sitl_multiple_run.sh -n2

SpBills avatar Jul 13 '22 14:07 SpBills

Issue here: https://github.com/PX4/PX4-SITL_gazebo/issues/879

SpBills avatar Jul 13 '22 14:07 SpBills

I will try out these changes once I get back to my workstation later today.

Something I am concerned about, which I mentioned in one of the review comments, is that the actual speed of the simulator does not seem to be decided by the environment variable, but rather the result the environment variable has on real_time_update_rate.

Let's consider: real_time_update_rate = 0.250 speed_factor_ = 4 With such, we expect real_time_update_rate = 1 by the end of the operation. This is what Gazebo calls a 4x sim speed factor.

So, by setting real_time_update_rate = speed_factor_ would technically make it a 16x sim speed factor.

Any insights on this?

SpBills avatar Aug 01 '22 12:08 SpBills

Sorry for delay... busy with work.

SpBills avatar Aug 08 '22 14:08 SpBills

@SpBills Any updates?

Jaeyoung-Lim avatar Aug 18 '22 09:08 Jaeyoung-Lim

@SpBills Friendly reminder of this open PR. Would you be interested in continuing the PR?

Jaeyoung-Lim avatar Aug 31 '22 11:08 Jaeyoung-Lim

Sorry, I've started school back up and don't have the time to work on this anymore... :(

SpBills avatar Sep 01 '22 02:09 SpBills

@SpBills Thanks for the update, in that case I will close the PR until you have time to work on it again

Jaeyoung-Lim avatar Sep 06 '22 09:09 Jaeyoung-Lim