#include <ArActionTriangleDriveTo.h>
Inheritance diagram for ArActionTriangleDriveTo:
Public Types | |
enum | State { STATE_INACTIVE, STATE_ACQUIRE, STATE_SEARCHING, STATE_GOTO_APPROACH, STATE_ALIGN_APPROACH, STATE_GOTO_VERTEX, STATE_GOTO_FINAL, STATE_ALIGN_FINAL, STATE_SUCCEEDED, STATE_FAILED } |
Public Member Functions | |
virtual void | activate (void) |
Activate the action. | |
ArActionTriangleDriveTo (const char *name="triangleDriveTo", double finalDistFromVertex=400, double approachDistFromVertex=1000, double speed=200, double closeDist=100, double acquireTurnSpeed=30) | |
Constructor. | |
virtual void | deactivate (void) |
Deactivate the action. | |
virtual ArActionDesired * | fire (ArActionDesired currentDesired) |
Fires the action, returning what the action wants to do. | |
bool | getAcquire (void) |
Gets if we will turn to see if we can acquire the triangle. | |
bool | getAdjustVertex (void) |
Gets whether we adjust the vertex or not. | |
Data * | getData (void) |
Interal use only, gets the data we've saved. | |
virtual ArActionDesired * | getDesired (void) |
Gets what this action wants to do (for display purposes). | |
double | getFinalDistFromVertex (void) |
Sets the final distance from vertex. | |
bool | getGotoVertex (void) |
Gets whether it always goto the vertex and not the point in front. | |
ArLineFinder * | getLineFinder (void) |
Sets the line finder used. | |
bool | getSaveData (void) |
Internal use only, gets if we're saving data or not. | |
State | getState (void) |
int | getVertexUnseenStopMSecs (void) |
How long to keep going without having seen the vertex (0 is no timeout). | |
void | setAcquire (bool acquire=false) |
Sets if we will turn to see if we can acquire the triangle. | |
void | setAdjustVertex (bool adjustVertex) |
Sets whether we adjust the vertex or not. | |
void | setFinalDistFromVertex (double dist) |
Sets the final distance from vertex. | |
void | setGotoVertex (bool gotoVertex) |
Sets whether it always goto the vertex and not the point in front. | |
void | setLineFinder (ArLineFinder *lineFinder) |
Sets the line finder to use. | |
bool | setLogging (void) |
Gets whether we're logging the driving or not. | |
void | setLogging (bool logging) |
Sets whether we're logging the driving or not. | |
void | setParameters (double finalDistFromVertex=400, double approachDistFromVertex=1000, double speed=200, double closeDist=100, double acquireTurnSpeed=30) |
virtual void | setRobot (ArRobot *robot) |
Sets the robot this action is driving. | |
void | setSaveData (bool saveData) |
Internal use only, sets if we're saving data or not. | |
void | setTriangleParams (double line1Length=254, double angleBetween=135, double line2Length=254) |
Sets the parameter of the triangle we're looking for. | |
void | setVertexUnseenStopMSecs (int vertexUnseenStopMSecs=4000) |
How long to keep going without having seen the vertex (0 is no timeout). | |
virtual | ~ArActionTriangleDriveTo () |
Destructor. | |
Protected Member Functions | |
ArPose | findPoseFromVertex (double distFromVertex) |
void | findTriangle (bool initial, bool goStraight=false) |
Protected Attributes | |
bool | myAcquire |
double | myAcquireTurnSpeed |
bool | myAdjustVertex |
double | myAngleBetween |
double | myApproachDistFromVertex |
double | myCloseDist |
Data * | myData |
ArMutex | myDataMutex |
ArActionDesired | myDesired |
double | myFinalDistFromVertex |
unsigned int | myGotLinesCounter |
bool | myGotoVertex |
ArRangeDevice * | myLaser |
double | myLine1Length |
double | myLine2Length |
ArLineFinder * | myLineFinder |
std::map< int, ArLineFinderSegment * > * | myLines |
bool | myOwnLineFinder |
bool | myPrinting |
bool | mySaveData |
double | mySpeed |
State | myState |
bool | myTwoStageApproach |
ArPose | myVertex |
bool | myVertexSeen |
ArTime | myVertexSeenLast |
int | myVertexUnseenStopMSecs |
Classes | |
class | Data |
For setting up this action, by default what it will do is find an ArRangeDevice with the name of "laser" attached to the robot and make an ArLineFinder from that. You can also make an ArLineFinder and pass that to the class (you should do it before you do the addAction, but you don't have to).
This action will drive up to a triangle (the triangle description is set with setTriangleParams), it will first pick a triangle and then try to drive to that triangle. If setTwoStageApproach is true (default) it will first drive to a half meter away from the desired spot (distFromVertex from the point of the vertex along the bisection of the angle between segments) and then after it reachs that point it will turn in towards the vertex and drive to the final spot. If setTwoStageApproach is false it'll just drive to the final spot. It will stop at closeDist away unless a large turn is required where it'll stop 2 * closeDist away. It drives in at the speed in the constructor. If the robot is closer to the vertex than it should be for the approach it'll skip the approach, if the robot is closer to the vertex than to the final spot it will back up (if its facing away from the vertex it won't see the vertex).
If you want the action to drive straight to the vertex instead of to a point in front of it call setGotoVertex with a true argument... It will no longer do this if finalDistFromVertex is 0... you would do this if you want to drive until a bumper is hit for instance.
If you want the action to position using the front of the robot then use setPositionFront
Definition at line 67 of file ArActionTriangleDriveTo.h.
|
Definition at line 119 of file ArActionTriangleDriveTo.h. |
|
|
Fires the action, returning what the action wants to do.
Implements ArAction. Definition at line 442 of file ArActionTriangleDriveTo.cpp. References ArTransform::doTransform(), ArMath::fabs(), ArPose::findAngleTo(), ArRobot::findDeltaHeadingTo(), ArPose::findDistanceTo(), ArRobot::findDistanceTo(), findTriangle(), ArRobot::getEncoderTransform(), ArRobot::getPose(), ArRobot::getTh(), ArRobot::getVel(), ArMutex::lock(), ArLog::log(), ArTime::mSecSince(), ArActionDesired::reset(), ArActionTriangleDriveTo::Data::setApproach(), ArActionDesired::setDeltaHeading(), ArActionTriangleDriveTo::Data::setFinal(), ArActionDesired::setHeading(), ArActionDesired::setRotVel(), ArActionDesired::setVel(), STATE_ACQUIRE, STATE_ALIGN_APPROACH, STATE_ALIGN_FINAL, STATE_FAILED, STATE_GOTO_APPROACH, STATE_GOTO_FINAL, STATE_GOTO_VERTEX, STATE_INACTIVE, STATE_SEARCHING, STATE_SUCCEEDED, and ArMutex::unlock(). |