ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The vectors containing position, velocity and effort default to a size of zero. You either have to use push_back
or resize the vectors before writing to them.
sensor_msgs::JointState joint;
joint.position.push_back(50);
joint.velocity.push_back(100);
joint.effort.push_back(90);
or
sensor_msgs::JointState joint;
joint.position.resize(1);
joint.velocity.resize(1);
joint.effort.resize(1);
joint.position[0] = 50;
joint.velocity[0] = 100;
joint.effort[0] = 90;