public class EV3NavigationModel extends NavigationModel implements MoveListener, NavigationListener, WaypointListener, FeatureListener
NavigationModel.NavEvent
Modifier and Type | Field and Description |
---|---|
protected boolean |
autoSendPose |
protected float |
clearance |
protected java.util.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 |
currentPose, debug, dis, dos, feature, lastMove, lastPlannedMove, map, mcl, numReadings, nxtName, particles, path, readings, target
Constructor and Description |
---|
EV3NavigationModel()
Create the model and start the receiver thread
|
Modifier and Type | Method and Description |
---|---|
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(java.lang.String message)
Display an error message to the user
|
void |
fatal(java.lang.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(java.lang.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
|
getMap, getParticles, getPath, getReadings, getRobotPose, getTarget, hasMap, setDebug, setNumReadings, setParticleSet, setRobotPose, setTarget
protected Navigator navigator
protected MoveController pilot
protected PoseProvider pp
protected java.util.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
public EV3NavigationModel()
public void log(java.lang.String message)
message
- the messagepublic void error(java.lang.String message)
message
- the error messagepublic void fatal(java.lang.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 moveclearance
- the clearance distance around the robotpublic 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