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

Revision history [back]

click to hide/show revision 1
initial version

First of all, you have to create a subscriber for the sensor_msgs/NavSatFix message. Take a look here on how to create a subscriber http://wiki.ros.org/roscpp/Overview/Publishers%20and%20Subscribers Your callback function should have this signature:

void callback(const sensor_msgs::NavSatFixConstPtr& satfix)

Looking at the link you have provided (http://docs.ros.org/api/sensor_msgs/html/msg/NavSatFix.html), we can see that the NavSatStatus is provided on an attribute called status. And this attribute stores the actual status in another variable called status (see here http://docs.ros.org/api/sensor_msgs/html/msg/NavSatStatus.html)

Then, in order to print the status, I think your callback function would be something like this:

void callback(const sensor_msgs::NavSatFixConstPtr& satfix)
{
    ROS_INFO("status = %d", satfix.status.status);
}

Let me know if that works.