# Gazebo sensor plugins for barometric pressure Sensor with geometry_msgs/PointStamped?

Im doing some underwater UUV Gazebo simulation and would like to use the hector_pose_estimationhector_pose_estimation package to fuse IMU and Fluid pressure sensors input for pose estimation. But when running the node I got ERROR

Client [/hector_pose_estimation] wants topic /rexrov2/pressure to have datatype/md5sum [geometry_msgs/PointStamped/c63aecb41bfdfd6b7e1fac37c7cbe7bf], but our version has [sensor_msgs/FluidPressure/804dc5cea1c5306d6a2eb80b9833befe]. Dropping connection.


So my Pressure Sensor has sensor_msgs/FluidPressure but the package wants pressure_height (geometry_msgs/PointStamped) as input. So I created a node listening FluidPressure msg and publish the PointStamped message in the callback. Here the node

#include "ros/ros.h"
#include <sensor_msgs/FluidPressure.h>
#include <geometry_msgs/PointStamped.h>

double current_pressure;

geometry_msgs::PointStamped::ConstPtr output:
void pressureCallback(const  geometry_msgs::PointStamped::ConstPtr& msg)
{

current_pressure= msg->fluid.pressure;
depth=current_pressure / (997.04*9.8);

output.z=depth;
pub_.publish(output);

}

int main(int argc, char **argv)
{
ros::init(argc, argv, "pressure_republisher");
ros::NodeHandle n;
ros::Subscriber sub = n.subscribe("/rexrov2/pressure", 10, pressureCallback);
ros::spin();
return 0;
}


Would this gonna work?

Thanks

• For hector with an underwater robot, would FluidPressure be handled the same way as the expected pressure_height is currently? Could you clarify why your package uses sensor_msgs/FluidPressure and not the z component of geometry_msgs/PointStamped like the package expects? Do you use the variance field of the FluidPressure measurement? Without knowing more, it seems like the simplest answer is to just change the msg type your pkg is publishing... Sep 30 at 13:31
• because the Pressure sensor Im using it publish the topic as sensor_msgs/FluidPressure as can see from here: header: seq: 294 stamp: secs: 44 nsecs: 0 frame_id: "rexrov2/pressure_link" fluid_pressure: 232.554023891 variance: 9.0
– bob
Sep 30 at 13:38
• And the hector_pose_estimation stack need Pressure message topic to be pressure_height (geometry_msgs/PointStamped). Understand?
– bob
Sep 30 at 13:39
• yes, I'm asking why you don't just republish it as the geometry_msgs/PointStamped. Sep 30 at 14:04
• oh . I didnt know that I can republish it as the geometry_msgs/PointStamped. How can do that?
– bob
Sep 30 at 14:07