Ask Your Question
0

Ordered list of joint parameters for Baxter

asked 2016-09-06 13:15:29 -0600

I am trying to adapt the code in this tutorial for moving an arm using Joint Trajectory Action; they use PR2 and it's written in C++, I'm using Baxter and my code is in Python. They have a command that lists all the joints and the order the parameters should be in: rosparam get /r_arm_controller/joints which displays

[r_shoulder_pan_joint, r_shoulder_lift_joint, r_upper_arm_roll_joint, r_elbow_flex_joint, r_forearm_roll_joint, r_wrist_flex_joint, r_wrist_roll_joint]

What is the analagous command for Baxter? When I do rosparam list I see essentially a controller for each individual joint. I want to get the ordered list of all joints so I can specify waypoints correctly.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-09-06 21:12:44 -0600

imcmahon gravatar image

updated 2016-09-06 21:14:06 -0600

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/ba...

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]

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2016-09-06 13:15:29 -0600

Seen: 123 times

Last updated: Sep 06 '16