ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Here's an example that does work. I'm guessing your problem is that in this chunk data.data[i]=i;
you have not told the computer that the data.data
vector should have 5 entries. So you are trying to access uninitialized memory. You should likely be using something like push_back
or data.data.resize(5);
before your for
loop in the publisher.
If you look at the example above, you'll see that I use push_back
on Float32MultiArray.layout
to set the size of that vector, and then I use std::vector::resize
to resize a vector that will contain the data I'm trying to publish (which I eventually set equal to Float32MultiArray.data
).
Side note, I believe the exit code -11
is coming from Python's subprocess poll function which, according to that link, would indicate your program exiting due to a signal 11. Note, roslaunch
is written in Python and uses the subprocess
module to run nodes. This would correspond to a SIGSEGV
-- which is an invalid memory reference. This is consistent with my previous comment.