public class LunarLanderDomain extends java.lang.Object implements DomainGenerator
Modifier and Type | Class and Description |
---|---|
class |
LunarLanderDomain.ActionIdle
An action class for having the agent idle (its current velocity and the force of gravity will be all that acts on the lander).
|
class |
LunarLanderDomain.ActionThrust
An action class for exerting a thrust.
|
class |
LunarLanderDomain.ActionTurn
An action class for turning the lander
|
static class |
LunarLanderDomain.LLPhysicsParams
A class for holding the physics parameters
|
class |
LunarLanderDomain.OnPadPF
A propositional function that evaluates to true if the agent has landed on the top surface of a landing pad.
|
class |
LunarLanderDomain.TouchGroundPF
A propositional function that evaluates to true if the agent is touching the ground.
|
class |
LunarLanderDomain.TouchPadPF
A propositional function that evaluates to true if the agent is touching any part of the landing pad, including its
side boundaries.
|
class |
LunarLanderDomain.TouchSurfacePF
A propositional function that evaluates to true if the agent is touching any part of an obstacle, including its
side boundaries.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AATTNAME
Constant for the name of the angle of orientation attribute.
|
static java.lang.String |
ACTIONIDLE
Constant for the name of the idle action which causes the agent to do nothing by drift for a time step
|
static java.lang.String |
ACTIONTHRUST
Constant for the base name of thrust actions.
|
static java.lang.String |
ACTIONTURNL
Constant for the name of the turn/rotate left/counterclockwise action
|
static java.lang.String |
ACTIONTURNR
Constant for the name of the turn/rotate right/clockwise action
|
static java.lang.String |
AGENTCLASS
Constant for the name of the agent OO-MDP class
|
static java.lang.String |
BATTNAME
Constant for the name of the bottom boundary attribute for rectangular obstacles and landing pads
|
static java.lang.String |
LATTNAME
Constant for the name of the left boundary attribute for rectangular obstacles and landing pads
|
static java.lang.String |
OBSTACLECLASS
Constant for the name of the obstacle OO-MDP class
|
static java.lang.String |
PADCLASS
Constant for the name of the goal landing pad OO-MDP class
|
static java.lang.String |
PFONGROUND
Constant for the name of the propositional function that indicates whether the agent/lander is on the ground
|
static java.lang.String |
PFONPAD
Constant for the name of the propositional function that indicates whether the agent/lander is on a landing pad
|
static java.lang.String |
PFTOUCHSURFACE
Constant for the name of the propositional function that indicates whether the agent/lander is touching
an obstacle surface.
|
static java.lang.String |
PFTPAD
Constant for the name of the propositional function that indicates whether the agent/lander is *touching* a landing pad.
|
protected LunarLanderDomain.LLPhysicsParams |
physParams
An object for holding the physics parameters of this domain.
|
static java.lang.String |
RATTNAME
Constant for the name of the right boundary attribute for rectangular obstacles and landing pads
|
static java.lang.String |
TATTNAME
Constant for the name of the top boundary attribute for rectangular obstacles and landing pads
|
protected java.util.List<java.lang.Double> |
thrustValues
List of the thrust forces for each thrust action
|
static java.lang.String |
VXATTNAME
Constant for the name of the x velocity attribute.
|
static java.lang.String |
VYATTNAME
Constant for the name of the y velocity attribute.
|
static java.lang.String |
XATTNAME
Constant for the name of the x position attribute.
|
static java.lang.String |
YATTNAME
Constant for the name of the y position attribute.
|
Constructor and Description |
---|
LunarLanderDomain()
Initializes with no thrust actions set.
|
Modifier and Type | Method and Description |
---|---|
void |
addStandardThrustActions()
Adds two standard thrust actions.
thrust1 force = 0.32 thrust2 force = 0.2 (opposite gravity) |
void |
addThrustActionWithThrust(double t)
Adds a thrust action with thrust force t
|
Domain |
generateDomain()
Returns a newly instanced Domain object
|
double |
getAnginc()
Returns how many radians the agent will rotate from its current orientation when a turn/rotate action is applied
|
double |
getAngmax()
Returns the maximum rotate angle (in radians) that the lander can be rotated from the vertical orientation in either
clockwise or counterclockwise direction.
|
static State |
getCleanState(Domain domain,
int no)
Creates a state with one agent/lander, one landing pad, and no number of obstacles.
|
LunarLanderDomain.LLPhysicsParams |
getPhysParams() |
double |
getVmax()
Returns the maximum velocity of the agent (the agent cannot move faster than this value).
|
double |
getXmax()
Returns the maximum x position of the lander (the agent cannot cross this boundary)
|
double |
getXmin()
Returns the minimum x position of the lander (the agent cannot cross this boundary)
|
double |
getYmax()
Returns the maximum y position of the lander (the agent cannot cross this boundary)
|
double |
getYmin()
Returns the minimum y position of the lander (the agent cannot cross this boundary)
|
protected static void |
incAngle(State s,
double dir,
LunarLanderDomain.LLPhysicsParams physParams)
Turns the lander in the direction indicated by the domains defined change in angle for turn actions.
|
static void |
main(java.lang.String[] args)
This method will launch a visual explorer for the lunar lander domain.
|
static void |
setAgent(State s,
double a,
double x,
double y)
Sets the agent/lander position/orientation and zeros out the lander velocity.
|
static void |
setAgent(State s,
double a,
double x,
double y,
double vx,
double vy)
Sets the agent/lander position/orientation and the velocity.
|
void |
setAnginc(double anginc)
Sets how many radians the agent will rotate from its current orientation when a turn/rotate action is applied
|
void |
setAngmax(double angmax)
Sets the maximum rotate angle (in radians) that the lander can be rotated from the vertical orientation in either
clockwise or counterclockwise direction.
|
void |
setGravity(double g)
Sets the gravity of the domain
|
static void |
setObstacle(State s,
int i,
double l,
double r,
double b,
double t)
Sets an obstacles boundaries/position
|
static void |
setPad(State s,
double l,
double r,
double b,
double t)
Sets the first landing pad's boundaries/position
|
static void |
setPad(State s,
int i,
double l,
double r,
double b,
double t)
Sets a landing pad's boundaries/position
|
void |
setPhysParams(LunarLanderDomain.LLPhysicsParams physParams) |
void |
setToStandardLunarLander()
Sets the domain to use a standard set of physics and with a standard set of two thrust actions.
gravity = -0.2 xmin = 0 xmax = 100 ymin = 0 ymax = 50 max velocity component speed = 4 maximum angle of rotation = pi/4 change in angle from turning = pi/20 thrust1 force = 0.32 thrust2 force = 0.2 (opposite gravity) |
void |
setVmax(double vmax)
Sets the maximum velocity of the agent (the agent cannot move faster than this value).
|
void |
setXmax(double xmax)
Sets the maximum x position of the lander (the agent cannot cross this boundary)
|
void |
setXmin(double xmin)
Sets the minimum x position of the lander (the agent cannot cross this boundary)
|
void |
setYmax(double ymax)
Sets the maximum y position of the lander (the agent cannot cross this boundary)
|
void |
setYmin(double ymin)
Sets the minimum y position of the lander (the agent cannot cross this boundary)
|
protected static void |
updateMotion(State s,
double thrust,
LunarLanderDomain.LLPhysicsParams physParams)
Updates the position of the agent/lander given the provided thrust force that has been exerted
|
public static final java.lang.String XATTNAME
public static final java.lang.String YATTNAME
public static final java.lang.String VXATTNAME
public static final java.lang.String VYATTNAME
public static final java.lang.String AATTNAME
public static final java.lang.String LATTNAME
public static final java.lang.String RATTNAME
public static final java.lang.String BATTNAME
public static final java.lang.String TATTNAME
public static final java.lang.String AGENTCLASS
public static final java.lang.String OBSTACLECLASS
public static final java.lang.String PADCLASS
public static final java.lang.String ACTIONTURNL
public static final java.lang.String ACTIONTURNR
public static final java.lang.String ACTIONTHRUST
public static final java.lang.String ACTIONIDLE
public static final java.lang.String PFONPAD
public static final java.lang.String PFTPAD
public static final java.lang.String PFTOUCHSURFACE
public static final java.lang.String PFONGROUND
protected java.util.List<java.lang.Double> thrustValues
protected LunarLanderDomain.LLPhysicsParams physParams
public LunarLanderDomain()
public static void setAgent(State s, double a, double x, double y)
s
- the state in which to set the agenta
- the angle of the landerx
- the x positiony
- the y positionpublic static void setAgent(State s, double a, double x, double y, double vx, double vy)
s
- the state in which to set the agenta
- the angle of the landerx
- the x position of the landery
- the y position of the landervx
- the x velocity component of the landervy
- the y velocity component of the landerpublic static void setObstacle(State s, int i, double l, double r, double b, double t)
s
- the state in which the obstacle should be seti
- specifies the ith landing pad object to be set to these valuesl
- the left boundaryr
- the right boundaryb
- the bottom boundaryt
- the top boundarypublic static void setPad(State s, double l, double r, double b, double t)
s
- the state in which the obstacle should be setl
- the left boundaryr
- the right boundaryb
- the bottom boundaryt
- the top boundarypublic static void setPad(State s, int i, double l, double r, double b, double t)
s
- the state in which the obstacle should be seti
- specifies the ith landing pad object to be set to these valuesl
- the left boundaryr
- the right boundaryb
- the bottom boundaryt
- the top boundarypublic void addThrustActionWithThrust(double t)
t
- the thrust of the thrust force to addpublic LunarLanderDomain.LLPhysicsParams getPhysParams()
public void setPhysParams(LunarLanderDomain.LLPhysicsParams physParams)
public void setGravity(double g)
g
- the force of gravitypublic double getXmin()
public void setXmin(double xmin)
xmin
- the minimum x position of the lander (the agent cannot cross this boundary)public double getXmax()
public void setXmax(double xmax)
xmax
- the maximum x position of the lander (the agent cannot cross this boundary)public double getYmin()
public void setYmin(double ymin)
ymin
- the minimum y position of the lander (the agent cannot cross this boundary)public double getYmax()
public void setYmax(double ymax)
ymax
- the maximum y position of the lander (the agent cannot cross this boundary)public double getVmax()
public void setVmax(double vmax)
vmax
- the maximum velocity of the agent (the agent cannot move faster than this value).public double getAngmax()
public void setAngmax(double angmax)
angmax
- the maximum rotate angle (in radians) that the lander can be rotatedpublic double getAnginc()
public void setAnginc(double anginc)
anginc
- how many radians the agent will rotate from its current orientation when a turn/rotate action is appliedpublic void setToStandardLunarLander()
public void addStandardThrustActions()
public Domain generateDomain()
DomainGenerator
generateDomain
in interface DomainGenerator
public static State getCleanState(Domain domain, int no)
setAgent(burlap.oomdp.core.State, double, double, double)
.domain
- the domain of the state to generateno
- the number of obstacle objects to createprotected static void incAngle(State s, double dir, LunarLanderDomain.LLPhysicsParams physParams)
s
- the state in which the lander's angle should be changeddir
- the direction to turn; +1 is clockwise, -1 is counterclockwiseprotected static void updateMotion(State s, double thrust, LunarLanderDomain.LLPhysicsParams physParams)
s
- the state in which the agent/lander should be modifiedthrust
- the amount of thrust force exerted by the lander.public static void main(java.lang.String[] args)
args
- optionally pass "t" asn argument to use a terminal explorer instead of a visual explorer.