INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
pathmaintainer.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2006 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This copy of Orca is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 #ifndef ORCALOCALNAV_PATHMAINTAINER_H 00011 #define ORCALOCALNAV_PATHMAINTAINER_H 00012 00013 #include <orca/pathfollower2d.h> 00014 #include <orcaice/context.h> 00015 #include <hydronavutil/pose.h> 00016 #include <orcalocalnav/goal.h> 00017 00018 namespace orcalocalnav { 00019 00020 class Clock; 00021 class PathFollowerInterface; 00022 00023 // 00024 // @author Alex Brooks 00025 // 00026 // This thing is responsible for keeping track of where we are in the path. 00027 // It doesn't need any mutexes, because all accesses are made by the MainLoop's thread. 00028 // (hence it is _not_ thread-safe). 00029 // 00030 class PathMaintainer 00031 { 00032 00033 public: 00034 00035 PathMaintainer( PathFollowerInterface &pathFollowerInterface, 00036 const orcalocalnav::Clock &clock, 00037 const orcaice::Context &context ); 00038 00039 // Gets a list of up to maxNumGoals goals, the first 00040 // of which being the one currently sought, given that the robot 00041 // is at 'pose'. 00042 // 00043 // Goals are in robot's local coordinate system. 00044 // 00045 // returns FALSE if there are no active goals, and TRUE otherwise 00046 bool getActiveGoals( std::vector<orcalocalnav::Goal> &goals, 00047 int maxNumGoals, 00048 const hydronavutil::Pose &pose, 00049 bool &wpIncremented ); 00050 00051 void checkWithOutsideWorld(); 00052 00053 private: 00054 00055 // (1): world->localnav: Have we received a new path? 00056 void checkForNewPath(); 00057 // (2): world<-localnav: Have we modified our wp index? 00058 void publishStateChanges(); 00059 00060 bool waypointReached( const orca::Waypoint2d &wp, 00061 const hydronavutil::Pose &pose, 00062 double timeNow ); 00063 void incrementWpIndex(); 00064 00065 // How long since path activation 00066 double secSinceActivation() const; 00067 00068 // Keep a local copy of the path, so we don't have to mess with buffers every 00069 // time the nav manager wants to look at it. 00070 orca::PathFollower2dData path_; 00071 00072 // Our state 00073 orca::PathActivationEnum activationState_; 00074 00075 // The index of the next waypoint being seeked. 00076 int wpIndex_; 00077 00078 // If something changes, we need to tell the world. 00079 bool stateOrWpIndexChanged_; 00080 00081 // Used to handle corner-case of 'wpIncremented' on first call to getActiveGoals after new path. 00082 bool justStartedNewPath_; 00083 00084 // The timing of the entire path is relative to this 00085 orca::Time pathStartTime_; 00086 00087 PathFollowerInterface &pathFollowerInterface_; 00088 00089 // The global time 00090 const orcalocalnav::Clock &clock_; 00091 00092 orcaice::Context context_; 00093 }; 00094 00095 } 00096 00097 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)