Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

GPSFix doesn't match Rosbag MessageInstance type

I am using Diamondback. I have a captured bag file with data from a number of sensors. I am iterating over the bag file, and initiating a callback function depending on the topic I iterate over in the bag file. However somehow /fix topic is not matching to the message type anytime. Here is a code snippet -

BOOST_FOREACH(rosbag::MessageInstance const m, view){
  if (m.isType<...>()){ ... }
  else if (m.isType<...>()){ ... }
  else if (m.isType<>(gps_common::GPSFix)){     //this never matches!
    ROS_INFO("inside GPS");   
  }    
}

My includes are -

#include "sensor_msgs/NavSatFix.h"
#include "sensor_msgs/NavSatStatus.h"
#include "gps_common/GPSFix.h"
#include "gps_common/GPSStatus.h"

When I echo the message type:

ROS_INFO("messageInstance: Topic: %s ", m.getDataType().c_str());

I can see -

[ INFO] [1302536886.734404934]: messageInstance: Topic: gps_common/GPSFix 
[ INFO] [1302536886.819590013]: messageInstance: Topic: gps_common/GPSFix 
[ INFO] [1302536886.826344633]: messageInstance: Topic: gps_common/GPSFix