Problems to set up the reset function in Reinforcement learning environment

4 ビュー (過去 30 日間)
Jooo
Jooo 2020 年 8 月 19 日
Hi,
I am trying to set up a reset function for my simulation of a Furuta pendulum. With the code below I am able to randomly assign a Value to the specified constant block in Simulink in every new episode. Unfortunately I don´t know how to modify my code, so that it also varies the Arm and Pendulum Position at every new episode. These variables are used as state targets in the revolute joints of my simulink model.
Can somebody help me on that?
function in = localResetFcn(in)
blk = sprintf('RL_Inverse_Pendulum_10/Environment/Target_Position');
Target_Position = randi(4)*pi/2-pi/2;
% Arm_Position=randi(4)*pi/2-pi/2;
% Pendel_Position=randi(4)*pi/2-pi/2;
in = setBlockParameter(in,blk,'Value',num2str(Target_Position));
end

回答 (1 件)

Emmanouil Tzorakoleftherakis
Emmanouil Tzorakoleftherakis 2020 年 9 月 3 日
Maybe I am missing something, but why don't you add a couple of lines that call 'setBlockParameter' with the appropriate path to your other constant blocks?

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by