#include <ArActionTriangleDriveTo.h>
Inheritance diagram for ArActionTriangleDriveTo:
This action uses ArLineFinder to find continuous "lines" in laser range finder data that meet at an angle, forming the point of a triangular shape, towards which the robot is driven and aligned. If an ArLineFinder object is not given in the constructor, then it will search for an ArRangeDevice on the ArRobot with a name "laser" and create its own ArLineFinder object using that range device.
The parameters describing the shape of the triangle target may be set with setTriangleParams(). The default values are for a trianrgle target consisting of two lines of at least 254 mm. meeting at a 135 degree angle. This is the shape of the triangular target on docking stations. Targets also may easily be constructed out of any material well-sensed by the SICK Laser, such as wood, cardboard, or metal.
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 69 of file ArActionTriangleDriveTo.h.
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) |
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) |
virtual ArActionDesired * | fire (ArActionDesired currentDesired) |
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) |
virtual const ArActionDesired * | getDesired (void) const |
virtual ArActionDesired * | getDesired (void) |
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. | |
double | getIgnoreTriangleDist (void) |
Gets the distance to the triangle at which we start ignoring it. | |
ArLineFinder * | getLineFinder (void) |
Sets the line finder used. | |
bool | getSaveData (void) |
State | getState (void) |
bool | getUseIgnoreInGOtoVertexMode (void) |
Gets if we're ignoring the triangle in goto vertex mode. | |
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 | setIgnoreTriangleDist (double dist=250, bool useIgnoreInGotoVertexMode=false) |
Sets the distance to the triangle at which we start ignoring it. | |
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 | setMaxDistBetweenLinePoints (int maxDistBetweenLinePoints=0) |
Sets the maximum distance between points in a line. | |
void | setMaxLateralDist (int maxLateralDist=0) |
Sets the maximum lateral distance from the robot to the triangle line. | |
void | setParameters (double finalDistFromVertex=400, double approachDistFromVertex=1000, double speed=200, double closeDist=100, double acquireTurnSpeed=30) |
virtual void | setRobot (ArRobot *robot) |
void | setSaveData (bool saveData) |
void | setTriangleParams (double line1Length=254, double angleBetween=135, double line2Length=254) |
Sets the parameter of the triangle we're looking for. | |
void | setVertexOffset (int localXOffset, int localYOffset, double thOffset) |
Sets the vertex offset. | |
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 |
double | myIgnoreTriangleDist |
ArRangeDevice * | myLaser |
double | myLine1Length |
double | myLine2Length |
ArLineFinder * | myLineFinder |
std::map< int, ArLineFinderSegment * > * | myLines |
int | myLocalXOffset |
int | myLocalYOffset |
int | myMaxDistBetweenLinePoints |
int | myMaxLateralDist |
bool | myOwnLineFinder |
bool | myPrinting |
bool | mySaveData |
double | mySpeed |
State | myState |
double | myThOffset |
bool | myTwoStageApproach |
bool | myUseIgnoreInGoto |
ArPose | myVertex |
bool | myVertexSeen |
ArTime | myVertexSeenLast |
int | myVertexUnseenStopMSecs |
Classes | |
class | Data |
|
Definition at line 134 of file ArActionTriangleDriveTo.h. |
|
This finds our vertex point and angle from vertex.
difference between line1 and how long it should be difference between line2 and how long it should be Definition at line 156 of file ArActionTriangleDriveTo.cpp. |
|
Interal use only, gets the data we've saved Definition at line 832 of file ArActionTriangleDriveTo.cpp. |
|
Internal use only, gets if we're saving data or not Definition at line 206 of file ArActionTriangleDriveTo.h. |
|
Internal use only, sets if we're saving data or not Definition at line 202 of file ArActionTriangleDriveTo.h. |