Skip to content
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

SITL: add jsbsim_ext ("external JSBSim") model #1

Merged
merged 3 commits into from
Sep 25, 2024

Conversation

spernsteiner
Copy link
Collaborator

@spernsteiner spernsteiner commented Sep 13, 2024

This branch adds a new aircraft model jsbsim_ext for the SITL simulator. This is similar to the existing jsbsim model, but connects to an existing jsbsim_proxy process instead of starting JSBSim itself. This allows JSBSim to run on a different machine from the SITL binary, which we need for the OpenSUT configuration.

The first commit adds the jsbsim_ext model as an exact copy of jsbsim, just renamed. The second commit implements the new behavior.

Part of GaloisInc/VERSE-OpenSUT#97

The ordinary `JSBSim` simulator model is designed to spawn and manage a
JSBSim process itself.  This commit removes that logic and adjusts the
control port number to work with jsbsim_proxy.
Copy link
Collaborator

@podhrmic podhrmic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please push these changes into a new branch in https://github.com/galoisinc/ardupilot/

I opened an IT ticket to get you access, hopefully it will happen soon.

@spernsteiner
Copy link
Collaborator Author

Please push these changes into a new branch in https://github.com/galoisinc/ardupilot/

That's a public repo - did we finally get DISTAR approval for VERSE? I haven't heard any update on that in a while

@podhrmic
Copy link
Collaborator

podhrmic commented Sep 24, 2024

Good point. Let me see. You have write access to https://github.com/galoisinc/ardupilot/ now.

DISTAR is not ready yet, thus we will need to use this repo and move it over later.

@spernsteiner
Copy link
Collaborator Author

we will need to use this repo and move it over later.

Is this good to merge, then?

@podhrmic
Copy link
Collaborator

Yes, just approved.

@spernsteiner spernsteiner changed the base branch from Plane-4.5 to VERSE-Plane-4.5 September 25, 2024 23:23
@spernsteiner spernsteiner merged commit 5d833fe into VERSE-Plane-4.5 Sep 25, 2024
spernsteiner added a commit to GaloisInc/VERSE-OpenSUT that referenced this pull request Sep 25, 2024
Add jsbsim_proxy for use with ArduPilot

This adds a `jsbsim_proxy` tool, which can be used in conjunction with the ArduPilot SITL `jsbsim_ext` model (GaloisInc/verse-ardupilot#1) to run JSBSim on a separate machine from the `arduplane` SITL binary.  See the `jsbsim_proxy` README for instructions, and see the comment at the top of `jsbsim_proxy.c` for details of the design.
spernsteiner added a commit that referenced this pull request Feb 13, 2025
SITL: allow setting jsbsim_ext sim rate multiplier

I noticed recently that the OpenSUT autopilot is completely non-functional - instead of initializing sensors in a few seconds and letting the user start the mission, it slowly initializes them over the course of several hours (I ran it for 3+ hours and it never reached the "pre-arm good" state) while constantly dropping the connection to MAVproxy.  After several days of debugging and a bit of archeology, I found this commit on my old laptop, which apparently I forgot to push when creating #1.  Adding this commit fixes the bug.

The actual change in this commit is to allow the JSBSim update rate to be an integer multiple of the autopilot's update rate.  The performance overhead of the OpenSUT's nested VM setup means the autopilot update rate can't exceed ~300 Hz, but JSBSim's update rate must be at least 400 Hz (ideally much higher) or else the simulation becomes unstable.  To work around this, we run JSBSim at 2500 Hz and run the autopilot at 250 Hz with a sim rate multiplier of 10x.  The autopilot needs to be aware of the sim rate multiplier because the autopilot itself is responsible for driving the simulation - it periodically sends commands to JSBSim instructing it to advance the simulation by a certain amount.

I haven't fully investigated the previous bug, but my guess is that the autopilot was timing out waiting for updates from JSBSim.  The autopilot was expecting an update after each step, but JSBSim was sending updates only every 10 steps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants