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 Project Download Mailing lists
|
vehiclesimulator.h00001 #ifndef HYDROSIM2D_VEHICLESIMULATOR_H 00002 #define HYDROSIM2D_VEHICLESIMULATOR_H 00003 00004 #include <hydroogmap/hydroogmap.h> 00005 #include <hydronavutil/hydronavutil.h> 00006 #include <hydropublish/localise2dpublisher.h> 00007 #include <hydropublish/odometry2dpublisher.h> 00008 00009 namespace hydrosim2d { 00010 00016 class VehicleSimulator 00017 { 00018 00019 public: 00020 00021 struct NoiseConfig { 00022 NoiseConfig() 00023 : linearMultiplicativeCov(0.0025), 00024 rotationalMultiplicativeCov(0.00022), 00025 thetaXCov(0.00022) 00026 {} 00027 double linearMultiplicativeCov; 00028 double rotationalMultiplicativeCov; 00029 double thetaXCov; 00030 }; 00031 00032 struct Config { 00033 Config() 00034 : initialPose(0,0,0), applyNoises(false) {} 00035 00036 double robotRadius; 00037 double timeStep; 00038 bool checkDifferentialConstraints; 00039 double maxLinearAcceleration; 00040 double maxRotationalAcceleration; 00041 bool checkLateralAcceleration; 00042 double maxLateralAcceleration; 00043 bool checkVelocityConstraints; 00044 hydronavutil::Velocity minVelocity; 00045 hydronavutil::Velocity maxVelocity; 00046 hydronavutil::Pose initialPose; 00047 bool applyNoises; 00048 NoiseConfig noises; 00049 }; 00050 00052 00053 VehicleSimulator( const Config &config, 00054 const hydroogmap::OgMap &ogMap, 00055 hydropublish::Localise2dPublisher *posePublisher = NULL, 00056 hydropublish::Odometry2dPublisher *odomPublisher = NULL ); 00057 00059 void act( const hydronavutil::Velocity &cmd, 00060 const hydrotime::Time &time ); 00061 00063 bool isCollided() const; 00064 00065 hydronavutil::Pose pose() const { return pose_; } 00066 hydronavutil::Velocity velocity() const { return velocity_; } 00067 00068 const Config &config() const { return config_; } 00069 00070 private: 00071 00072 const Config config_; 00073 00074 // Grow the OG map by the robot radius, so we can treat the robot as a point. 00075 hydroogmap::OgMap grownOgMap_; 00076 00077 hydronavutil::Pose pose_; 00078 hydronavutil::Velocity velocity_; 00079 00080 hydropublish::Localise2dPublisher *posePublisher_; 00081 hydropublish::Odometry2dPublisher *odomPublisher_; 00082 }; 00083 00084 std::string toString( const VehicleSimulator::NoiseConfig &c ); 00085 inline std::ostream &operator<<( std::ostream &s, const VehicleSimulator::NoiseConfig &c ) 00086 { return s << toString(c); } 00087 std::string toString( const VehicleSimulator::Config &c ); 00088 inline std::ostream &operator<<( std::ostream &s, const VehicleSimulator::Config &c ) 00089 { return s << toString(c); } 00090 00091 } 00092 00093 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)