|
orca-robotics INTRODUCTION Overview Download and Install Quick Start Documentation Publications REPOSITORY Interfaces Components Libraries Utilities Software Map DEVELOPER Tutorials Examples Dev Guide Dashboard Wiki login/pass: orca/orca 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-2008 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 orca::PathFollower2dData convertToPathFollowerData( const orca::PathPlanner2dData &pathPlan ); 00056 void sendPath( const orca::PathFollower2dData &pathToSend, bool activateImmediately ); 00057 00058 // Adjust timing: work out how long it takes to the first waypoint based on straight-line distance 00059 // and configured velocityToFirstWaypoint_. Take the max of first wp time and the computed time. 00060 // Add this time to all waypoints. 00061 void addTimeToReachFirstWp( const hydronavutil::Pose &pose, 00062 orca::PathFollower2dData &incomingPath ); 00063 00064 // tries a few times to get localise data by issueing remote calls 00065 void tryGetLocaliseData( orca::Localise2dData &data ); 00066 00067 // check whether the localise data is stale, if yes throws an exception 00068 void checkForStaleness( orca::Localise2dData &data ); 00069 00070 // Gets the most likely pose from the localiser (may throw). 00071 // Also sets isLocalisationUncertain. 00072 hydronavutil::Pose getPose( bool &isLocalisationUncertain ); 00073 00074 bool needToReplan( const hydronavutil::Pose ¤tPose, const orca::Waypoint2d ¤tWp ); 00075 00076 void replan( const hydronavutil::Pose ¤tPose, const orca::Waypoint2d ¤tWp ); 00077 00078 // required interface to localiser 00079 orca::Localise2dPrx localise2dPrx_; 00080 00081 // required interface to localnav 00082 orca::PathFollower2dPrx localNavPrx_; 00083 00084 // required interface to pathplanner 00085 orca::PathPlanner2dPrx pathplanner2dPrx_; 00086 00087 // receives and stores information about computed paths 00088 orcaifaceimpl::StoringPathPlanner2dConsumerImplPtr computedPathConsumer_; 00089 00090 // ========== provided pathfollower interface (incoming paths) =============== 00091 PathFollower2dI* incomingPathI_; 00092 00093 gbxiceutilacfr::Store<orca::PathFollower2dData> incomingPathStore_; 00094 00095 gbxiceutilacfr::Store<bool> activationStore_; 00096 // =========================================================================== 00097 00098 hydroogmap::OgMap ogMap_; 00099 00100 // For ray-tracing in OG Map 00101 std::auto_ptr<hydroogmap::OgLosTracer> ogLosTracer_; 00102 00103 // Monitors how far we are along the path 00104 ProgressMonitorPtr progressMonitor_; 00105 // Ice::ObjectPtr progressMonitorPtr_; 00106 // orca::PathFollower2dConsumerPrx progressMonitorPrx_; 00107 00108 bool checkForStaleLocaliseData_; 00109 00110 bool enableReplan_; 00111 00112 // These guys are used to implement a little hysteresis: don't 00113 // replan unless it has been requested for a bit. 00114 bool replanRequested_; 00115 gbxiceutilacfr::Timer replanRequestTimer_; 00116 double requiredReplanRequestTime_; 00117 00118 // If the path planner takes more than this amount of time, assume something's wrong. 00119 double pathPlanTimeout_; 00120 00121 // Velocity to get to the first waypoint 00122 double velocityToFirstWaypoint_; 00123 orcaice::Context context_; 00124 00125 }; 00126 00127 } // namespace 00128 00129 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)
1.4.5