public class CPCorrectModel extends java.lang.Object implements FullStateModel
FullStateModel.Helper
Modifier and Type | Field and Description |
---|---|
protected CartPoleDomain.CPPhysicsParams |
physParams |
Constructor and Description |
---|
CPCorrectModel(CartPoleDomain.CPPhysicsParams physParams) |
Modifier and Type | Method and Description |
---|---|
protected double |
getAngle2ndDeriv(double xv0,
double a0,
double av0,
double nsign,
double f)
Computes the 2nd order derivative of the angle for a given normal force sign using the corrected model.
|
protected double |
getNormForce(double a0,
double av0,
double a_2)
Computes the normal force for the corrected model
|
protected double |
getX2ndDeriv(double xv0,
double a0,
double av0,
double n,
double f,
double a2)
Returns the second order x position derivative for the corrected model.
|
State |
moveCorrectModel(State s,
double dir)
Simulates the physics for one time step give the input state s, and the direction of force applied.
|
State |
sample(State s,
Action a)
Samples and returns a
State from a state transition function. |
java.util.List<StateTransitionProb> |
stateTransitions(State s,
Action a)
|
protected CartPoleDomain.CPPhysicsParams physParams
public CPCorrectModel(CartPoleDomain.CPPhysicsParams physParams)
public java.util.List<StateTransitionProb> stateTransitions(State s, Action a)
FullStateModel
Action
is applied in State
s. The returned
list only needs to include transitions that have non-zero probability of occurring.stateTransitions
in interface FullStateModel
s
- the source statea
- the action to be applied in the source stateStateTransitionProb
objects.public State sample(State s, Action a)
SampleStateModel
State
from a state transition function.sample
in interface SampleStateModel
s
- the source statea
- the action to be executed in the source stateState
public State moveCorrectModel(State s, double dir)
s
- the current state from which one time step of physics will be simulated.dir
- the direction of force applied; should be -1, or 1 and is multiplied to this objects movementForceMag parameter. 0 would cause no force.protected double getAngle2ndDeriv(double xv0, double a0, double av0, double nsign, double f)
xv0
- the cart velocitya0
- the pole angleav0
- the pole angle velocitynsign
- the normal force signf
- the force applied to the cartprotected double getNormForce(double a0, double av0, double a_2)
a0
- the pole angleav0
- the pole angle velocitya_2
- the 2nd order derivative of the pole angleprotected double getX2ndDeriv(double xv0, double a0, double av0, double n, double f, double a2)
xv0
- the cart velocitya0
- the pole angleav0
- the pole angle velocityn
- the normal forcef
- the force applied to the carta2
- the second order angle derivative