-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
init.d-posix: support running SITL slower #12259
Conversation
This enables using a rational number for PX4_SIM_SPEED_FACTOR. This is required if the simulation is run slower than realtime, for instance 0.5 to simulate at half the speed. Since bash can't natively do floating point arithmetic, we need to use bc.
@dagar ok, so we just can't do it given the shellcheck. I suppose the possible solutions are:
I tend towards number 3 since that's the proper fix. |
When the simulation runs faster than realtime we need to relax the timeout checks. This was done using this hack to change the timeout parameters. In subsequent commits we will fix this properly by using the correct time source when checking timeouts of external messages.
When the simulation is running faster than realtime we sometimes need to use the actual host/environment time. This is for instance required to check for timeouts on external messages.
Heartbeats arriving are sent at a rate based on the normal system/environment time and not at the PX4 time which might run faster or slower in SITL. Therefore, we need to use the environment time when checking for timeouts of the heartbeats.
I went ahead with number 3. |
I'm not sure how I feel about making commander aware of what's really happening like this. |
Taking a step back I'm starting to think we'd specifically want these things interpreted in the vehicles reference timeframe (testing failsafes, etc). |
@dagar so we change the params as I suggested initially in this PR? |
Fixed by #12401. |
This enables using a rational number for
PX4_SIM_SPEED_FACTOR
.This is required if the simulation is run slower than realtime, for instance 0.5 to simulate at half the speed.
Since bash can't natively do floating point arithmetic, we need to use
bc
.Please use PX4 Discuss or Slack to align on pull requests if necessary. You can then open draft pull requests to get early feedback.