Aria  2.8.0
ArActionTriangleDriveTo Class Reference

Action to drive up to a triangle target (e.g. docking station) found from an ArLineFinder. More...

#include <ArActionTriangleDriveTo.h>

Inherits ArAction.

Classes

class  Data
 This is for some internal debugging, don't try to use it, it won't work in windows (memory allocation issues). More...
 

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 ArActionDesiredfire (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.
 
DatagetData (void)
 Interal use only, gets the data we've saved.
 
virtual ArActionDesiredgetDesired (void)
 
virtual const ArActionDesiredgetDesired (void) const
 
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.
 
ArLineFindergetLineFinder (void)
 Sets the line finder used.
 
bool getSaveData (void)
 Internal use only, gets if we're saving data or not.
 
State getState (void)
 Gets the state.
 
bool getUseIgnoreInGotoVertexMode (void)
 Gets if we're ignoring the triangle in goto vertex mode.
 
bool getUseLegacyVertexOffset (void)
 Gets if we are use the legacy vertex mode or not.
 
bool getVertexSeen (void)
 Gets if we've seen the vertex ever for this attempted drive (it gets reset in searching, but that's the only time, so will only be set once an activation by default (unless setAcquire is called)
 
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.
 
void setLogging (bool logging)
 Sets whether we're logging the driving or not.
 
bool setLogging (void)
 Gets whether we're logging the driving or not.
 
void setMaxAngleMisalignment (int maxAngleMisalignment=0)
 Sets the maximum angle misalignment from the robot to the triangle line.
 
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)
 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 setUseLegacyVertexOffset (bool useLegacyVertexOffset)
 Sets if we should use the legacy vertex mode or not.
 
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.
 
- Public Member Functions inherited from ArAction
 ArAction (const char *name, const char *description="")
 Constructor.
 
virtual const ArArggetArg (int number) const
 Gets the numbered argument. More...
 
virtual ArArggetArg (int number)
 Gets the numbered argument.
 
virtual const char * getDescription (void) const
 Gets the long description of the action.
 
virtual const char * getName (void) const
 Gets the name of the action.
 
virtual int getNumArgs (void) const
 Find the number of arguments this action takes.
 
ArRobotgetRobot () const
 Get the robot we are controlling, which was set by setRobot()
 
virtual bool isActive (void) const
 Returns whether the action is active or not.
 
virtual void log (bool verbose=true) const
 Log information about this action using ArLog.
 
virtual ~ArAction ()
 Desructor.
 

Protected Member Functions

ArPose findPoseFromVertex (double distFromVertex)
 
void findTriangle (bool initial, bool goStraight=false)
 This finds our vertex point and angle from vertex. More...
 
- Protected Member Functions inherited from ArAction
void setNextArgument (ArArg const &arg)
 Sets the argument type for the next argument (must only be used in a constructor!)
 

Protected Attributes

bool myAcquire
 
double myAcquireTurnSpeed
 
bool myAdjustVertex
 
double myAngleBetween
 
double myApproachDistFromVertex
 
double myCloseDist
 
DatamyData
 
ArMutex myDataMutex
 
ArActionDesired myDesired
 
double myFinalDistFromVertex
 
unsigned int myGotLinesCounter
 
bool myGotoVertex
 
double myIgnoreTriangleDist
 
ArRangeDevicemyLaser
 
double myLine1Length
 
double myLine2Length
 
ArLineFindermyLineFinder
 
std::map< int, ArLineFinderSegment * > * myLines
 
int myLocalXOffset
 
int myLocalYOffset
 
int myMaxAngleMisalignment
 
int myMaxDistBetweenLinePoints
 
int myMaxLateralDist
 
double myOriginalAngle
 
bool myOwnLineFinder
 
bool myPrinting
 
bool mySaveData
 
double mySpeed
 
State myState
 
double myThOffset
 
bool myTwoStageApproach
 
bool myUseIgnoreInGoto
 
bool myUseLegacyVertexOffset
 
ArPose myVertex
 
bool myVertexSeen
 
ArTime myVertexSeenLast
 
int myVertexUnseenStopMSecs
 
- Protected Attributes inherited from ArAction
std::map< int, ArArgmyArgumentMap
 
std::string myDescription
 
bool myIsActive
 
std::string myName
 
int myNumArgs
 
ArRobotmyRobot
 The robot we are controlling, set by the action resolver using setRobot()
 

Additional Inherited Members

- Static Public Member Functions inherited from ArAction
static bool getDefaultActivationState (void)
 Gets the default activation state for all ArActions.
 
static void setDefaultActivationState (bool defaultActivationState)
 Sets the default activation state for all ArActions.
 
- Static Protected Attributes inherited from ArAction
static bool ourDefaultActivationState = true
 

Detailed Description

Action to drive up to a triangle target (e.g. docking station) found from an ArLineFinder.

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 called with 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 called with 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 given 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().

Examples:
triangleDriveToActionExample.cpp.

Member Enumeration Documentation

◆ State

Enumerator
STATE_INACTIVE 

we aren't trying

STATE_ACQUIRE 

finding the target

STATE_SEARCHING 

Turning trying to find the target.

STATE_GOTO_APPROACH 

driving to the approach point

STATE_ALIGN_APPROACH 

aligning to the target the first time

STATE_GOTO_VERTEX 

driving to the vertex

STATE_GOTO_FINAL 

driving to the final point

STATE_ALIGN_FINAL 

aligning to the target the final time

STATE_SUCCEEDED 

pointing at the target

STATE_FAILED 

if we're not acquiring and we lost the vertex we fail

Member Function Documentation

◆ findTriangle()

void ArActionTriangleDriveTo::findTriangle ( bool  initial,
bool  goStraight = false 
)
protected

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


The documentation for this class was generated from the following files: