How to use isDone frag?
1 view (last 30 days)
Show older comments
Does isDone frag have the ability to end the episode?
I want to do trainning of simplependulum which can move in specific space.
The space which I hope is X_Position > 0 && Y_Position>0 ,and AngularVelocity < 0.
Is it possible to end the episode when the pendulum moves outside this range using by isDone frag?
function [NextObservation, Reward, IsDone, LoggedSignals] = myStepfunction(Action,LoggedSignals,SimplePendulum)
% prestate before moving
statePre = [0;0];
statePre(1) = SimplePendulum.Theta;
statePre(2) = SimplePendulum.AngularVelocity;
IsDone = false;
% updating state
SimplePendulum.pstep(Action);
% get state's information
state = [0;0];
state(1) = SimplePendulum.Theta; % Angular
state(2) = SimplePendulum.AngularVelocity; % Angular Velocity
X_state_Position = sin(state(1));
Y_state_Position = -cos(state(1));
% difference between ball distance and target point
Ball_Target = 10;
Ball_Distance = X_state_Position + (-state(2))* sqrt(2*abs(Y_state_Position)/9.8);
R = -abs(Ball_Distance -Ball_Target);
% here is problem ↓
% I want to get the information in spesific space, (X_Position > 0,
% && Y_Positin > 0, && State(2) < 0)
if (state(2)) > 0 && (Y_state_Position > 0) && ((abs(state(2))) > 10)
IsDone = true;
end
LoggedSignals.State = state;
NextObservation = LoggedSignals.State;
Reward = + R;
0 Comments
Answers (0)
See Also
Categories
Find more on Assembly in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!