0
$\begingroup$

Rosanswers logo

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.


Originally posted by adamconkey on ROS Answers with karma: 642 on 2016-09-06

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The short answer to your question is

rosparam get robot_config/<side>_config/joint_names

where 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]

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.


Originally posted by imcmahon with karma: 790 on 2016-09-06

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.