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

SourceForge.net Logo
Project
Download
Mailing lists

 

         

simulator.h

00001 #ifndef SIMULATOR_H
00002 #define SIMULATOR_H
00003 
00004 #include <hydrosim2d/hydrosim2d.h>
00005 #include <orca/pathfollower2d.h>
00006 #include <orca/vehicledescription.h>
00007 #include <memory>
00008 #include <orcaifaceimpl/ogmap.h>
00009 #include <hydropublish/rangescanner2dpublisher.h>
00010 #include <hydropublish/odometry2dpublisher.h>
00011 #include <hydropublish/localise2dpublisher.h>
00012 #include <hydropublish/ogmappublisher.h>
00013 #include <orcascanutil/orcascanutil.h>
00014 #include <orcanavutil/orcanavutil.h>
00015 
00016 namespace orcalocalnavtest {
00017 
00018 //
00019 // @author Alex Brooks
00020 //
00021 class Simulator
00022 {
00023 
00024 public: 
00025 
00026     struct Config {
00027         Config()
00028             : scannerOffset(0.15,0,0), initialPose(0,0,0), applyNoises(false) {}
00029 
00030         double                                    maxLateralAcceleration;
00031         bool                                      checkLateralAcceleration;
00032         bool                                      checkDifferentialConstraints;
00033         bool                                      checkVelocityConstraints;
00034         bool                                      useRoom;
00035         bool                                      batchMode;
00036         int                                       numIterationsBatch;
00037         int                                       numIterationsLimit;
00038         hydronavutil::Pose                        scannerOffset;
00039         hydronavutil::Pose                        initialPose;
00040         bool                                      applyNoises;
00041         hydrosim2d::VehicleSimulator::NoiseConfig noises;
00042     };
00043 
00044     Simulator( hydropublish::RangeScanner2dPublisherFactory &rangeScannerPublisherFactory,
00045                hydropublish::Localise2dPublisherFactory     &localise2dPublisherFactory,
00046                hydropublish::Odometry2dPublisherFactory     &odometry2dPublisherFactory,
00047                hydropublish::OgMapPublisherFactory          &ogMapPublisherFactory,
00048                const hydroogmap::OgMap                      &ogMap,
00049                const orca::PathFollower2dData               &testPath,
00050                const Config                                 &config );
00051 
00052     // This is the trigger to advance the simulator one step.
00053     void act( const hydronavutil::Velocity &cmd );
00054 
00055     void checkProgress( bool &pathCompleted, bool &pathFailed );
00056 
00057     void getObsRanges( std::vector<float> &obsRanges );
00058 
00059     hydronavutil::Pose pose() const
00060         { return vehicleSimulator_->pose(); }
00061     hydronavutil::Velocity velocity() const
00062         { return vehicleSimulator_->velocity(); }
00063 
00064     orca::VehicleDescription vehicleDescription() const
00065         { return orcanavutil::convert( controlDescr_, geomDescr_ ); }
00066 
00067     orca::RangeScanner2dDescription rangeScanner2dDescription() const
00068         { return orcascanutil::convert( scannerConfig_, config_.scannerOffset ); }
00069     
00070     hydrotime::Time time() const;
00071     int iterationNum() const { return iterationNum_; }
00072 
00073     const hydrosim2d::VehicleSimulator &vehicleSimulator() const { return *vehicleSimulator_; }
00074     const hydroogmap::OgMap &ogMap() const { return ogMap_; }
00075 
00076     const orca::PathFollower2dData &testPath() const { return testPath_; }
00077 
00078     static std::string scannerInterfaceName()  { return "TestLaserScanner"; }
00079     static std::string localiseInterfaceName() { return "TestLocalise"; }
00080     static std::string odomInterfaceName()     { return "TestOdometry"; }
00081 
00082     hydronavutil::CylindricalGeometryDescription geomDescr() const { return geomDescr_; }
00083 
00084 private: 
00085 
00086     void setupInterfaces( const hydrosim2d::VehicleSimulator::Config      &vehicleSimConfig,
00087                           const hydrosim2d::RangeScannerSimulator::Config &rangeScanSimConfig,
00088                           hydropublish::RangeScanner2dPublisherFactory    &rangeScanner2dPublisherFactory,
00089                           hydropublish::Localise2dPublisherFactory        &localise2dPublisherFactory,
00090                           hydropublish::Odometry2dPublisherFactory        &odometry2dPublisherFactory,
00091                           hydropublish::OgMapPublisherFactory             &ogMapPublisherFactory );
00092 
00093     hydropublish::Localise2dPublisherPtr     posePublisher_;
00094     hydropublish::RangeScanner2dPublisherPtr rangeScanPublisher_;
00095     hydropublish::Odometry2dPublisherPtr     odomPublisher_;
00096     hydropublish::OgMapPublisherPtr          ogMapPublisher_;
00097 
00098     hydroscanutil::ScannerConfig scannerConfig_;
00099 
00100     hydronavutil::DiffDriveControlDescription    controlDescr_;
00101     hydronavutil::CylindricalGeometryDescription geomDescr_;
00102 
00103     hydroogmap::OgMap        ogMap_;
00104     orca::PathFollower2dData testPath_;
00105 
00106     int    iterationNum_;
00107     int    wpI_;
00108 
00109     std::auto_ptr<hydrosim2d::VehicleSimulator>      vehicleSimulator_;
00110     std::auto_ptr<hydrosim2d::RangeScannerSimulator> rangeScannerSimulator_;
00111 
00112     const Config config_;
00113 };
00114 
00115 std::string toString( const Simulator::Config &c );
00116 
00117 }
00118 
00119 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5