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
|
components/goalplanner/mainthread.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2009 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 00011 #ifndef MAINTHREAD_H 00012 #define MAINTHREAD_H 00013 00014 #include <orcaice/subsystemthread.h> 00015 #include <orcaice/context.h> 00016 #include <gbxsickacfr/gbxiceutilacfr/store.h> 00017 #include <hydronavutil/pose.h> 00018 #include <orca/localise2d.h> 00019 #include <orca/pathfollower2d.h> 00020 #include <orcaifaceimpl/pathplanner2d.h> 00021 00022 #include <hydroogmap/hydroogmap.h> 00023 #include <hydroogmap/oglostracer.h> 00024 #include "progressmonitor.h" 00025 #include <memory> 00026 #include <gbxsickacfr/gbxiceutilacfr/timer.h> 00027 00028 namespace goalplanner 00029 { 00030 00031 class PathFollower2dI; 00032 00033 class MainThread : public orcaice::SubsystemThread 00034 { 00035 00036 public: 00037 00038 MainThread( const orcaice::Context& context ); 00039 00040 private: 00041 00042 // from SubsystemThread 00043 virtual void initialise(); 00044 virtual void work(); 00045 00046 void stopRobot(); 00047 void initNetwork(); 00048 00049 // Returns 'gotNewPath': 00050 // - if true, we got a new path (written to newPathData). 00051 // - if false, we exitted coz the component is stopping. 00052 bool waitForNewPath( orca::PathFollower2dData &newPathData ); 00053 00054 orca::PathPlanner2dData planPath( const hydronavutil::Pose &pose, const orca::PathFollower2dData &coarsePath ); 00055 void sendPath( const orca::PathFollower2dData &pathToSend, bool activateImmediately ); 00056 00057 // tries a few times to get localise data by issueing remote calls 00058 void tryGetLocaliseData( orca::Localise2dData &data ); 00059 00060 // Gets the most likely pose from the localiser (may throw). 00061 // Also sets isLocalisationUncertain. 00062 hydronavutil::Pose getPose( bool &isLocalisationUncertain ); 00063 00064 bool needToReplan( const hydronavutil::Pose ¤tPose, const orca::Waypoint2d ¤tWp ); 00065 00066 void replan( const hydronavutil::Pose ¤tPose, const orca::Waypoint2d ¤tWp ); 00067 00068 // required interface to localiser 00069 orca::Localise2dPrx localise2dPrx_; 00070 00071 // required interface to localnav 00072 orca::PathFollower2dPrx localNavPrx_; 00073 00074 // required interface to pathplanner 00075 orca::PathPlanner2dPrx pathplanner2dPrx_; 00076 00077 // receives and stores information about computed paths 00078 orcaifaceimpl::StoringPathPlanner2dConsumerImplPtr computedPathConsumer_; 00079 00080 // ========== provided pathfollower interface (incoming paths) =============== 00081 PathFollower2dI* incomingPathI_; 00082 00083 gbxiceutilacfr::Store<orca::PathFollower2dData> incomingPathStore_; 00084 00085 gbxiceutilacfr::Store<bool> activationStore_; 00086 // =========================================================================== 00087 00088 hydroogmap::OgMap ogMap_; 00089 00090 // For ray-tracing in OG Map 00091 std::auto_ptr<hydroogmap::OgLosTracer> ogLosTracer_; 00092 00093 // Monitors how far we are along the path 00094 ProgressMonitorPtr progressMonitor_; 00095 // Ice::ObjectPtr progressMonitorPtr_; 00096 // orca::PathFollower2dConsumerPrx progressMonitorPrx_; 00097 00098 bool checkForStaleLocaliseData_; 00099 00100 bool enableReplan_; 00101 00102 // These guys are used to implement a little hysteresis: don't 00103 // replan unless it has been requested for a bit. 00104 bool replanRequested_; 00105 gbxiceutilacfr::Timer replanRequestTimer_; 00106 double requiredReplanRequestTime_; 00107 00108 // If the path planner takes more than this amount of time, assume something's wrong. 00109 double pathPlanTimeout_; 00110 00111 // Velocity to get to the first waypoint 00112 double velocityToFirstWaypoint_; 00113 orcaice::Context context_; 00114 00115 }; 00116 00117 } // namespace 00118 00119 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)