Change revolute joint parameter in env.ResetFcn during reinforcement learning

2 views (last 30 days)
What is the best way to randomize the initial revolute joint angle during eacg episode of reinforcement learning
right now I am using
function in = Arm_ResetFcn(in, init_angle)
init_angle_up = -pi/2 + 2*rand*pi/2;
if rand > 0*5
in = set_param(in,blk_init,'PositionTargetValue',num2str(init_angle_up));
else
in = set_param(in, blk_init,'PositionTargetValue',num2str(init_angle));
But i am getting errors during simulation
Is it better to define a variable and then use
in = in.setVariable('init_angle',init_angle);
to update the initial angle before each episode?

Answers (0)

Community Treasure Hunt

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

Start Hunting!