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 <gbxsickacfr/gbxiceutilacfr/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/pathplanner2d.h> 00020 #include <orca/pathfollower2d.h> 00021 #include <hydroogmap/hydroogmap.h> 00022 #include "progressmonitor.h" 00023 #include <memory> 00024 #include <orcaifaceimpl/storingconsumers.h> 00025 00026 namespace goalplanner 00027 { 00028 00029 class PathFollower2dI; 00030 00031 class MainThread : public gbxsickacfr::gbxiceutilacfr::SubsystemThread 00032 { 00033 00034 public: 00035 00036 MainThread( const orcaice::Context& context ); 00037 00038 // from SubsystemThread 00039 virtual void walk(); 00040 00041 private: 00042 00043 void stopRobot(); 00044 void initNetwork(); 00045 00046 // Returns 'gotNewPath': 00047 // - if true, we got a new path (written to newPathData). 00048 // - if false, we exitted coz the component is stopping. 00049 bool waitForNewPath( orca::PathFollower2dData &newPathData ); 00050 00051 orca::PathPlanner2dData planPath( const hydronavutil::Pose &pose, const orca::PathFollower2dData &coarsePath ); 00052 orca::PathFollower2dData convertToPathFollowerData( const orca::PathPlanner2dData &pathPlan ); 00053 void sendPath( const orca::PathFollower2dData &pathToSend, bool activateImmediately ); 00054 00055 // Adjust timing: work out how long it takes to the first waypoint based on straight-line distance 00056 // and configured velocityToFirstWaypoint_. Take the max of first wp time and the computed time. 00057 // Add this time to all waypoints. 00058 void addTimeToReachFirstWp( const hydronavutil::Pose &pose, 00059 orca::PathFollower2dData &incomingPath ); 00060 00061 // tries a few times to get localise data by issueing remote calls 00062 void tryGetLocaliseData( orca::Localise2dData &data ); 00063 00064 // check whether the localise data is stale, if yes throws an exception 00065 void checkForStaleness( orca::Localise2dData &data ); 00066 00067 // Gets the most likely pose from the localiser (may throw). 00068 // Also sets isLocalisationUncertain. 00069 hydronavutil::Pose getPose( bool &isLocalisationUncertain ); 00070 00071 bool needToReplan( const hydronavutil::Pose ¤tPose, const orca::Waypoint2d ¤tWp ); 00072 00073 void replan( const hydronavutil::Pose ¤tPose, const orca::Waypoint2d ¤tWp ); 00074 00075 // required interface to localiser 00076 orca::Localise2dPrx localise2dPrx_; 00077 00078 // required interface to localnav 00079 orca::PathFollower2dPrx localNavPrx_; 00080 00081 // required interface to pathplanner 00082 orca::PathPlanner2dPrx pathplanner2dPrx_; 00083 00084 // receives and stores information about computed paths 00085 orcaifaceimpl::StoringPathPlanner2dConsumerImplPtr computedPathConsumer_; 00086 00087 // ========== provided pathfollower interface (incoming paths) =============== 00088 PathFollower2dI* incomingPathI_; 00089 00090 gbxsickacfr::gbxiceutilacfr::Store<orca::PathFollower2dData> incomingPathStore_; 00091 00092 gbxsickacfr::gbxiceutilacfr::Store<bool> activationStore_; 00093 // =========================================================================== 00094 00095 hydroogmap::OgMap ogMap_; 00096 00097 // For ray-tracing in OG Map 00098 std::auto_ptr<hydroogmap::OgLosTracer> ogLosTracer_; 00099 00100 // Monitors how far we are along the path 00101 ProgressMonitor *progressMonitor_; 00102 Ice::ObjectPtr progressMonitorPtr_; 00103 orca::PathFollower2dConsumerPrx progressMonitorPrx_; 00104 00105 bool checkForStaleLocaliseData_; 00106 00107 bool enableReplan_; 00108 00109 // If the path planner takes more than this amount of time, assume something's wrong. 00110 double pathPlanTimeout_; 00111 00112 // Velocity to get to the first waypoint 00113 double velocityToFirstWaypoint_; 00114 orcaice::Context context_; 00115 00116 }; 00117 00118 } // namespace 00119 00120 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)