# Revision history [back]

I think I figured out what your mistake is. The 4th argument in the n.subscribe method should be the context in which the callback should be called.

ros::Subscriber ComPose_sub = n.subscribe("/RosAria/pose", 1000, &PioneerData::ComPoseCallback, PioneerData);


you should first instantiate the PioneerData class like this.

PioneerData pioneerData;


Then call the subscriber method with a pointer to the object instance.

ros::Subscriber ComPose_sub = n.subscribe("/RosAria/pose", 1000, &PioneerData::ComPoseCallback, &pioneerData);


It should work. Let me know if it doesn't.

I think I figured out what your mistake is. The 4th argument in the n.subscribe method should be the context in which the callback should be called.

ros::Subscriber ComPose_sub = n.subscribe("/RosAria/pose", 1000, &PioneerData::ComPoseCallback, PioneerData);


you should first instantiate the PioneerData class like this.

PioneerData pioneerData;


Then call the subscriber method with a pointer to the object instance.

ros::Subscriber ComPose_sub = n.subscribe("/RosAria/pose", 1000, &PioneerData::ComPoseCallback, &pioneerData);


It should work. Let me know if it doesn't.

EDIT

Also, your ComPoseCallback method definition should be changed to

void PioneerData::ComPoseCallback(const nav_msgs::Odometry::ConstPtr& msg)  { ...