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

Revision history [back]

click to hide/show revision 1
initial version

This looks more like a C++ issue:

visualization_msgs::Marker markers_msg;
...
markers_msg.points[0].x = 0.0f;
markers_msg.points[0].y = 0.0f;
markers_msg.points[0].z = 0.0f;
markers_msg.points[1].x = 1.0f;
markers_msg.points[1].y = 1.0f;
markers_msg.points[1].z = 1.0f;

marker_msgs.points is a std::vector. You don't seem to resize(..) or reserve(..) any elements, so markers_msg.points[1] almost certainly indexes into uninitialised memory.

The [] operator does not perform any bounds checking, so you don't get any errors, but it does cause undefined behaviour.