Unitended change of message content
Hi there,
I am running ROS Melodic on an Ubuntu 16.04 64-bit machine. While processing odometry messages from a rosbag file in a single node, I could not receive the expected output.
While debugging my code I published the incoming odometry messages to a separate topic and used PlotJuggler to compare them to the messages on the original topic. The plot shows that incoming and outgoing values are not equal. Due to missing karma points I cannot upload a screenshot. The code to reproduce is below. What am I missing here?
Thanks in advance!
class OdomCollector
{
public:
OdomCollector()
{
this->node = new ros::NodeHandle();
this->publisher = this->node->advertise<nav_msgs::Odometry>("odom_buffered", 10, true);
this->subscriber = this->node->subscribe("odom", 50, &OdomCollector::storeCallback, this);
}
// data members
std::vector<nav_msgs::Odometry::Ptr> inMsgs;
// object members
ros::NodeHandle *node;
ros::Publisher publisher;
ros::Subscriber subscriber;
// member functions()
void storeCallback(const nav_msgs::OdometryPtr &inMsg)
{
this->publisher.publish(inMsg);
}
void publish()
{
// stumb
}
};
int main(int argc, char **argv)
{
ros::init(argc, argv, "Odom_Collector");
OdomCollector collector;
// loop
ROS_INFO("Odom_Collector Node up and running");
ros::spin();
return 0;
}
Edit: Here a screenshot from PlotJuggler, showing how the points in the topic odom_buffered give roughly the same course for the graph, but not resemble the original points. I wrote the same node in python with the same result. If a copy of rostopic echo provides any additional info, I can provide that as well.
Showing code is not going to be sufficient here. Please show at least a few messages from
rostopic echo
, clearly indicating the differences between what you expect and what you see.I've also given you sufficient karma to attach a screenshot, but please note that screenshots of terminals and code are not needed nor desirable: you can just copy-paste the text into your question.