#include <ArDocking.h>
Inheritance diagram for ArServerModeDockTriangleBump:
This class takes care of all of the driving, sub classes only need to implement 3 functions. The first is 'isDocked' which'll return true if power is being received. The second is 'enableDocking' which is called when the dock is bumped and should engage docking if needed. The third is 'disableDocking' which'll be called before the robot backs out.
So basically this class'll drive to the dock goal, then it'll find the triangular docking target and drive to that until it bumps and then call 'enableDocking' and then wait 10 seconds while checking 'isDocked' to see if the robot is docked. If it is docked it'll switch to the dock state. Note that if the robot stalls 'isDocked' will be checked on its own, if it is docked then it'll just go to docked too, this is for the simulator and you shouldn't really use this for anything else.
When trying to undock this'll call 'disableDocking' and then wait 5 seconds and then back out from the dock (using the sonar to not run into things).
Public Member Functions | ||||
ArServerModeDockTriangleBump (ArServerBase *serverBase, ArRobot *robot, ArLocalizationTask *locTask, ArPathPlanningTask *pathTask, bool useChargeState=false, double approachDist=1000, double backOutDist=0, ArFunctor *shutdownFunctor=NULL) | ||||
| ||||
virtual void | dock (void) | |||
Sends the robot to the dock (subclass needs to implement). | ||||
virtual void | undock (void) | |||
Has the robot leave the dock (subclass needs to implement). | ||||
virtual void | checkDock (void) | |||
Sees if the robot is already docked and activates itself if it is (subclass should implement). | ||||
virtual bool | isDocked (void)=0 | |||
This should return true if the robot has power from the dock and false otherwise. | ||||
virtual void | enableDock (void)=0 | |||
This should enable docking (turn on charger or what not), it'll be called after the robot bumps into the dock. | ||||
virtual void | disableDock (void)=0 | |||
This should disable docking (turn off charger or what not), it'll be called, this'll wait 5 seconds, and then the robot'll back away from the dock. | ||||
virtual void | beforeDriveInCallback (void) | |||
This should do anything that needs to be done before the robot can drive into the dock. | ||||
virtual void | afterDriveOutCallback (void) | |||
This should do anything that needs to be done after the robot can drives out of the dock. | ||||
virtual void | backoutCallback (void) | |||
This function is called if the robot has backed out but is still docked. | ||||
void | setStallsAsBumps (bool stallsAsBumps) | |||
set whether to treat stalls as bumps or not (mostly for the simulator) | ||||
bool | getStallsAsBumps (void) | |||
get whether to treat stalls as bumps or not (mostly for the simulator) |
ArServerModeDockTriangleBump::ArServerModeDockTriangleBump | ( | ArServerBase * | server, | |
ArRobot * | robot, | |||
ArLocalizationTask * | locTask, | |||
ArPathPlanningTask * | pathTask, | |||
bool | useChargeState = false , |
|||
double | approachDist = 1000 , |
|||
double | backOutDist = 0 , |
|||
ArFunctor * | shutdownFunctor = NULL | |||
) |
server | the server where we put the docking commands |
robot | the robot we're using | |
locTask | the task for localization (so we can say its okay to be in a wall) | |
pathTask | the task for driving around | |
useChargeState | whether to use the charge state to know when docking or not | |
approachDist | distance in front of triangle vertex to use as the approach point (before the final drive in) | |
backOutDist | distance to back out, 0 means use old method which goes out as far as it had to drive in |
virtual void ArServerModeDockTriangleBump::enableDock | ( | void | ) | [pure virtual] |
This should enable docking (turn on charger or what not), it'll be called after the robot bumps into the dock.
After this the code'll wait a while for isDocked to become true.
Implemented in ArServerModeDockPatrolBot, ArServerModeDockSimulator, and ArServerModeDockPowerBot.