Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Extract Header from ShapeShifter

I'm trying to implement something similar to rospy.anymessage via roscpp. I am using Shapeshifter to extract the data. I only need the Header.stamp (I want to compare received time from the time the topic was published).

I'm running into a wall trying to extract the header stamp. I know rosbag imeplement something liek this, but I could only find they use SubscriptionCallbackHelperT, but not how.

How can I extract the Header.stamp from a generic ros topic message?

void PerformanceTracker::topicCallback(const ShapeShifter::ConstPtr topicType){
   ros::Time begin = ros::Time::now();
   unsigned char* data = ShapeShifterGetData(topicType);
}

unsigned char* ShapeShifterGetData(const ShapeShifter::ConstPtr message){
  unsigned char* data = new unsigned char[message->size()];
  std::OStream stream(data, message->size());
  message->write(stream);
  return data;
}

Extract Header from ShapeShifter

I'm trying to implement something similar to rospy.anymessage via roscpp. I am using Shapeshifter to extract the data. I only need the Header.stamp (I want to compare received time from the time the topic was published).

I'm running into a wall trying to extract the header stamp. I know rosbag imeplement something liek like this, but I could only find they use SubscriptionCallbackHelperT, but not how.

How can I extract the Header.stamp from a generic ros topic message?

void PerformanceTracker::topicCallback(const ShapeShifter::ConstPtr topicType){
   ros::Time begin = ros::Time::now();
   unsigned char* data = ShapeShifterGetData(topicType);
}

unsigned char* ShapeShifterGetData(const ShapeShifter::ConstPtr message){
  unsigned char* data = new unsigned char[message->size()];
  std::OStream stream(data, message->size());
  message->write(stream);
  return data;
}