Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef ROTORS_GAZEBO_PLUGINS_PRESSURE_PLUGIN_H
00018 #define ROTORS_GAZEBO_PLUGINS_PRESSURE_PLUGIN_H
00019
00020 #include <random>
00021
00022 #include <glog/logging.h>
00023
00024 #include <gazebo/common/Plugin.hh>
00025 #include <gazebo/common/common.hh>
00026 #include <gazebo/gazebo.hh>
00027 #include <gazebo/physics/physics.hh>
00028
00029 #include "FluidPressure.pb.h"
00030
00031 #include "rotors_gazebo_plugins/common.h"
00032
00033 namespace gazebo {
00034
00035 static constexpr double kGasConstantNmPerKmolKelvin = 8314.32;
00036 static constexpr double kMeanMolecularAirWeightKgPerKmol = 28.9644;
00037 static constexpr double kGravityMagnitude = 9.80665;
00038 static constexpr double kEarthRadiusMeters = 6356766.0;
00039 static constexpr double kPressureOneAtmospherePascals = 101325.0;
00040 static constexpr double kSeaLevelTempKelvin = 288.15;
00041 static constexpr double kTempLapseKelvinPerMeter = 0.0065;
00042 static constexpr double kAirConstantDimensionless = kGravityMagnitude *
00043 kMeanMolecularAirWeightKgPerKmol /
00044 (kGasConstantNmPerKmolKelvin * -kTempLapseKelvinPerMeter);
00045
00046
00047 static const std::string kDefaultPressurePubTopic = "air_pressure";
00048 static constexpr double kDefaultRefAlt = 500.0;
00049 static constexpr double kDefaultPressureVar = 0.0;
00050
00051 class GazeboPressurePlugin : public ModelPlugin {
00052 public:
00054 GazeboPressurePlugin();
00055
00057 virtual ~GazeboPressurePlugin();
00058
00059 typedef std::normal_distribution<> NormalDistribution;
00060
00061 protected:
00064 void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
00065
00067 void OnUpdate(const common::UpdateInfo&);
00068
00069 private:
00072 bool pubs_and_subs_created_;
00073
00078 void CreatePubsAndSubs();
00079
00081 gazebo::transport::NodePtr node_handle_;
00082
00084 gazebo::transport::PublisherPtr pressure_pub_;
00085
00087 std::string namespace_;
00088
00090 std::string pressure_topic_;
00091
00093 std::string frame_id_;
00094
00096 physics::WorldPtr world_;
00097
00099 physics::ModelPtr model_;
00100
00102 physics::LinkPtr link_;
00103
00105 event::ConnectionPtr updateConnection_;
00106
00108 double ref_alt_;
00109
00111 double pressure_var_;
00112
00114 NormalDistribution pressure_n_[1];
00115
00118
00119 gz_sensor_msgs::FluidPressure pressure_message_;
00120
00121 std::mt19937 random_generator_;
00122 };
00123 }
00124
00125 #endif // ROTORS_GAZEBO_PLUGINS_PRESSURE_PLUGIN_H
rotors_gazebo_plugins
Author(s): Fadri Furrer, Michael Burri, Mina Kamel, Janosch Nikolic, Markus Achtelik
autogenerated on Thu Apr 18 2019 02:43:43