Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

PilotRequest.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_PilotRequest_h_
00003 #define INCLUDED_PilotRequest_h_
00004 
00005 #include "DualCoding/ShapeRoot.h"
00006 #include "Behaviors/BehaviorBase.h"
00007 #include "Motion/WaypointList.h"
00008 
00009 #include "PilotTypes.h"
00010 
00011 namespace DualCoding {
00012 
00013 class MapBuilderRequest;
00014 class LookoutTrackRequest;
00015 
00016 //! Request to the @a Pilot for motion or navigation.
00017 class PilotRequest {
00018   friend class Pilot;
00019 
00020  public:
00021 
00022   //! Constructor
00023   PilotRequest(PilotTypes::RequestType_t _type = PilotTypes::noRequest);
00024 
00025   PilotRequest(const PilotRequest &req);
00026 
00027   PilotTypes::RequestType_t getRequestType() const { return requestType; }
00028 
00029   PilotTypes::RequestType_t requestType; //!< Type of pilot request
00030   float dx; //!< Forward distance in mm (negative means go backward)
00031   float dy; //!< Sideways distance in mm (positive to the left)
00032   float da; //!< Rotation angle in radians (positive is counterclockwise)
00033   float forwardSpeed; //!< Translation speed in mm/sec for @a dx or @a dy
00034   float strafeSpeed; //!< Sideways translational speed used for setVelocity
00035   float turnSpeed; //!< Rotational speed in radians/sec for @a da
00036   std::string walkParameters; // !< Name of walk parameter file to load
00037   PilotTypes::CollisionAction_t collisionAction;  //!< What to do about collisions
00038 
00039   WaypointList waypointList; //!< Waypoint list for waypointWalk
00040   bool clearWaypoints;  //!< If true, the waypointList will be cleared before appending new waypoints
00041 
00042   MapBuilderRequest *landmarkExtractor; //!< pointer to MapBuilderRequest used to find landmarks; will be deleted by the Pilot
00043   bool (*landmarkExitTest)(); //!< Should return true if there are enough landmarks to localize
00044 
00045   MapBuilderRequest *searchObjectExtractor; //!< MapBuilderRequest to be used for visual search
00046   bool (*searchExitTest)(); //!< If true, terminate search and post a completion event
00047   AngSignPi searchRotationAngle; //!< Angle to rotate body to continue a visual search
00048 
00049   ShapeRoot targetShape; //!< Shape to walk to
00050   AngTwoPi targetHeading; //!< Heading on which we want to arrive at the target
00051 
00052   ShapeRoot objectShape; //!< Object we want to push to the target
00053   MapBuilderRequest *objectExtractor; //!< Pointer to MapbuilderRequest for finding the object to be pushed; will be deleted by the Pilot
00054   ShapeRoot (*objectMatcher)(const ShapeRoot&); //!< Finds the localShS object matching objectShape in worldShS
00055   MapBuilderRequest *acquireExtractor; //!< Pointer to MapBuilderRequest to check if we have acquired the object
00056   bool (*acquireTest)(const ShapeRoot&); //!< Returns true if vision confirms that we have successfully acquired the object (e.g., for pushing)
00057 
00058   bool allowBackwardMotion; //!< True if the robot should avoid large turns by walking backwards if distance is short
00059   float maxBackwardDistance; //!< Maximum allowable distance to walk backward instead of turning around
00060 
00061   void (*pathEditor)(void* pathResult, PilotRequest &req);
00062   void (*planEditor)(PilotTypes::NavigationPlan &plan, PilotRequest &req);
00063 
00064   float obstacleInflation; //!< Inflation in mm of obstacle bounding shapes for path planning
00065   bool avoidCliffs; //!< If true, use IR to avoid walking off a cliff
00066   int cliffThreshold; //!< Maximum tolerable distance to the ground (millimeters)
00067   bool avoidObstacles; //!< If true, use rangefinder sensors to dynamically avoid obstacles (not yet implemented)
00068   int obstacleThreshold; //!< Minimum tolerable rangefinder distance to an obstacle (millimeters)
00069   LookoutTrackRequest *trackRequest; //!< Lookout request for tracking objects while walking
00070 
00071   float displayParticles; //!< How many particles to display (number or percentage) as a single Graphics shape
00072   float displayIndividualParticles; //!< How many particles to display (number or percentage) as LocalizationParticle shapes
00073   bool displayPath; //!< If true, the planned path is displayed in the shape space
00074   bool displayTree; //!< If true, the RRT search tree is displayed in the world shape space
00075   bool displayObstacles; //!< If true, the obstacle boundaries used by the collision checker are displayed in the worls shape space
00076   bool autoDisplayObstacles; //!< If true, the obstacle boundaries used by the collision checker are displayed in the worls shape space automatically
00077   unsigned int maxRRTIterations; //!< Maximum number of iterations for path planner RRT search
00078   bool executePath;  //!< If true, the Pilot will execute the path it has planned; if false, it plans but does not execute
00079   std::vector<DualCoding::ShapeRoot> landmarks; //!< Vector of landmarks to use for localization
00080 
00081   /* Target-related items from Somchaya Liemhetcharat's work; disabled for now
00082   float safeDistanceAroundTarget; //!< The distance to stay away from the target while circling
00083   AngSignPi subtendAngle; //!< The angle in which to subtend the target while circling
00084   AngSignPi approachAngle; //!< The angle in which to approach the desired position around the target
00085   Point positionRelativeToTarget; //!< The desired position around the target, relative to the target
00086   AngSignPi angleToPushTarget; //!< The angle in which to push the target
00087   void (*buildTargetParamsFn)(bool *buildFrontLeft, bool *buildFrontRight, bool *buildBackLeft, bool *buildBackRight, bool *lookAtCentroid, int *maxRetries); //!< function to return the parameters to build the target
00088   MapBuilderRequest* (*buildTargetMapBuilderRequestFn)(Point point); //!< function to return a dynamically-constructed MapBuilderRequest, given a point to look at, which BuildTarget will use to build the target
00089   */
00090 
00091   BehaviorBase* requestingBehavior;  //!< Used to construct a PilotEvent to notify the requesting node of the results of this Pilot operation
00092   
00093   PilotRequest& operator=(const PilotRequest &req);
00094 
00095   bool operator==(const PilotRequest &other) const { return this == &other; } // needed for SignalTrans<PilotRequest>
00096 
00097 private:
00098   unsigned int requestID;
00099 };
00100 
00101 } // namespace
00102 
00103 #endif

Tekkotsu v5.1CVS
Generated Sat May 4 06:32:54 2013 by Doxygen 1.6.3