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

Revision history [back]

click to hide/show revision 1
initial version

The short answer to your question is

rosparam get robot_config/<side>_config/joint_names

where <side> is either left or right, depending on your arm of interest.

The longer answer is that Baxter's interface allows for you to specify the joints in the order that you desire when commanding a JointCommand: https://github.com/RethinkRobotics/baxter_common/blob/master/baxter_core_msgs/msg/JointCommand.msg

int32 mode
float64[] command
string[]  names

int32 POSITION_MODE=1
int32 VELOCITY_MODE=2
int32 TORQUE_MODE=3
int32 RAW_POSITION_MODE=4

Simply populate the joint_names array in the same order that you populate your command array, eg.

Python

from baxter_core_msgs.msg import JointCommand
...
cmd = JointCommand()
cmd.mode = JointCommand.POSITION_MODE
cmd.names = ["right_s0", "right_s1", "right_e0", "right_e1", "right_w0", "right_w1", "right_w2"]
cmd.command = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

C++

#include <baxter_core_msgs/JointCommand.h>
...
baxter_core_msgs::JointCommand cmd;
cmd.mode = baxter_core_msgs::JointCommand.POSITION_MODE
cmd.names.push_back("left_s0");
cmd.names.push_back("left_s1");
cmd.names.push_back("left_e0");
cmd.names.push_back("left_e1");
cmd.names.push_back("left_w0");
cmd.names.push_back("left_w1");
cmd.names.push_back("left_w2");
cmd.command.resize(cmd.names.size());
for(size_t i = 0; i < cmd.names.size(); i++)
  cmd.command[i] = 0.0;

Admittedly in both of those examples, I preserved the joint ordering from proximal to distal, but that is not necessary. The commands are reordered based on joint names once they are received by the MotorController.

The short answer to your question is

rosparam get robot_config/<side>_config/joint_names

where <side> is either left or right, depending on your arm of interest.

The longer answer is that Baxter's interface allows for you to specify the joints in the order that you desire when commanding a JointCommand: https://github.com/RethinkRobotics/baxter_common/blob/master/baxter_core_msgs/msg/JointCommand.msg

int32 mode
float64[] command
string[]  names

int32 POSITION_MODE=1
int32 VELOCITY_MODE=2
int32 TORQUE_MODE=3
int32 RAW_POSITION_MODE=4

Simply populate the joint_names array in the same order that you populate your command array, eg.

Python

from baxter_core_msgs.msg import JointCommand
...
cmd = JointCommand()
cmd.mode = JointCommand.POSITION_MODE
cmd.names = ["right_s0", "right_s1", "right_e0", "right_e1", "right_w0", "right_w1", "right_w2"]
cmd.command = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

C++

#include <baxter_core_msgs/JointCommand.h>
...
baxter_core_msgs::JointCommand cmd;
cmd.mode = baxter_core_msgs::JointCommand.POSITION_MODE
cmd.names.push_back("left_s0");
cmd.names.push_back("left_s1");
cmd.names.push_back("left_e0");
cmd.names.push_back("left_e1");
cmd.names.push_back("left_w0");
cmd.names.push_back("left_w1");
cmd.names.push_back("left_w2");
cmd.command.resize(cmd.names.size());
for(size_t i = 0; i < cmd.names.size(); i++)
  cmd.command[i] = 0.0;

Admittedly in both of those examples, I preserved the joint ordering from proximal to distal, but that is not necessary. The commands are reordered based on joint names once they are received by the MotorController.