|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.robotics.navigation.Pose
public class Pose
Represents the location and heading(direction angle) of a robot.
This class includes methods for updating the Pose to in response to basic robot
movements.
It also contains utility methods for use in navigation, such as the
direction and distance to a point from the location of the pose, and also the
location of a point at a given distance and direction from the location of the pose.
All directions and angles are in degrees and use the standard convention
in mathematics: direction 0 is parallel to the X axis, and direction +90 is
parallel to the Y axis.
Field Summary | |
---|---|
protected float |
_heading
|
protected Point |
_location
|
Constructor Summary | |
---|---|
Pose()
allocate a new Pose at the origin, heading = 0:the direction the positive X axis |
|
Pose(float x,
float y,
float heading)
Allocate a new pose at location (x,y) with specified heading in degrees. |
Method Summary | |
---|---|
float |
angleTo(Point destination)
Returns the angle with respect to the X axis to |
void |
arcUpdate(float distance,
float turnAngle)
Sets the pose location and heading to the correct values resulting from travel in a circular arc. |
float |
distanceTo(Point destination)
Return the distance to the destination |
void |
dumpObject(DataOutputStream dos)
|
float |
getHeading()
returns the heading (direction angle) of the Pose |
Point |
getLocation()
Get the location as a Point |
float |
getX()
Get the X coordinate |
float |
getY()
Get the Y coordinate |
void |
loadObject(DataInputStream dis)
|
void |
moveUpdate(float distance)
Move the specified distance in the direction of current heading. |
Point |
pointAt(float distance,
float bearing)
Returns the point at distance from the location of this pose,
in the direction bearing relative to the X axis. |
float |
relativeBearing(Point destination)
Returns the angle to destination relative to the pose heading; |
void |
rotateUpdate(float angle)
Rotate the heading through the specified angle |
void |
setHeading(float heading)
|
void |
setLocation(float x,
float y)
Sets the location of this pose to a new point at x,y; |
void |
setLocation(Point p)
Set the location of the pose |
String |
toString()
return string contains x,y and heading |
void |
translate(float dx,
float dy)
Change the x and y coordinates of the pose by adding dx and dy. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Point _location
protected float _heading
Constructor Detail |
---|
public Pose()
public Pose(float x, float y, float heading)
x
- the X coordinatey
- the Y coordinateheading
- the headingMethod Detail |
---|
public void rotateUpdate(float angle)
angle
- public void moveUpdate(float distance)
distance
- to movepublic void translate(float dx, float dy)
dx
- change in x coordinatedy
- change in y coordinatepublic void arcUpdate(float distance, float turnAngle)
distance
- the distance traveledturnAngle
- the angle turnedpublic float angleTo(Point destination)
destination
-
public float relativeBearing(Point destination)
destination
relative to the pose heading;
destination
- the target point
public float distanceTo(Point destination)
destination
-
public Point pointAt(float distance, float bearing)
distance
from the location of this pose,
in the direction bearing
relative to the X axis.
distance
- the distance to the pointbearing
- the true bearing of the point
public float getHeading()
public float getX()
public float getY()
public Point getLocation()
public void setLocation(Point p)
p
- the new locationpublic void setLocation(float x, float y)
x
- y
- public void setHeading(float heading)
public String toString()
toString
in class Object
public void dumpObject(DataOutputStream dos) throws IOException
dumpObject
in interface Transmittable
IOException
public void loadObject(DataInputStream dis) throws IOException
loadObject
in interface Transmittable
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |