Update: is it possible to use some Simulink-constructed communication protocol to link one Simulink model running on computer A to another Simulink model running on computer B on the same local network, and effectively creating an asynchronous communication channel in this way? If so, then I can place my main path tracking controller in computer A, while placing my on-demand planner in computer B.
How to run on-demand asynchronous tasks in Simulink?
4 ビュー (過去 30 日間)
古いコメントを表示
I wonder how one could implement an on-demand computation task in Simulink that will keep running in the background until finished while not holding up the step-by-step propagation of the Simulink operation.
An example would be: a vehicle follows a path provided by a planner module. The planner module replans the future path in an on-demand manner when a new situation is detected. The vehicle KEEPS TRACKING the previous path without waiting for the replanning results. And the planner module in the meantime replans the path for the new situation, which will take a few seconds of time. Once the new path is calculated, it replaces the old path in Simulink. An illustration figure is shown below(source of figure)
Can this be done for example, by two individual Simulink models, in which model A is running the vehicle controller with an existing planned path, and model B is the on-demand re-planner?
Any hint is appreciated.
回答 (1 件)
Karan Singh
2023 年 9 月 29 日
Hi Tong,
From what I understand, you want guidance on implementing an on-demand computation task in Simulink while ensuring that it runs in the background without interrupting the step-by-step propagation of the Simulink operation.
While one approach being you can use a combination of Stateflow and Simulink blocks. You can have steps as:
- Create a Stateflow chart: Start by creating a Stateflow chart that represents the planner module. This chart will handle the replanning task and run independently in the background. It should have states to handle the different stages of the replanning process.
- Trigger the replanning task: In Simulink, use an event-based trigger to initiate the replanning task. This trigger can be based on a condition that signals the need for replanning.
- Transition to the replanning state: When the trigger condition is met, transition to a replanning state in the Stateflow chart. This state will handle the actual computation of the new path. You can use MATLAB functions or Simulink blocks within this state to perform the replanning calculations.
- Update the path: Once the new path is calculated, update the path variable or data structure in the Stateflow chart to store the new path information.
- Transition back to the tracking state: After the path is updated, transition back to the tracking state in the Stateflow chart. This state will continue to track the vehicle's position using the previous or updated path information.
For your comment, yes, it is possible to establish communication between two Simulink models running on different computers on the same local network. One common approach is to use the Simulink Real-Time product, which allows you to connect Simulink models running on different computers using TCP/IP or UDP/IP communication protocols.
Attached below are some documentation links that you may find helpful:
- Simulink Real-Time Documentation (mathworks.com)
- Simulink Documentation (mathworks.com)
- Stateflow Documentation (mathworks.com)
Hope this helps!
Karan Singh Khati
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Motion Planning についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!