public class Move
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Move.MoveType
The type of movement made in sufficient detail to allow errors
in the movement to be modeled.
|
Modifier and Type | Field and Description |
---|---|
private float |
angleTurned |
private float |
arcRadius |
private float |
distanceTraveled |
private boolean |
isMoving |
private Move.MoveType |
moveType |
private float |
rotateSpeed |
private long |
timeStamp |
private float |
travelSpeed |
Constructor and Description |
---|
Move(boolean isMoving,
float angle,
float turnRadius)
Alternate constructor that uses angle and turn radius instead.
|
Move(float distance,
float angle,
boolean isMoving)
Create a movement object to record a movement made by a pilot.
|
Move(Move.MoveType type,
float distance,
float angle,
boolean isMoving)
Create a movement object to record a movement made by a pilot.
|
Move(Move.MoveType type,
float distance,
float angle,
float travelSpeed,
float rotateSpeed,
boolean isMoving)
Create a movement object to record a movement made by a pilot.
|
Modifier and Type | Method and Description |
---|---|
private static Move.MoveType |
calcMoveType(float distance,
float angle)
Helper method to calculate the MoveType based on distance, angle, radius parameters.
|
static float |
convertAngleToDistance(float angle,
float turnRadius)
Static utility method for converting angle (given turn radius) into distance.
|
static float |
convertDistanceToAngle(float distance,
float turnRadius)
Static utility method for converting distance (given turn radius) into angle.
|
void |
dumpObject(java.io.DataOutputStream dos) |
float |
getAngleTurned()
Get the angle turned by a rotate or an arc operation.
|
float |
getArcRadius()
Get the radius of the arc
|
float |
getDistanceTraveled()
Get the distance traveled.
|
Move.MoveType |
getMoveType()
Get the type of the movement performed
|
float |
getRotateSpeed()
Get the rotate speed
|
long |
getTimeStamp()
The time stamp is the system clock at the time the Move object is created.
|
float |
getTravelSpeed()
Get the travel speed
|
boolean |
isMoving()
Test if move was in progress
|
void |
loadObject(java.io.DataInputStream dis) |
void |
setDynamics(float travelSpeed,
float rotateSpeed)
use this method to recycle an existing Move instead of creating a new one
|
void |
setValues(Move.MoveType type,
float distance,
float angle,
boolean isMoving)
use this method to recycle an existing Move instead of creating a new one
|
java.lang.String |
toString() |
private float distanceTraveled
private float angleTurned
private Move.MoveType moveType
private float arcRadius
private boolean isMoving
private long timeStamp
private float travelSpeed
private float rotateSpeed
public Move(float distance, float angle, boolean isMoving)
distance
- the distance traveled in pilot unitsangle
- the angle turned in degreesisMoving
- true iff the movement was created while the robot was movingpublic Move(Move.MoveType type, float distance, float angle, float travelSpeed, float rotateSpeed, boolean isMoving)
type
- the movement typedistance
- the distance traveled in pilot unitsangle
- the angle turned in degreestravelSpeed
- the travel speedrotateSpeed
- the rotate speedisMoving
- true iff the movement was created while the robot was movingpublic Move(Move.MoveType type, float distance, float angle, boolean isMoving)
type
- the movement typedistance
- the distance traveled in pilot unitsangle
- the angle turned in degreesisMoving
- true iff the movement was created while the robot was movingpublic Move(boolean isMoving, float angle, float turnRadius)
isMoving
- angle
- turnRadius
- public void setValues(Move.MoveType type, float distance, float angle, boolean isMoving)
distance
- angle
- isMoving
- public void setDynamics(float travelSpeed, float rotateSpeed)
travelSpeed
- the new travelspeedrotateSpeed
- the new rotate speedprivate static Move.MoveType calcMoveType(float distance, float angle)
distance
- angle
- public float getDistanceTraveled()
public long getTimeStamp()
System.currentTimeMillis()
public float getAngleTurned()
public Move.MoveType getMoveType()
public float getArcRadius()
public float getTravelSpeed()
public float getRotateSpeed()
public boolean isMoving()
public static float convertDistanceToAngle(float distance, float turnRadius)
distance
- turnRadius
- public static float convertAngleToDistance(float angle, float turnRadius)
angle
- turnRadius
- public void dumpObject(java.io.DataOutputStream dos) throws java.io.IOException
java.io.IOException
public void loadObject(java.io.DataInputStream dis) throws java.io.IOException
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object