How to start, pause, log information, and continue a simscape simulation?

3 ビュー (過去 30 日間)
Anthony
Anthony 2023 年 6 月 6 日
コメント済み: Anthony 2023 年 6 月 20 日
I am looking to use a simscape model as an environment to conduct reinfrocement learning (RL). The RL agent needs to change the kinematics of a robot once every second. As I see it I have two options
1) run 1 second simulations and then provide the end conditions as intial conditions of a new simulation for 10 cycles giving a 10 second simulation (cons: less ideal for visualization purposes, slow)
2) run a 10 second simulation that i am able to pause every second, log the data, and restart the simulation with new kinematics ready to go (probably faster, easier for visualization and implementation)
I'm finding it difficult to find documentation that shows how to programatically pause a simulation after a condition is met and then continue the simulation after changing some of the varaibles in the model. Any guidance would be greatly appreciated!

回答 (1 件)

Emmanouil Tzorakoleftherakis
Emmanouil Tzorakoleftherakis 2023 年 6 月 13 日
If you go for #2, why don't you set it so that you have episodes that are 10 seconds long?
When each episode ends, change the initial conditions as needed for the next episode and so on.
  1 件のコメント
Anthony
Anthony 2023 年 6 月 20 日
I want to be able to update the actions every timestep without reseting the simulation. I think I didn't communicate my problem effectively. Either way I just found this example:
I am working through it now to understand it and I think I see how to fix the problem that I have but it requires a signifcant restructuring and different approach. Thanks for the help!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTroubleshooting についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by