|
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/localnav/mainthread.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, Ben Upcroft 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 MAINTHREAD_H 00011 #define MAINTHREAD_H 00012 00013 #include <orca/velocitycontrol2d.h> 00014 #include <orcaifaceimpl/rangescanner2d.h> 00015 #include <orcaifaceimpl/localise2d.h> 00016 #include <orcaifaceimpl/odometry2d.h> 00017 #include <orcaice/context.h> 00018 #include <orcaice/subsystemthread.h> 00019 #include <gbxsickacfr/gbxiceutilacfr/store.h> 00020 #include "speedlimiter.h" 00021 #include "pathmaintainer.h" 00022 #include "clock.h" 00023 #include <orcalocalnav/idriver.h> 00024 #include <hydronavutil/hydronavutil.h> 00025 #include <hydrodll/dynamicload.h> 00026 #include "pathfollowerinterface.h" 00027 #include "testsim/simulator.h" 00028 #include "algorithmevaluator.h" 00029 00030 namespace localnav { 00031 00032 // 00033 // @brief the main executing loop of this component. 00034 // 00035 // Note: this thing self-destructs when run() returns. 00036 // 00037 // 00038 // @author Alex Brooks 00039 // 00040 class MainThread : public orcaice::SubsystemThread 00041 { 00042 00043 public: 00044 00045 MainThread( const orcaice::Context &context ); 00046 00047 private: 00048 00049 // from SubsystemThread 00050 virtual void initialise(); 00051 virtual void work(); 00052 00053 void getVehicleDescription(); 00054 void getRangeScannerDescription(); 00055 void setup(); 00056 void initPathFollowerInterface(); 00057 00058 void sendCommandToPlatform( const hydronavutil::Velocity &cmd ); 00059 00060 // Make sure all our sources of info are OK, and that there's something 00061 // in all our buffers 00062 void ensureProxiesNotEmpty(); 00063 00064 // See if we need to follow a new path, plus 00065 // see if we should update the world on our progress. 00066 void checkWithOutsideWorld(); 00067 00068 void getInputs( hydronavutil::Velocity &velocity, 00069 hydronavutil::Pose &localisePose, 00070 orca::Time &poseTime, 00071 bool &isLocalisationUncertain, 00072 std::vector<float> &obsRanges, 00073 orca::Time &obsTime ); 00074 00075 void stopVehicle(); 00076 00077 // Constrains the max speed 00078 std::auto_ptr<SpeedLimiter> speedLimiter_; 00079 00080 // Keeps track of the path we're following 00081 std::auto_ptr<PathMaintainer> pathMaintainer_; 00082 00083 // The library that contains the driver factory (must be declared first so it's destructed last!!!) 00084 std::auto_ptr<hydrodll::DynamicallyLoadedLibrary> driverLib_; 00085 // The factory which creates the driver 00086 std::auto_ptr<orcalocalnav::DriverFactory> driverFactory_; 00087 // Does the work 00088 std::auto_ptr<orcalocalnav::IDriver> driver_; 00089 00090 // Incoming observations and pose info 00091 // Get observations, pose, and odometric velocity 00092 orcaifaceimpl::StoringRangeScanner2dConsumerImplPtr obsConsumer_; 00093 orcaifaceimpl::StoringLocalise2dConsumerImplPtr locConsumer_; 00094 orcaifaceimpl::StoringOdometry2dConsumerImplPtr odomConsumer_; 00095 00096 std::auto_ptr<PathFollowerInterface> pathFollowerInterface_; 00097 00098 // Outgoing commands: live version 00099 orca::VelocityControl2dPrx velControl2dPrx_; 00100 // Outgoing commands: test version 00101 Simulator *testSimulator_; 00102 00103 // temporary data 00104 orca::Localise2dData orcaLocaliseData_; 00105 orca::Odometry2dData orcaOdomData_; 00106 orca::RangeScanner2dDataPtr orcaRangeData_; 00107 00108 // A global time reference 00109 std::auto_ptr<Clock> clock_; 00110 00111 orca::VehicleDescription vehicleDescr_; 00112 orca::RangeScanner2dDescription scannerDescr_; 00113 00114 bool testMode_; 00115 std::auto_ptr<AlgorithmEvaluator> algorithmEvaluator_; 00116 00117 orcaice::Context context_; 00118 bool timestampsCheckEnabled_; 00119 }; 00120 00121 } 00122 00123 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)
1.4.5