ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to subscribe to GPS data published by MTI-G-700 xsens_driver?

asked 2018-11-15 01:02:59 -0600

r.ghahremani gravatar image

updated 2018-11-21 23:41:56 -0600

So I'm trying to make a state publisher for our custom robot, I managed to receive GPS data published on "/mti/sensor/gnssPvt". So it sends data. In my state_publisher.cpp I have:

#include "sensor_msgs/NavSatFix.h"

and

ros::Subscriber gnss_sub = g.subscribe("/mti/sensor/gnssPvt", 1000, gnssCallback);

and fro callBack I have:

void gnssCallback(const sensor_msgs::NavSatFix::ConstPtr& msg) {

I get following warning by running xsens_driver:

[WARN] [1542263240.955337]: Could not process inbound connection: topic types do not match: [sensor_msgs/NavSatFix] vs. [custom_msgs/gnssSample]{'topic': '/mti/sensor/gnssPvt', 'tcp_nodelay': '0', 'md5sum': '2d3a8cd499b9b4a0249fb98fd05cfa48', 'type': 'sensor_msgs/NavSatFix', 'callerid': '/state_publisher'}

And I don't receive data in my state_publisher.cpp node. F.Y.I I did same implementation for IMU data subscribing to "imu_raw" and it works:

#include "sensor_msgs/Imu.h"

and

ros::Subscriber imu_sub = m.subscribe("imu_raw", 1000, imuCallback);

for callBack:

void imuCallback(const sensor_msgs::Imu::ConstPtr& msg) {

Any help would be appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-11-15 07:24:31 -0600

r.ghahremani gravatar image

I found the answer, here it is:

#include <custom_msgs/gnssSample.h>

and for callBack:

 void gnssCallback(const custom_msgs::gnssSample::ConstPtr& msg) {

also don't forget to add "custom_msgs" to CMakeLists.txt of your package:

find_package(catkin REQUIRED COMPONENTS
.
.
custom_msgs
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-11-15 01:02:59 -0600

Seen: 543 times

Last updated: Nov 21 '18