Low Pitchrate and Rollrate #1208
Replies: 3 comments
-
It seems you're running one single simulation step of JSBSim for each iteration of your application loop however I guess you want real time behavior, so you have to make sure that JSBSim catches up with the elapsed real time. This is because JSBSim runs faster than real time so its simulated time lags behind the real world clock time. For an example of how to implement this, check out the example below. It checks how much real time has elapsed since the last time JSBSim has been called and calls Lines 209 to 214 in 2bdf0d4 |
Beta Was this translation helpful? Give feedback.
-
This support request has been moved to "Discussions" since it is neither a bug nor a feature request. The discussion will continue in this thread. Thank you. |
Beta Was this translation helpful? Give feedback.
-
Yep, taking a look the attached source code your code reading and processing the inputs is running in lock-step with JSBSim. And in particular there is a big difference in the timesteps. So your code reading the inputs has a sleep of 0.1s (10Hz) after each network send of the inputs, and then the blocking TCP code on the other side runs a single timestep of JSBSim for which you've set the timestep to 0.01s (100Hz). One option is to break the lock step. So have the code running JSBSim not block waiting for TCP input, make it a non-blocking read, and make use of the code above that @bcoconni posted to have the JSBSim simulation loop run at real time. Then whenever input does come in, e.g. at 10Hz via the non-blocking reads then feed the controls in then. In this setup JSBSim will run at 100Hz real time and user inputs will be applied at 10Hz. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am working on integrating JSBSim with Unity. First, I created a Python script to capture input values from the HOTAS controller, which are then sent to the JSBSim script to process through the Flight Dynamics Model (FDM). The resulting calculations are transmitted to Unity to control the flight of a 3D aircraft. However, I feel that the pitch rate and roll rate are too low compared to flight gear. I would really appreciate it if someone could help me with this. (Note: I have set FDM.Setdt to 0.01. I have attatched the python scripts along with this.)
HotasControls.txt
JSBSimPython.txt
Beta Was this translation helpful? Give feedback.
All reactions