GlobalNavigation
Class GlobalNavigation

java.lang.Object
  extended by GlobalNavigation.GlobalNavigation

public class GlobalNavigation
extends java.lang.Object

Driver for the GlobalNavigation lab.


Field Summary
static java.lang.String APPNAME
          Name to use when run as an application.
  bumpSub
           
protected  CSpace cspace
          The configuration space.
protected  java.awt.geom.Point2D.Double currentWaypoint
          The current waypoint.
protected  int currentWaypointIndex
           
static java.awt.Color FAR_COLOR
          Color of the farthest cell(s).
static double FOLLOW_PATH_MAX_RV
          Max rotational velocity while following path (rad/s).
static double FOLLOW_PATH_RV_GAIN
          Proportional gain for rotation controller while following path.
static double FOLLOW_PATH_TV
          Translational velocity while following path (m/s).
static int GO
          State constant, following path.
static java.awt.Color GOAL_COLOR
          Color of the goal cell.
protected  java.awt.geom.Point2D.Double goalPoint
          Goal point.
protected  Grid grid
           
static double GRID_RESOLUTION
           
protected  PolygonMap map
          The map, read from file in #main.
protected  double maxDist
          Maximum distance from any cell that can reach the goal to the goal (m).
  odoSub
           
static java.awt.Color PATH_COLOR
          Color of the path.
protected  int redrawCounter
           
static int ROBOT_BUMPER_LEFT
          Left bumper (orc port 9) index.
static int ROBOT_BUMPER_RIGHT
          Right bumper (orc port 8) index.
protected static double robotRadius
          (Solution)
static double ROTATE_FIRST_THRESHOLD
          Rotate before translation threshold (radians)
protected  java.awt.geom.Point2D.Double startPoint
          Start point.
protected  int state
          The current robot state.
static int STOP
          State constant, robot stopped.
protected  VisibilityGraph visibilityGraph
          The graph
protected  java.util.List<java.awt.geom.Point2D.Double> waypoints
           
protected  java.awt.geom.Rectangle2D.Double worldRect
          World bounds.
static double WP_THRESHOLD
          Waypoint reached threshold (m).
 
Constructor Summary
GlobalNavigation()
           
 
Method Summary
 void displayCSpace()
          Display cspace to the GUI.
 void displayGrid()
          Display grid to the GUI.
 void displayMap()
          Display map to console and to the GUI.
 void displayPath()
          Display a set of line segments from currentWaypoint to the goal.
 void displayVisibilityGraph()
           
static void fillColor(ColorMsg color2, java.awt.Color color)
           
 void fillPointMsg(GUIPointMsg msg, java.awt.geom.Point2D.Double point, java.awt.Color color, long shape)
           
static void fillPolyMsg(GUIPolyMsg msg, PolygonObstacle obstacle, java.awt.Color c, boolean filled, boolean closed)
           
static void fillRectMsg(GUIRectMsg msg, java.awt.geom.Rectangle2D.Double r, java.awt.Color c, boolean filled)
           
 void fillSegmentMsg(GUISegmentMsg segmentMsg, java.awt.Color color, java.awt.geom.Point2D.Double start, java.awt.geom.Point2D.Double other)
           
 GraphName getDefaultNodeName()
           
 void handle(BumpMsg msg)
          Implements stop on bump.
 void handle(OdometryMsg msg)
          Implements path following.
 void instanceMain(java.lang.String[] arg)
          Displays map, computes cspace and grid, displays grid and path, and initiates path following.
protected static java.awt.Color interpolateColor(double maxDist, double dist)
          Generate an interpolated color between FAR_COLOR and GOAL_COLOR.
 void onShutdown(Node arg0)
           
 void onShutdownComplete(Node node)
           
 void onStart(Node node)
          Driver, calls instanceMain(java.lang.String[]).
 void setMotionMsg(MotionMsg msg, double d, double rv)
           
 void testConvexHull()
          Exercise the convex hull and polygon display code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APPNAME

public static final java.lang.String APPNAME

Name to use when run as an application.

See Also:
Constant Field Values

STOP

public static final int STOP

State constant, robot stopped.

See Also:
Constant Field Values

GO

public static final int GO

State constant, following path.

See Also:
Constant Field Values

ROBOT_BUMPER_RIGHT

public static int ROBOT_BUMPER_RIGHT

Right bumper (orc port 8) index.


ROBOT_BUMPER_LEFT

public static int ROBOT_BUMPER_LEFT

Left bumper (orc port 9) index.


FOLLOW_PATH_TV

public static final double FOLLOW_PATH_TV

Translational velocity while following path (m/s).

See Also:
Constant Field Values

FOLLOW_PATH_RV_GAIN

public static final double FOLLOW_PATH_RV_GAIN

Proportional gain for rotation controller while following path.

See Also:
Constant Field Values

FOLLOW_PATH_MAX_RV

public static final double FOLLOW_PATH_MAX_RV

Max rotational velocity while following path (rad/s).

See Also:
Constant Field Values

ROTATE_FIRST_THRESHOLD

public static final double ROTATE_FIRST_THRESHOLD

Rotate before translation threshold (radians)

See Also:
Constant Field Values

WP_THRESHOLD

public static final double WP_THRESHOLD

Waypoint reached threshold (m).

See Also:
Constant Field Values

map

protected PolygonMap map

The map, read from file in #main.


worldRect

protected java.awt.geom.Rectangle2D.Double worldRect

World bounds.


startPoint

protected java.awt.geom.Point2D.Double startPoint

Start point.


goalPoint

protected java.awt.geom.Point2D.Double goalPoint

Goal point.


visibilityGraph

protected VisibilityGraph visibilityGraph

The graph


cspace

protected CSpace cspace

The configuration space.


grid

protected Grid grid

GRID_RESOLUTION

public static final double GRID_RESOLUTION
See Also:
Constant Field Values

FAR_COLOR

public static final java.awt.Color FAR_COLOR

Color of the farthest cell(s).


GOAL_COLOR

public static final java.awt.Color GOAL_COLOR

Color of the goal cell.


PATH_COLOR

public static final java.awt.Color PATH_COLOR

Color of the path.


currentWaypoint

protected java.awt.geom.Point2D.Double currentWaypoint

The current waypoint.


currentWaypointIndex

protected int currentWaypointIndex

waypoints

protected java.util.List<java.awt.geom.Point2D.Double> waypoints

maxDist

protected double maxDist

Maximum distance from any cell that can reach the goal to the goal (m).

.


state

protected int state

The current robot state.


redrawCounter

protected int redrawCounter

robotRadius

protected static double robotRadius
(Solution)


bumpSub

public  bumpSub

odoSub

public  odoSub
Constructor Detail

GlobalNavigation

public GlobalNavigation()
Method Detail

displayMap

public void displayMap()

Display map to console and to the GUI.


fillPointMsg

public void fillPointMsg(GUIPointMsg msg,
                         java.awt.geom.Point2D.Double point,
                         java.awt.Color color,
                         long shape)

fillPolyMsg

public static void fillPolyMsg(GUIPolyMsg msg,
                               PolygonObstacle obstacle,
                               java.awt.Color c,
                               boolean filled,
                               boolean closed)

fillRectMsg

public static void fillRectMsg(GUIRectMsg msg,
                               java.awt.geom.Rectangle2D.Double r,
                               java.awt.Color c,
                               boolean filled)

displayGrid

public void displayGrid()

Display grid to the GUI.

Obstacle cells are not displayed; all others are colored according to their distance from the goal (see FAR_COLOR and GOAL_COLOR).


displayCSpace

public void displayCSpace()

Display cspace to the GUI.


displayVisibilityGraph

public void displayVisibilityGraph()

fillSegmentMsg

public void fillSegmentMsg(GUISegmentMsg segmentMsg,
                           java.awt.Color color,
                           java.awt.geom.Point2D.Double start,
                           java.awt.geom.Point2D.Double other)

fillColor

public static void fillColor(ColorMsg color2,
                             java.awt.Color color)

interpolateColor

protected static java.awt.Color interpolateColor(double maxDist,
                                                 double dist)

Generate an interpolated color between FAR_COLOR and GOAL_COLOR.

Parameters:
maxDist - the distance of the farthest cell(s) from the goal (m)
dist - the distance of the specified cell from the goal (m)

displayPath

public void displayPath()

Display a set of line segments from currentWaypoint to the goal.


testConvexHull

public void testConvexHull()

Exercise the convex hull and polygon display code.


handle

public void handle(OdometryMsg msg)

Implements path following.


setMotionMsg

public void setMotionMsg(MotionMsg msg,
                         double d,
                         double rv)

handle

public void handle(BumpMsg msg)

Implements stop on bump.


onStart

public void onStart(Node node)

Driver, calls instanceMain(java.lang.String[]).


instanceMain

public void instanceMain(java.lang.String[] arg)

Displays map, computes cspace and grid, displays grid and path, and initiates path following.


onShutdown

public void onShutdown(Node arg0)

onShutdownComplete

public void onShutdownComplete(Node node)

getDefaultNodeName

public GraphName getDefaultNodeName()