public class WorldModel extends Object
| Constructor and Description |
|---|
WorldModel(Tactical tactical)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(MovingObject newObject)
Adds a new moving object to the world model if it is not already present
|
void |
add(StationaryObject newObject)
Adds a new stationary object to the world model if it is not already present
|
void |
add(VehicleObject newVehicle)
Adds a new vehicle to the world model if it is not already present
|
void |
addAvoidArea(GeoArea newArea)
Adds a new vehicle to the world model if it is not already present
|
void |
enablePotentialField(boolean enable)
Turns potential field obstacle avoidance on or off
|
void |
getAllClearPaths(double[] pt,
ArrayList<double[]> result)
Generates a list of points on the objects and avoid areas that are "visible"
from a specified point.
|
void |
getAllClearPaths(double x,
double y,
ArrayList<double[]> result)
Generates a list of points on the objects and avoid areas that are "visible"
from a specified point.
|
void |
getAllClearPaths(Point pt,
ArrayList<double[]> result)
Generates a list of points on the objects and avoid areas that are "visible"
from a specified point.
|
double |
getDistanceToMovingObject(double x,
double y)
Determines the distance to the nearest moving object (Double.MAX_VALUE means none)
|
double |
getMissionTime() |
boolean |
getPotentialFieldEnabled() |
double[] |
getPotentialVector(double[] goal)
Computes a unit potential vector that will steer the vehicle away from
known obstacles.
|
double[] |
getPotentialVector(double goalX,
double goalY)
Computes a unit potential vector that will steer the vehicle away from
known obstacles.
|
VehicleObject |
getVehicle(int VID)
Returns a reference to a specified vehicle in the world model
|
boolean |
isClearPath(double[] end1,
double[] end2)
Tests a straight path (line segment) to determine whether or not it encroaches
across an avoid area or obstacle (i.e., passes closer than the standoff)
|
boolean |
isClearPath(double x1,
double y1,
double x2,
double y2)
Tests a straight path (line segment) to determine whether or not it encroaches
across an avoid area or obstacle (i.e., passes closer than the standoff)
|
boolean |
isClearPath(LineSegment segment)
Tests a straight path (line segment) to determine whether or not it encroaches
across an avoid area or obstacle (i.e., passes closer than the standoff)
|
boolean |
isClearPath(Path path)
Determines whether a path intersects any avoid areas or obstacles
|
boolean |
isClearPath(Point end1,
Point end2)
Tests a straight path (line segment) to determine whether or not it encroaches
across an avoid area or obstacle (i.e., passes closer than the standoff)
|
boolean |
isClearPoint(double[] point)
Determines whether a point is clear of avoid areas and obstacles
|
boolean |
isClearPoint(double x,
double y)
Determines whether a point is clear of avoid areas and obstacles
|
boolean |
isClearPoint(Point point)
Determines whether a point is clear of avoid areas and obstacles
|
boolean |
isNewPlanRequired() |
int |
knownVehicle(int VID)
Determines whether or not a vehicle with a specified ID is known
|
void |
makeParticipating(VehicleObject newParticipant)
Makes a vehicle a group participant if it is not already
|
Path |
planPath(double[] start,
double[] end)
Plans a path (series of waypoints) between two points.
|
Path |
planPath(double startX,
double startY,
double endX,
double endY)
Plans a path (series of waypoints) between two points.
|
Path |
planPath(Point start,
Point end)
Plans a path (series of waypoints) between two points.
|
MovingObject |
removeMovingObject(int index)
Removes a moving object from the world model
|
boolean |
removeMovingObject(MovingObject toRemove)
Removes a moving object from the world model
|
StationaryObject |
removeStationaryObject(int index)
Removes a stationary object from the world model
|
boolean |
removeStationaryObject(StationaryObject toRemove)
Removes a stationary object from the world model
|
VehicleObject |
removeVehicle(int VID)
Removes a vehicle from the world model
|
boolean |
removeVehicle(VehicleObject toRemove)
Removes a vehicle from the world model
|
void |
setAvoidAreas(GeoAreaSet agendaAvoidAreas)
Sets the value of the avoid areas object once the Strategic Level has parsed the mission
|
String |
toMATLABString()
Generates a string representation of the Path object that can be used to plot the path in MATLAB
|
public WorldModel(Tactical tactical)
tactical - reference to the Tactical level maintaining the modelpublic void setAvoidAreas(GeoAreaSet agendaAvoidAreas)
agendaAvoidAreas - public void add(StationaryObject newObject)
newObject - public void add(MovingObject newObject)
newObject - public void add(VehicleObject newVehicle)
newVehicle - public void makeParticipating(VehicleObject newParticipant)
newParticipant - public int knownVehicle(int VID)
VID - unique identifier of the vehicle being looked forpublic StationaryObject removeStationaryObject(int index)
index - index of the object to be removedpublic boolean removeStationaryObject(StationaryObject toRemove)
toRemove - the object to be removedpublic MovingObject removeMovingObject(int index)
index - index of the object to be removedpublic boolean removeMovingObject(MovingObject toRemove)
toRemove - the object to be removedpublic void addAvoidArea(GeoArea newArea)
newArea - public VehicleObject getVehicle(int VID)
VID - unique identifier of the vehicle to be removedpublic VehicleObject removeVehicle(int VID)
VID - unique identifier of the vehicle to be removedpublic boolean removeVehicle(VehicleObject toRemove)
toRemove - the object to be removedpublic double getMissionTime()
public void enablePotentialField(boolean enable)
enable - public boolean getPotentialFieldEnabled()
public boolean isNewPlanRequired()
public double[] getPotentialVector(double[] goal)
goal - Cartesian coordinates of the goal pointpublic double[] getPotentialVector(double goalX,
double goalY)
goalX - north/south Cartesian coordinate of the goal pointgoalY - east/west Cartesian coordinate of the goal pointpublic double getDistanceToMovingObject(double x,
double y)
x - north/south Cartesian coordinate of the location being testedy - east/west Cartesian coordinate of the location being testedpublic void getAllClearPaths(Point pt, ArrayList<double[]> result)
pt - the point being testedresult - the ArrayList containing the points to which clear paths exist (will be cleared at start)public void getAllClearPaths(double[] pt,
ArrayList<double[]> result)
pt - the point being testedresult - the ArrayList containing the points to which clear paths exist (will be cleared at start)public void getAllClearPaths(double x,
double y,
ArrayList<double[]> result)
x - coordinate of the point being testedy - coordinate of the point being testedresult - the ArrayList containing the points to which clear paths exist (will be cleared at start)public boolean isClearPoint(double[] point)
point - public boolean isClearPoint(Point point)
point - public boolean isClearPoint(double x,
double y)
x - x coordinate of the point being testedy - y coordinate of the point being testedpublic boolean isClearPath(Path path)
public boolean isClearPath(LineSegment segment)
segment - the line segment being testedpublic boolean isClearPath(Point end1, Point end2)
end1 - first end point of the line segment being testedend2 - second end point of the line segment being testedpublic boolean isClearPath(double[] end1,
double[] end2)
end1 - first end point of the line segment being testedend2 - second end point of the line segment being testedpublic boolean isClearPath(double x1,
double y1,
double x2,
double y2)
x1 - north/south coordinate of the first end point of the line segment being testedy1 - east/west coordinate of the first end point of the line segment being testedx2 - north/south coordinate of the second end point of the line segment being testedy2 - east/west coordinate of the second end point of the line segment being testedpublic Path planPath(Point start, Point end)
start - end - public Path planPath(double[] start, double[] end)
start - end - public Path planPath(double startX, double startY, double endX, double endY)
startX - endX - public String toMATLABString()