How do I randomize the value in a constant block for a local reset function for RL training
2 次查看(过去 30 天)
显示 更早的评论
Apoorv Pandey
2023-2-10
回答: Emmanouil Tzorakoleftherakis
2023-2-10
I am trying to train an RL Agent for a quadcopter model and for the same, I need to randomize the desired location of the drone which is a vector of 3 elements. I have followed the RL-Water Tank example( https://www.mathworks.com/help/reinforcement-learning/ug/create-simulink-environment-and-train-agent.html ) for the local reset function but I am not able to randomize the constant value in the same way. Please help.
Thanking You
Apoorv Pandey
apoorv.pandey.19e@iitram.ac.in![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1291610/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1291610/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1291615/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1291620/image.png)
Here I tried to test it by deliberately using a constant value.
0 个评论
采纳的回答
Emmanouil Tzorakoleftherakis
2023-2-10
The num2str([10 10 10]) evaluates to '10 10 10' without brackets which is what causes the problem. Instead, just put '[10 10 10]' directly in the last argument, like
setBlockParameter(in,blk,'Value','[10 10 10]')
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Quadcopters and Drones 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!