|
|||||||||
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.PCNavigationModel
public class PCNavigationModel
The PCNavigationModel holds all the navigation data that is transmitted as events, to and from a NXT brick. It has methods to generate events, and a Receiver thread to receive events from the NXT. There is a NavigationPanel associated with the model. Whenever data in the model is updated, the NavigationPanel is repainted with the new data.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class lejos.robotics.mapping.NavigationModel |
---|
NavigationModel.NavEvent |
Field Summary | |
---|---|
protected AstarSearchAlgorithm |
alg
|
protected int |
clearance
|
protected int |
closest
|
protected boolean |
connected
|
protected Node |
destination
|
protected java.util.ArrayList<Point> |
features
|
protected int |
gridSpace
|
protected FourWayGridMesh |
mesh
|
protected java.util.ArrayList<Move> |
moves
|
protected java.util.Collection<Node> |
nodes
|
protected NXTCommand |
nxtCommand
|
protected MapApplicationUI |
panel
|
protected RangeReadings |
particleReadings
|
protected PathFinder |
pf
|
protected java.util.ArrayList<Pose> |
poses
|
protected Waypoint |
reached
|
protected Node |
start
|
protected float |
voltage
|
protected java.util.ArrayList<Waypoint> |
waypoints
|
protected float |
weight
|
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 | |
---|---|
PCNavigationModel(MapApplicationUI panel)
Create the model and associate the navigation panel with it |
Method Summary | |
---|---|
void |
addWaypoint(Waypoint wp)
Add a waypoint and send it to the NXT |
void |
arc(float radius,
float angle)
Send an ARC event to the NXT |
void |
calculatePath()
Calculate the path with the Node path finder |
protected boolean |
checkFile(java.io.File f)
Check that the file exists on the NXT with the right size |
void |
clear()
Clear all variable data |
void |
clearPath()
Send a CLEAR_PATH event to the NXT |
void |
connect(java.lang.String nxtName)
Connect to the NXT |
void |
connectAndUpload(java.lang.String nxtName,
java.io.File file)
Connect to the NXT, upload a program, and run it |
void |
findClosest(float x,
float y)
Send a FIND_CLOSEST event to the NXT |
void |
findPath(Waypoint wp)
Send a FIND_PATH event to the NXT |
void |
followPath()
Send a route to the NXT and follow it |
void |
generateParticles()
Generate particles for the MCLPoseProvider and send them to the NXT |
void |
getEstimatedPose()
Send a GET_ESTIMATED_POSE event to the NXT |
java.util.ArrayList<Point> |
getFeatures()
Get the list of features |
Move |
getLastMove()
Get the last move made by the robot |
MCLPoseProvider |
getMCL()
Get the MCLPoseProvider associated with this model |
java.util.ArrayList<Move> |
getMoves()
Get the moves made since the last setPose |
java.util.Collection<Node> |
getNodes()
Get the generated node |
void |
getPose()
Send a GET_POSE event to the NXT |
java.util.ArrayList<Pose> |
getPoses()
Get the sequence of poses of the robot from moves sent from the NXT, since the last call of setPose |
void |
getRemoteBattery()
Get the remote battery voltage |
void |
getRemoteParticles()
Send a GET_PARTICLES event to the NXT |
void |
getRemoteReadings()
Send a GET_READINGS event to the NXT |
protected java.util.ArrayList<Waypoint> |
getWaypoints()
Get the list of waypoints |
void |
goTo(Waypoint wp)
Send a GOTO event to the NXT |
boolean |
isConnected()
Test if a NXT brick is currently connected |
void |
lcpClose()
Close the LCP connection to the NXT |
boolean |
lcpConnect(java.lang.String nxtName)
Make an LCP connection to the NXT |
LineMap |
loadMap(java.lang.String mapFileName)
|
LineMap |
loadMap(java.lang.String mapFileName,
int finder)
Load a line map and send it to the PC |
void |
localize()
Tell the NXT to keep making random moves until the robot is localized |
void |
randomMove()
Send a RANDOM_MOVE event to the NXT |
void |
rotate(float angle)
Send a ROTATE event to the NXT |
void |
rotateTo(float angle)
Send a ROTATE_TO event to the NXT |
void |
sendExit()
Send an EXITevent to the NXT |
void |
sendMap()
Send the map to the NXT |
void |
sendRandomMoveParams(float maxDistance,
float clearance)
Send Random Move parameters to the NXT |
void |
sendSound(int code)
Send a system sound |
void |
setDifferentialPilotParams(float wheelDiameter,
float trackWidth,
int leftMotor,
int rightMotor,
boolean reverse)
Set the parameters for a DifferentialPilot, send them to the NXT, and write them to the pilot.props file. |
void |
setMCL(MCLPoseProvider mcl)
Set an MCLPOseProvider for this model |
void |
setMeshParams(int gridSpace,
int clearance)
Set the parameter for the 4-way mesh |
void |
setPathFinder(int finder)
|
void |
setPose(Pose p)
Send a SET_POSE event to the NXT |
void |
setRangeFeatureParams(float maxDistance,
int delay)
Set the parameter for a Range Feature Detector |
void |
setRotateSpeed(float speed)
Set the rotate speed for a pilot |
void |
setRotatingRangeScannerParams(int gearRatio,
int headMotor)
Set the patameters for a Rotating Range Scanner |
void |
setTarget(Waypoint target)
Set the target for a path finder |
void |
setTravelSpeed(float speed)
Set the travel speed for the pilot. |
void |
shutDown()
Shut down the receiver thread |
void |
startNavigator()
Start the navigator following a path |
void |
stop()
Send a STOP event to the NXT |
void |
takeReadings()
Send a TAKE_READINGS event to the NXT |
void |
travel(float distance)
Send a travel event to the NXT |
Methods inherited from class lejos.robotics.mapping.NavigationModel |
---|
getMap, getParticles, getPath, getReadings, getRobotPose, getTarget, hasMap, setDebug, setNumReadings, setParticleSet, setRobotPose |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected MapApplicationUI panel
protected int closest
protected boolean connected
protected RangeReadings particleReadings
protected float weight
protected FourWayGridMesh mesh
protected int gridSpace
protected int clearance
protected AstarSearchAlgorithm alg
protected java.util.Collection<Node> nodes
protected Node start
protected Node destination
protected PathFinder pf
protected java.util.ArrayList<Move> moves
protected java.util.ArrayList<Pose> poses
protected java.util.ArrayList<Point> features
protected java.util.ArrayList<Waypoint> waypoints
protected Waypoint reached
protected NXTCommand nxtCommand
protected float voltage
Constructor Detail |
---|
public PCNavigationModel(MapApplicationUI panel)
panel
- the NavigationPanelMethod Detail |
---|
public void setMeshParams(int gridSpace, int clearance)
gridSpace
- the spacing of the meshclearance
- the clearance from the wallspublic MCLPoseProvider getMCL()
public void setMCL(MCLPoseProvider mcl)
mcl
- the MCLPoseProviderpublic Move getLastMove()
public java.util.ArrayList<Move> getMoves()
public java.util.ArrayList<Point> getFeatures()
protected java.util.ArrayList<Waypoint> getWaypoints()
public java.util.ArrayList<Pose> getPoses()
public boolean lcpConnect(java.lang.String nxtName)
nxtName
- the name of the NXT
public void lcpClose()
public void connectAndUpload(java.lang.String nxtName, java.io.File file) throws java.io.FileNotFoundException
nxtName
- the name of the NXTfile
- the name of the program file
java.io.FileNotFoundException
protected boolean checkFile(java.io.File f)
public void setDifferentialPilotParams(float wheelDiameter, float trackWidth, int leftMotor, int rightMotor, boolean reverse)
wheelDiameter
- the wheel diametertrackWidth
- the track widthleftMotor
- the left motorrightMotor
- the right motorreverse
- true iff the driving the motors in reverse drives the pilot forwardpublic void setRangeFeatureParams(float maxDistance, int delay)
maxDistance
- the distance from a feature that trifggers detectiondelay
- the delay between readings in microsecondspublic void setRotatingRangeScannerParams(int gearRatio, int headMotor)
gearRatio
- the ratio between motor rotation and head rotationheadMotor
- the motor that drives the read (0 = A, 1 =B, 2 = C)public void setTravelSpeed(float speed)
speed
- the travel speedpublic void setRotateSpeed(float speed)
speed
- the rotate speedpublic void getRemoteParticles()
public void findClosest(float x, float y)
public void addWaypoint(Waypoint wp)
wp
- the waypointpublic void generateParticles()
public void connect(java.lang.String nxtName)
public java.util.Collection<Node> getNodes()
public boolean isConnected()
public LineMap loadMap(java.lang.String mapFileName)
public LineMap loadMap(java.lang.String mapFileName, int finder)
mapFileName
- the SVG map file
public void sendMap()
public void setPathFinder(int finder)
public void goTo(Waypoint wp)
wp
- the Waypoint to go topublic void travel(float distance)
distance
- the distance to travelpublic void rotate(float angle)
angle
- the angle to rotatepublic void arc(float radius, float angle)
radius
- the radius of the arcangle
- the angle to rotatepublic void rotateTo(float angle)
angle
- the angle to rotatepublic void getPose()
public void getEstimatedPose()
public void getRemoteReadings()
public void setPose(Pose p)
p
- the robot posepublic void setTarget(Waypoint target)
setTarget
in class NavigationModel
target
- the target waypointpublic void stop()
public void randomMove()
public void localize()
public void takeReadings()
public void sendRandomMoveParams(float maxDistance, float clearance)
public void followPath()
public void startNavigator()
public void findPath(Waypoint wp)
public void clearPath()
public void sendExit()
public void calculatePath()
public void sendSound(int code)
public void getRemoteBattery()
public void shutDown()
public void clear()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |