Problem with Fast Restart and Simulink Scenario Reader
조회 수: 14 (최근 30일)
이전 댓글 표시
Hello everyone,
I'm trying to train an RL agent on a vehicle to brake when encountering a pedestrian. I have set up a scenario using the driving scenario toolbox and everything in simulink to make it work.
I just have one problem: I'd like to randomize the pedestrian's position, so I created a random function in the scenario definition script, but when I use fast restart the scenario reader gets stuck on the first simulation scenario. If I don't, Simulink recompiles and everything works.
Is there a way to not disable fast restart, but still completely restart the scenario with variations?
댓글 수: 0
답변 (1개)
vikash
2024년 7월 30일 12:03
Hi Francesco,
It seems you are unable to update the pedestrian positions as the ‘Scenario Reader’ block gets stuck with values from the first iteration.
This happens because Simulink does not reinitialize the model every iteration while using Fast Restart. This might lead to the variables being cached, which can cause the ‘Scenario Reader’ block to reuse the same pedestrian actor position in multiple simulation runs.
For this scenario the pedestrian position values can be updated via adding snippets of code as required, in the ‘StartFcn’ under “MODELING>Model Properties>Callbacks>StartFcn” in Simulink. This will ensure that it is updated at every iteration even while using Fast Restart.
Instead if you want to update the Scenario variations you can refer to the documentation: https://www.mathworks.com/help/driving/ug/create-driving-scenario-variations-programmatically.html.
Hope this helps and if not feel free to provide more details of the Driving Scenario.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!