newPathAndSubgoal(worldMap,
sensorInput,
goalPoint,
dynamicsModel,
path,
timeToReplan,
scale=1)
|
|
This procedure does the primary work of both replanner classes. It
tests to see if the current plan is empty or invalid. If so, it calls
the planner to make a new plan. Then, given a plan, if the robot has
reached the first grid cell in the plan, it removes that grid cell from
the front of the plan. Finally, it gets the the center of the current
first grid-cell in the plan, in odometry coordinates, and generates that
as the subgoal.
It uses a heuristic in the planning, which is the Cartesian distance
between the current location of the robot in odometry coordinates
(determined by finding the center of the grid square) and the goal
location.
Whenever a new plan is made, it is drawn into the map. Whenever a
subgoal is achieved, it is removed from the path drawn in the map.
- Parameters:
-
worldMap - instance of a subclass of gridMap.GridMap
-
sensorInput - instance of io.SensorInput , containing current robot
pose
-
goalPoint - instance of util.Point , specifying goal
-
dynamicsModel - a state machine that specifies the transition dynamics for the
robot in the grid map
-
path - the path (represented as a list of pairs of indices in the map)
that the robot is currently following. Can be None
or [] .
-
timeToReplan - a procedure that takes path , the robot's current
indices in the grid, the map, and the indices of the goal, and
returns True or False indicating
whether a new plan needs to be constructed.
- Returns:
- a tuple
(path, subgoal) , where path is
a list of pairs of indices indicating a path through the grid,
and subgoal is an instance of
util.Point indicating the point in odometry
coordinates that the robot should drive to.
|