nasa / trick

Trick Simulation Environment. Trick provides a common set of simulation capabilities and utilities to build simulations automatically.
Other
34 stars 19 forks source link

interrupt the loop and continue where it left off #1597

Closed tastangh closed 10 months ago

tastangh commented 10 months ago

Hello, I am making a NASA trick real-time simulation. On the NASA trick side, I take the data coming from the vehicle with simulation, process it in my algorithms, and send it back to the vehicle. In order to ensure synchronization and real-time, I keep my simulation waiting until the data arrives in the first frame after initialization, but when my vehicle software sometimes does not work and I want to press the freeze button in the meantime, I cannot make it continue from the while loop by putting an interrupt in the while loop, doing freeze, and then click the start button. Is there any solution to this issue? Can the while loop be stopped within the task using freeze during a single task outside the main task loop and continue from the same place?

trick

alexlin0 commented 10 months ago

Sorry, but there is no mechanism to freeze and resume at the same point during the while loop. You can make your ReadData routine a blocking read so that it will not return until you have received data. That is probably the closest behavior to freezing at that point.

tastangh commented 10 months ago

When it freezes while waiting for data during the while phase, I cannot shutdown and I close the trick with sudo losf - i: port number and sudokill PID command every time. Is there a solution to this?

alexlin0 commented 10 months ago

Try the trick-killsim command.