|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.robotics.mapping.NavigationModel lejos.robotics.mapping.NXTNavigationModel
public class NXTNavigationModel
NXT version of the navigation model. All local navigation objects, including pilots, navigators, path finders, feature detectors, and range scanners can be added to the model. Where possible, the model registers itself as an event listener and when the event occurs, updates the model and sends the event and the updates to the PC. A receiver thread receives events from the PC, updates the local model, and uses the navigation objects to implement the event if it involves robot behaviour. There are set methods to set various navigation parameters.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class lejos.robotics.mapping.NavigationModel |
---|
NavigationModel.NavEvent |
Field Summary | |
---|---|
protected boolean |
autoSendPose
|
protected float |
clearance
|
protected ArrayList<FeatureDetector> |
detectors
|
protected PathFinder |
finder
|
protected NavEventListener |
listener
|
protected float |
maxDistance
|
protected Navigator |
navigator
|
protected MoveController |
pilot
|
protected PoseProvider |
pp
|
protected RangeScanner |
scanner
|
protected boolean |
sendMoveStart
|
protected boolean |
sendMoveStop
|
Fields inherited from class lejos.robotics.mapping.NavigationModel |
---|
currentPose, debug, dis, dos, feature, lastMove, lastPlannedMove, map, mcl, numReadings, nxtName, particles, path, readings, target |
Constructor Summary | |
---|---|
NXTNavigationModel()
Create the model and start the receiver thread |
Method Summary | |
---|---|
void |
addFeatureDetector(FeatureDetector detector)
Add a feature detector to the model |
void |
addListener(NavEventListener listener)
|
void |
addNavigator(Navigator navigator)
Add a navigator to the model |
void |
addPilot(MoveController pilot)
Add a pilot to the model |
void |
addPoseProvider(PoseProvider pp)
Add a pose provider (which might be MCL) to the model |
void |
addRangeScanner(RangeScanner scanner)
Add a range scanner to the model |
void |
addWaypoint(Waypoint wp)
Send a waypoint generated on the NXT to the PC |
void |
atWaypoint(Waypoint waypoint,
Pose pose,
int sequence)
Called when a waypoint has been reached |
void |
error(String message)
Display an error message to the user |
void |
fatal(String message)
Display a fatal error and shut down the program |
void |
featureDetected(Feature feature,
FeatureDetector detector)
Called when a feature is detected. |
void |
log(String message)
Log a message |
void |
moveStarted(Move event,
MoveProvider mp)
Called when the pilot starts a move |
void |
moveStopped(Move event,
MoveProvider mp)
Called when a move stops |
void |
pathComplete(Waypoint waypoint,
Pose pose,
int sequence)
Called when a path has been completed |
void |
pathGenerated()
Called when a path finder has finished generating a path |
void |
pathInterrupted(Waypoint waypoint,
Pose pose,
int sequence)
Called when a path has been interrupted |
void |
setAutoSendPose(boolean on)
Set or unset automatic sending of the robot pose to the PC when a move stops |
void |
setRandomMoveParameters(float maxDistance,
float clearance)
Set parameters for a random move |
void |
setSendMoveStart(boolean on)
Sets whether events are sent to the PC when a move stops |
void |
setSendMoveStop(boolean on)
Sets whether events are sent to the PC when a move starts |
void |
shutDown()
Shut down the receiver thread |
Methods inherited from class lejos.robotics.mapping.NavigationModel |
---|
getMap, getParticles, getPath, getReadings, getRobotPose, getTarget, hasMap, setDebug, setNumReadings, setParticleSet, setRobotPose, setTarget |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Navigator navigator
protected MoveController pilot
protected PoseProvider pp
protected ArrayList<FeatureDetector> detectors
protected PathFinder finder
protected RangeScanner scanner
protected NavEventListener listener
protected float clearance
protected float maxDistance
protected boolean autoSendPose
protected boolean sendMoveStart
protected boolean sendMoveStop
Constructor Detail |
---|
public NXTNavigationModel()
Method Detail |
---|
public void log(String message)
message
- the messagepublic void error(String message)
message
- the error messagepublic void fatal(String message)
message
- the error messagepublic void addNavigator(Navigator navigator)
navigator
- the path controllerpublic void addPilot(MoveController pilot)
pilot
- the move controllerpublic void addPoseProvider(PoseProvider pp)
pp
- the pose providerpublic void addRangeScanner(RangeScanner scanner)
scanner
- the range scannerpublic void addFeatureDetector(FeatureDetector detector)
detector
- the feature detectorpublic void setRandomMoveParameters(float maxDistance, float clearance)
maxDistance
- the maximum distance of the moveprojection
- the projection of the robot forward from its mid pointborder
- the border around the wall that the robot should not move intopublic void setAutoSendPose(boolean on)
on
- true if the pose is to be sent, else falsepublic void setSendMoveStart(boolean on)
on
- true iff an event should be sentpublic void setSendMoveStop(boolean on)
on
- true iff an event should be sentpublic void shutDown()
public void addListener(NavEventListener listener)
public void moveStarted(Move event, MoveProvider mp)
moveStarted
in interface MoveListener
event
- the movementmp
- the movement providerpublic void moveStopped(Move event, MoveProvider mp)
moveStopped
in interface MoveListener
event
- the movementmp
- movement providerpublic void featureDetected(Feature feature, FeatureDetector detector)
featureDetected
in interface FeatureListener
feature
- The RangeReading, which contains angle and range.public void addWaypoint(Waypoint wp)
addWaypoint
in interface WaypointListener
wp
- the new waypointpublic void atWaypoint(Waypoint waypoint, Pose pose, int sequence)
atWaypoint
in interface NavigationListener
waypoint
- where the robotpose
- of the robotsequence
- of the Waypoint in the pathpublic void pathComplete(Waypoint waypoint, Pose pose, int sequence)
pathComplete
in interface NavigationListener
waypoint
- where the robotpose
- of the robotsequence
- of the Waypoint in the pathpublic void pathInterrupted(Waypoint waypoint, Pose pose, int sequence)
pathInterrupted
in interface NavigationListener
waypoint
- toward which the robot was movingpose
- current pose of the robotsequence
- number of the next Waypointpublic void pathGenerated()
pathGenerated
in interface WaypointListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |