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

Revision history [back]

It works, apart that there's a compilation error on the callback. If you write:

std::cout << "I received: " << msg->points.back().x << std::endl;

instead, you get 49. Not sure if that's what you want.

It works, apart that there's a compilation error on the callback. If you write:

std::cout << "I received: " << msg->points.back().x << std::endl;

instead, you get 49. Not sure if that's what you want.

UPDATE All is fine here; it just turns out that the x coordinate is constant for every point; the snake-like movement only requires to change y and z. Just print the hole first and last points and you will notice all is fine:

std::cout << "I received: " << msg->points.front() << " ..."  << msg->points.back() << std::endl;

Btw, you see the whole point because geometric_msgs/Point objects (and all ROS messages) are serialized as yaml, and so shown on std::cout.