

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object lejos.robotics.navigation.ArcAlgorithms
public class ArcAlgorithms
The static methods in this class can be used to to calculate theoretical routes and for displaying graphical representations of the path of a robot. The methods getAvailablePaths() and getBestPath() are useful for this.
Method Summary  

static float 
distBetweenPoints(Point a,
Point b)
Calculates the distance between any two points. 
static Point 
findCircleCenter(Point p1,
float radius,
float heading)
Calculates the center of a circle that rests on the tangent of the vehicle's starting heading. 
static Point 
findP2(Point c,
Point p3,
float radius)
This method finds P2 if the vehicle is traveling to a point (with no heading). 
static Point 
findPointOnHeading(Point original,
float heading,
float distance)
Given a starting point and heading, this method will calculate another Point that is distance away from the first point. 
static float 
getArc(Point p1,
Point p2,
float radius,
float heading,
boolean forward)
If p1 is the starting point of the robot, and p2 is the point at which the robot is pointing directly at the target point, this method calculates the angle to travel along the circle (an arc) to get from p1 to p2. 
static float 
getArcBackward(float forwardArc)
Quick calculation of reverse arc instead of going through getArcLength() math again. 
static double 
getArcOld(Point p1,
Point p2,
double radius)
Deprecated. This method is no longer used because it can't calculate >180 angles. Delete any time. 
static Move[][] 
getAvailablePaths(Pose start,
float turnRadius1,
Pose destination,
float turnRadius2)
This method gets all the available paths given a start Pose and destination Post. 
static Move[][] 
getAvailablePaths(Pose start,
Point destination,
float turnRadius)
This method calculates the moves needed to drive from a starting Pose to a final Point. 
static Move[] 
getBestPath(Move[][] paths)
This helper method accepts a number of paths (an array of Move) and selects the shortest path. 
static Move[] 
getBestPath(Pose start,
float turnRadius1,
Pose destination,
float turnRadius2)
Find the shortest path for a steering vehicle between two points. 
static Move[] 
getBestPath(Pose start,
Point destination,
float radius)
This method generates the shortest path from a starting Pose to a final Point. 
static float 
getHeading(float oldHeading,
float changeInHeading)
Given the former heading and the change in heading, this method will calculate a new heading. 
static float 
getHeading(Point from,
Point to)
Calculates the heading designated by two points. 
static float 
getTriangleAngle(Point p1,
Point p2,
Point pa)
This method calculates the angle generated by three points. 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Method Detail 

public static Move[] getBestPath(Pose start, float turnRadius1, Pose destination, float turnRadius2)
start
 The starting PoseturnRadius1
 The turning radius for the first arc.destination
 The destination PoseturnRadius2
 The turning radius for the final arc
public static Move[][] getAvailablePaths(Pose start, float turnRadius1, Pose destination, float turnRadius2)
start
 The starting PoseturnRadius1
 The turning radius for the first arcdestination
 The destination PoseturnRadius2
 The turning radius for the final arc
public static Move[][] getAvailablePaths(Pose start, Point destination, float turnRadius)
start
 The starting Posedestination
 The destination PointturnRadius
 The turn radius
public static Move[] getBestPath(Pose start, Point destination, float radius)
start
 The starting Posedestination
 The destination Pointradius
 The turn radius
public static Move[] getBestPath(Move[][] paths)
paths
 Any number of paths.
public static Point findPointOnHeading(Point original, float heading, float distance)
original
 The starting pointheading
 The heading of the pointdistance
 The distance away from this point to calculate a new point
public static float getTriangleAngle(Point p1, Point p2, Point pa)
p1
 An outer point, connects only with pa.p2
 An outer point, connects only with pa.pa
 The central point, connects with both p1 and p2.
public static float getHeading(float oldHeading, float changeInHeading)
oldHeading
 The old heading (original heading of robot) in degreeschangeInHeading
 The change in angle, in degrees.
public static float getArc(Point p1, Point p2, float radius, float heading, boolean forward)
p1
 Start positionp2
 Takeoff point on the circleradius
 Radius of circle AKA the turnRadiusheading
 Start heading vehicle is pointed, in degrees.forward
 Will the vehicle be moving forward along the circle arc?
public static float getArcBackward(float forwardArc)
forwardArc

@Deprecated public static double getArcOld(Point p1, Point p2, double radius)
p1
 Start positionp2
 Takeoff point on circleradius
 Radius of circle
public static float distBetweenPoints(Point a, Point b)
a
 The first pointb
 The second point
public static float getHeading(Point from, Point to)
from
 Starting point.to
 Final point.
public static Point findP2(Point c, Point p3, float radius)
c
 The center point of the turning circle.p3
 The final target pointradius
 The turn radius.
public static Point findCircleCenter(Point p1, float radius, float heading)
p1
 the starting point of the vehicle.radius
 Turning radius of vehicle. A negative value produces a circle to the right of the heading.heading
 Start heading of vehicle, in degrees (not radians).


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 