ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
In C++ ROS messages, variable-sized arrays are implemented as a std::vector
, which start with a size of 0. You're probably getting a segmentation fault because you're trying to use an array index that is out of bounds.
You should probably call resize()
to set the size of the points array:
destination.points.resize(1);
If you're interested in learning more about the std::vector, my favorite reference is http://www.cplusplus.com/reference/vector/vector/