|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.lejon.events.MotionCommand
Wrapper class for defining actions that can be executed by the drive object. Possible actions are TRANSLATE, ROTATE in place and driving CURVEs (segments of circles with constant radius).
Possible actions to be executed by a drive. The relevant parameters for a a specific action is shown in the following table.figure | parameters |
---|---|
TRANSLATE | distance [cm] |
ROTATE | angle [deg] |
CURVE | radius [cm], angle [deg] |
Field Summary | |
static int |
CURVE
Constant for action CURVE |
static int |
NO_ACTION
Constant for no action |
static int |
ROTATE
Constant for action ROTATE |
static int |
TRANSLATE
Constant for action TRANSLATE |
Constructor Summary | |
MotionCommand()
Creates a new empty instance. |
|
MotionCommand(int action,
int maxpower,
int distance,
int angle,
int radius)
Creates and initializes a new instance. |
Method Summary | |
int |
getAction()
Returns the type of the action. |
int |
getAngle()
Returns the relative direction angle to rotate to. |
int |
getDistance()
Returns the distance to travel ahead. |
int |
getMaxPower()
Returns the maximum motor power to use. |
int |
getRadius()
Returns the curve radius. |
void |
setAction(int action)
Sets the action type. |
void |
setAngle(int angle)
Sets the relative direction angle to rotate to; for CURVE and ROATATE |
void |
setDistance(int distance)
Sets the distance to travel ahead. |
void |
setMaxPower(int maxpower)
Sets the maximum motor power to use. |
void |
setRadius(int radius)
Sets the curve radius. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int NO_ACTION
public static final int TRANSLATE
public static final int ROTATE
public static final int CURVE
Constructor Detail |
public MotionCommand()
public MotionCommand(int action, int maxpower, int distance, int angle, int radius)
action
- type of action, one of {TRANSLATE, ROTATE, CURVE}maxpower
- max motor power to use, one of {0,1,...,7}distance
- distance [cm] to travel ahead; only for TRANSLATEangle
- relative direction angle [deg] to rotate to; for
ROTATE and CURVE; angle < 0 means clockwise rotationradius
- curve radius [cm]; only for CURVE; must be greater than or equal to the
axle length of the driveMethod Detail |
public int getAction()
public int getMaxPower()
public int getDistance()
public int getAngle()
public int getRadius()
public void setAction(int action)
action
- the action codepublic void setMaxPower(int maxpower)
maxpower
- the max power level of the motors, one of {0,1,...7}public void setDistance(int distance)
distance
- the distance [cm]public void setAngle(int angle)
angle
- the angle [deg]public void setRadius(int radius)
radius
- the radius [cm]
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |