How to run Simulink environment(3D Simulation) and MATLAB function/script logic asynchronously in parallel?
Show older comments
Hello,
I am experiencing a significant slowdown in my robotics simulation because the 3D environment (Simulation 3D Robot) and my control logic (MATLAB System block/Function) are executing in a strictly sequential, synchronous manner.
Currently, the simulation waits for the code execution to finish at every step, and the code waits for the environment to provide the next frame. I want to decouple these two processes so they can run asynchronously in parallel.
Specifically, I want the 3D environment to continue its physics/rendering without waiting, while the control logic performs its heavy computation on a separate core/process.
Could you please advise on:
1. Non-blocking Asynchronous Execution:How can I configure Parallel Model Reference or use specific blocks (like Rate Transition with 'Ensure deterministic data transfer' unchecked) to allow the environment to run at full speed without being blocked by the controller's computation time?
2. Asynchronous Rate Transition:What is the best way to handle data exchange when the environment runs at a high frequency (e.g., 60Hz) but the perception/control logic runs at a lower, non-deterministic frequency (e.g., 5-10Hz)?
3. Utilizing Parallel Computing Toolbox for Real-time Speedup:Beyond just enabling 'Parallel Model Reference', are there specific S-Function or MATLAB System object techniques that allow a block to run in a separate thread or background process so it doesn't halt the main Simulink solver?
Thank you!
Accepted Answer
More Answers (0)
Categories
Find more on Simulation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!