ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
There are two errors in your code that you'll need to fix to get this going.
The first is you're trying to put a vector of double (64 bit float) values into a float32MultiArray
.
The second more important problem is that you're not adding the three theta values into the vec array correctly. You are not setting its size or using push_back to add the elements so the size of the vector is still zero and you're assigning values to allocated memory. This means that your later code is simply adding a zero length vector to the MultiArray message. If you use the code below and change the declaration of vec to std::vector<float> vec;
then this should start working.
vec.push_back(theta1);
vec.push_back(theta2);
vec.push_back(theta3);
Hope this helps.
2 | No.2 Revision |
There are two errors in your code that you'll need to fix to get this going.
The first is you're trying to put a vector of double (64 bit float) values into a float32MultiArray
.
The second more important problem is that you're not adding the three theta values into the vec array correctly. You are not setting its size or using push_back to add the elements so the size of the vector is still zero and you're assigning values to allocated un-allocated memory. This means that your later code is simply adding a zero length vector to the MultiArray message. If you use the code below and change the declaration of vec to std::vector<float> vec;
then this should start working.
vec.push_back(theta1);
vec.push_back(theta2);
vec.push_back(theta3);
Hope this helps.