34 for (
int i = 0; i < 9; i++)
37 this->rosMessage.pos.covariance[0] = this->rosMessage.pos.covariance[4] =
38 this->rosMessage.pos.covariance[8] = variance;
41 this->rosSensorOutputPub =
42 this->rosNode->advertise<
43 uuv_sensor_ros_plugins_msgs::PositionWithCovarianceStamped>(
44 this->sensorOutputTopic, 1);
49 this->
gazeboNode->Advertise<sensor_msgs::msgs::Rpt>(
66 #if GAZEBO_MAJOR_VERSION >= 8 75 #if GAZEBO_MAJOR_VERSION >= 8 100 sensor_msgs::msgs::Rpt gazeboMessage;
103 for (
int i = 0 ; i < 9; i++)
105 if (i == 0 || i == 4 || i == 8)
106 gazeboMessage.add_position_covariance(variance);
108 gazeboMessage.add_position_covariance(0.0);
111 gazebo::msgs::Vector3d * p =
new gazebo::msgs::Vector3d();
116 gazeboMessage.set_allocated_position(p);
RPTROSPlugin()
Class constructor.
virtual bool OnUpdate(const common::UpdateInfo &_info)
Update sensor measurement.
physics::LinkPtr referenceLink
Reference link.
double GetGaussianNoise(double _amp)
Returns noise value for a function with zero mean from the default Gaussian noise model...
void publish(const boost::shared_ptr< M > &message) const
bool EnableMeasurement(const common::UpdateInfo &_info) const
Enables generation of simulated measurement if the timeout since the last update has been reached...
ignition::math::Pose3d referenceFrame
Pose of the reference frame wrt world frame.
virtual ~RPTROSPlugin()
Class destructor.
double noiseAmp
Noise amplitude.
virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf)
Load plugin and its configuration from sdf,.
void UpdateReferenceFramePose()
Updates the pose of the reference frame wrt the world frame.
transport::NodePtr gazeboNode
Gazebo's node handle for transporting measurement messages.
double noiseSigma
Noise standard deviation.
virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf)
Load the plugin.
uuv_sensor_ros_plugins_msgs::PositionWithCovarianceStamped rosMessage
Store message since many attributes do not change (cov.).
transport::PublisherPtr gazeboSensorOutputPub
Gazebo's publisher for transporting measurement messages.
std::string referenceFrameID
Frame ID of the reference frame.
physics::LinkPtr link
Pointer to the link.
ignition::math::Vector3d position
Latest measured position.
std::string sensorOutputTopic
Name of the sensor's output topic.
ros::Publisher rosSensorOutputPub
Gazebo's publisher for transporting measurement messages.
GZ_REGISTER_MODEL_PLUGIN(GazeboRosP3D)
std::string robotNamespace
Robot namespace.
bool gazeboMsgEnabled
Flag set to true if the Gazebo sensors messages are supposed to be published as well (it can avoid un...
void PublishState()
Publish the current state of the plugin.