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

Revision history [back]

ax12_driver_core::MotorStateList contains an array of ax12_driver_core::MotorState messages. In C++, ROS arrays are converted to C++ std::vector.

To print the motor position of the first MotorState in the array you might use something like:

ROS_INFO("I heard : %d", msg->motor_states[0].position;);

You might want to also check that motor_states vector has at least 1 element :

if (msg->motor_states.size() > 0)

ax12_driver_core::MotorStateList contains an array of ax12_driver_core::MotorState messages. In C++, ROS arrays are converted to C++ std::vector.

To print the motor position of the first MotorState in the array you might use something like:

ROS_INFO("I heard : %d", msg->motor_states[0].position;);

msg->motor_states[0].position;);

You might want to also check that motor_states vector has at least 1 element :

if (msg->motor_states.size() > 0)

0)