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
|
idriver.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_LOCALNAVDRIVER_H 00011 #define ORCALOCALNAV_LOCALNAVDRIVER_H 00012 00013 #include <orca/velocitycontrol2d.h> 00014 #include <orca/rangescanner2d.h> 00015 #include <orcaice/context.h> 00016 #include <orca/vehicledescription.h> 00017 #include <hydronavutil/hydronavutil.h> 00018 #include <orcalocalnav/goal.h> 00019 00020 namespace orcalocalnav { 00021 00022 // 00023 // @author Alex Brooks 00024 // 00025 // Base class for local navigation drivers. 00026 // The manager sets the goal location (in the robot's coordinate system) 00027 // by modifying the goal. 00028 // 00029 class IDriver 00030 { 00031 00032 public: 00033 00034 // The pose is in a global coordinate frame, while the goals are 00035 // in the local coordinate frame. 00036 struct Inputs { 00037 bool stalled; 00038 bool isLocalisationUncertain; 00039 hydronavutil::Pose localisePose; 00040 orca::Time poseTime; 00041 hydronavutil::Velocity currentVelocity; 00042 std::vector<float> obsRanges; 00043 orca::Time obsTime; 00044 std::vector<orcalocalnav::Goal> goals; 00045 }; 00046 00048 00049 IDriver() {}; 00050 virtual ~IDriver() {}; 00051 00052 // The number of waypoints we look into the future (and therefore 00053 // expect to be provided with) 00054 virtual int waypointHorizon() { return 1; } 00055 00056 // Gets a velocity command. 00057 virtual hydronavutil::Velocity getCommand( const Inputs &inputs ) = 0; 00058 }; 00059 00060 // Helper class to instantiate drivers 00061 class DriverFactory { 00062 public: 00063 virtual ~DriverFactory() {}; 00064 virtual IDriver *createDriver( const orcaice::Context &context, 00065 const orca::VehicleDescription &vehicleDescr, 00066 const orca::RangeScanner2dDescription &rangeScannerDescr ) const=0; 00067 }; 00068 00069 std::string toString( const IDriver::Inputs &inputs ); 00070 inline std::ostream &operator<<( std::ostream &s, const IDriver &inputs ) 00071 { return s << inputs; } 00072 00073 } // namespace 00074 00075 // Function for dynamically instantiating drivers. 00076 // A driver must have a function like so: 00077 // extern "C" { 00078 // orcalocalnav::DriverFactory *createDriverFactory(); 00079 // } 00080 typedef orcalocalnav::DriverFactory *DriverFactoryMakerFunc(); 00081 00082 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)