Introduction to Baxter and Sawyer
Overview
The Baxter and Sawyer robots from Rethink Robotics are manufacturing robots designed to operate around people. Both robots use series elastic actuators (SEAs) in all their joints, meaning that there is an elastic element (e.g., a spring) between the gearbox and the joint. These actuators add mechanical compliance, enabling easier force control at the expense of position control bandwidth.
Documentation
Summary
- Arms
- Baxter: Two arms, each with seven degrees of freedom (DOF)
- Sawyer: One arm with seven degrees of freedom
- Series elastic actuators at each joint
- Accurate joint torque measurements (when calibrated)
- Head
- Pan/tilt ability
- Built in camera
- Display
- Control
- On-board computer running Gentoo Linux and ROS Kinetic
- Can run ROS nodes remotely or on-board
- Low-level controllers prevent self-collisions and enforce limits on acceleration, torque, and position.
- Buttons on arm and grippers.
- Zero-g mode: when enabled you can grab the cuff of an arm and move it anywhere
- Distance sensors
- Infrared distance sensor in the hand
- Baxter: Sonar ring around head
- Cameras
- One camera per hand
- One camera in the head
- Baxter has three cameras, but you can only stream from two simultaneously
- Grippers
- Interchangeable grippers and jaws
- We use electric grippers, but vacuum grippers are also available
- Custom grippers are possible as well
Setup
- Baxter and Sawyer run
rosmaster
on their onboard computers. - You run nodes on your computer that communicate with the remote
rosmaster
- It is also possible to have nodes run on Baxter or Sawyer
- However, we do not have root access to these robots and can't install packages
- For most of our purposes, running our custom nodes on our own computers is fine.
Installation
- The Baxter and Sawyer software is not released for
noetic
and in fact dates back to ROSindigo
- Some code, especially for
baxter
has to be patched to work.- Some code comes from forked repositories, with fixes to make it compile on Ubuntu 20.04 with
noetic
- The code is written in python 2. I have done my best to patch it to work with python3, however if you run into python issues let me know.
- Some code comes from forked repositories, with fixes to make it compile on Ubuntu 20.04 with
- We will create another workspace, similar to
nuws
but exclusively for the Baxter and Sawyer robots- You may wish to source this workspace from your
.bashrc
to have the packages accessible.
- You may wish to source this workspace from your
mkdir -p rethink_ws/src cd rethink_ws/src vcs import --input https://nu-msr.github.io/me495_site/rethink.rosinstall cd .. # Install dependencies, but ignore any errors rosdep install --from-paths src --ignore-src -r -y catkin_make
Network
- You will connect to the robot via Ethernet. First, some one-time setup to install the profile
# Download the Network manager profile curl -L https://nu-msr.github.io/me495_site/Rethink > /tmp/Rethink sudo cp /tmp/Rethink /etc/NetworkManager/system-connections/Rethink # Set the ownership and permissions sudo chown root:root /etc/NetworkManager/system-connections/Rethink sudo chmod 600 /etc/NetworkManager/system-connections/Rethink # Reload network manager sudo systemctl restart NetworkManager # Append the IP address to your hosts file. This way you can resolve baxter.local and sawyer.local on your machine echo "10.42.0.2 baxter.local" | sudo tee -a /etc/hosts echo "10.42.0.2 sawyer.local" | sudo tee -a /etc/hosts
- With the robot on and the ethernet cord plugged in, you can connect to the robot by doing
nmcli connection up Rethink
- The IP address of the robot is
10.42.0.2
and your IP address is10.42.0.1
- You should be able to ping
10.42.0.2
. If not, something is wrong. - You should also be able to ping
sawyer.local
andbaxter.local
- You should be able to ping
- To have nodes on your computer connect to the remote
rosmaster
:- The
ROS_MASTER_URI
environment variable must be set to the robot's rosmaster uri:http://10.42.0.2:11311
- This variable tells ROS nodes how to connect to
rosmaster
- This variable tells ROS nodes how to connect to
- The
ROS_IP
environment variable should be the ip address of your computer (10.42.0.1
).- This variable tells
rosmaster
how to connect to your computer
- This variable tells
- The
ROS_HOSTNAME
environment variable should NOT be setunset ROS_HOSTNAME
Feel free to write a
bash
script that you can source to set these environment variables appropriatelyexport ROS_MASTER_URI=http://10.42.0.2:11311 export ROS_IP=10.42.0.1 unset ROS_HOSTNAME
- If you read Rethink's instructions, they provide a script that sets these variables for you. I don't like everything it does so I just use my own script.
- The
Testing Your Setup
- Make sure you can ping 10.42.0.2,
baxter.local
andsawyer.local
. Set your environment variables:
export ROS_MASTER_URI=http://10.42.0.2:11311 export ROS_IP=10.42.0.1 unset ROS_HOSTNAME
- Source the rethink workspace:
source rethink_ws/devel/setup.bash
- When you run
rosnode list
you should see a bunch of nodes running on the baxter/sawyer - Echo joint states:
rostopic echo /robot/joint_states
- You should see joint states printed to the screen
- Enable the robot
- Baxter:
rosrun baxter_tools enable_robot.py -e
- Sawyer:
rosrun intera_interface enable_robot.py -e
- Baxter:
- Disable the robot
- Baxter:
rosrun baxter_tools enable_robot.py -d
- Sawyer:
rosrun intera_interface enable_robot.py -d
- Baxter:
Advanced Networking
SSH
- You cannot ssh into the
sawyer
, Rethink has it locked down - You can ssh into the baxter. Username
ruser
passwordrethink
.- You do not (and usually should not) ssh in to run the robot
FSM
- The field-service menu lets you change network settings on the baxter and the sawyer
- Students: Do not modify these settings without asking me first!
- Currently, it seems that ROS_IP mode on the robots does not work. I suspect that the ROS_MASTER_URI is set to
sawyer.local
orbaxter.local
on the robot, which means that, regardless of anything else, your computer must be able to resolve those addresses to receive messages from the robot
Using the Robots
- Whenever you are using the robots, be ready to press the E-Stop to prevent the robot from crashing into anything.
- Each robot has a power button. Press it once to turn on, once to turn off; never hold the power button.
- Each robot takes a very long time to boot up so be patient. You should leave the robots on most of the time, but
if the robot is being left unattended it MUST be disabled.
- For Baxter:
rosrun baxter_tools enable_robot.py -d
disables the robot. - For Sawyer:
rosrun intera_interface enable_robot.py -d
disables the robot.
- For Baxter:
- If you wish to move the robot arms manually, you should enable them and use zero-g mode:
- For Baxter:
rosrun baxter_tools enable_robot.py -e
enables the robot, then squeezing the cuff starts zero-g mode. - For Sawyer:
rosrun intera_interface enable_robot.py -e
enables the robot. Squeezing the cuff or pressing the O button starts zero-g mode.- The cuff does not always work.
- In zero-g mode the arm should be easy to move and you should not here any winding or feel resistance.
- For Baxter:
- If the E-stop is pressed, you need to release the e-stop by twisting and reset the robot
- For Baxter:
rosrun baxter_tools enable_robot.py -r
- For Sawyer:
rosrun intera_interface enable_robot.py -r
- For Baxter:
Programming the Robots
Sawyer and Baxter are programmed using very similar interfaces; therefore, information for one robot often applies to the other. Especially relevant is that much of the Baxter ROS API documentation applies to sawyer as well.
Note: if you have your ROS_MASTER_URI
and ROS_IP
setup correctly you can ignore parts about running baxter.sh
or the RSDK shell
Baxter
- Baxter Physical Hardware
- Baxter SDK Wiki
- Foundations of Baxter gives a broad overview of the various Baxter programming possibilities
- Baxter SDK overview
- Baxter API Reference useful python API for controlling baxter
- Baxter ROS API Reference control baxter with ros messages and services
- Baxter Advanced Understanding (Not too advanced for you!)
Sawyer
URDF for Baxter and Sawyer
- Each robot has an internal URDF, with parameters that have been factory calibrated to account for manufacturing tolerances.
- This URDF is stored in
/robot_description
in the parameter server.
- This URDF is stored in
- Generic URDFs are available:
- For Baxter:
baxter_description
package (from thebaxter_common
git repo) - For Sawyer:
sawyer_robot_package
- For Baxter:
- Two
robot_state_publishers
are used to publish the commanded and the real pose of the robot- See https://sdk.rethinkrobotics.com/wiki/URDF (Applies to Baxter and Sawyer)
- The robots actually run a Mutable Robot State Publisher
- When grippers are added, the URDF changes
- The Mutable Robot State publisher subscribes to
/robot/urdf
and can have pieces of the URDF modified in real time.
- When using grippers, you should update the URDF to properly account for the gripper. We use electric grippers.
- For Baxter:
rethink_ee_description
package in thebaxter_common
repository has URDF files for each gripper. - For Sawyer:
intera_common
contains theintera_tools_description
package. - An example that adds a gripper to the baxter urdf can be found here.
- This example is used on the Willen's Wing Baxter
- The launch file calls a bash script which uses Rethink's
send_urdf_fragment.py
to update the urdf. - The gripper xacro file was adjusted to exactly match our gripper (see this commit)
- When using MoveIt, you need to make sure your grippers are setup properly
- For Baxter:
Simulators
- Baxter Gazebo
- Note: you do not need to actually run baxter.sh to use the simulator.
- baxter.sh is an example of the Rethink Setup script that I do not use because I set my ROS environment variables manually
roslaunch baxter_gazebo baxter_world.launch
- Sawyer Gazebo Tutorial
roslaunch sawyer_gazebo sawyer_world.launch
- The simulated robots use the same API's as the real robots.
However, your
ROS_MASTER_URI
should behttp://localhost:11311
andROS_IP
unset for you to use the simulator. - Do not run gazebo while connected to the robots, especially if your
ROS_MASTER_URI
is set to the robot's IP- This will attempt to run Gazebo on the robots themselves, which may require you to restart the robot in order to connect to it
Series Elastic Actuators
The Baxter and Sawyer robots use Series Elastic Actuators (SEAs) at each joint. In a series elastic actuator, the motor drives a gearbox which is then connected to the joint via a spring (rather than via a stiff rigid link, as in a traditional actuator). This design sacrifices bandwidth in exchange for robustness and more precise force control.
For example, rather than requiring a precise motor/gearbox model to estimate joint torque from motor current estimates, with a series elastic actuator joint torque can determined by measuring the displacement of the elastic element. Additionally, controlling joint torque can be accomplished by controlling position (i.e, the displacement of the elastic element).
Thought Experiments
Regular Actuator
Imagine you are holding a solid steel rod. The rod is stiff. As you move the rod around, its tip remains fixed relative to where your hand is; it does not bounce around. The tip remains steady even if you move your hand really fast. Thus, you have high bandwidth and high precision control of the rod tip.
Now imagine that you want drag the rod along the wall. You move the rod against the wall. However, what if your position measurement is slightly imprecise? You think the rod tip is 0.001 inches away from the wall when it is actually touching. Your controller will continue to try to move that extra 0.001 inches, pushing into the wall. To accomplish this task the stiff rod (or the wall) will need to deform by 0.001 inches; however, because they are stiff this deformation requires a lot of force, which you will feel in your hand. Thus, a small error in position can cause a large force on the motor (your hand).
Series Elastic Actuator
Now imagine that the tip of the rod is connected to your hand via a spring. As you move your hand around, the tip will bounce around on the spring, unless you move really slowly. Thus you experience lower positional bandwidth and precision for the location of the rod tip.
However, when you go to move the rod against the wall, as soon as you make contact the spring will start to compress. Thus, even if your position controller thinks the tip is 0.001 inches away from the wall when it is actually touching, it can move the extra 0.001 inch easily: the spring will simply compress an amount according to its stiffness (assumed to be significantly less than the stiff rod). Furthermore, measuring the spring's displacement will tell you the applied force.
MoveIt for Baxter and Sawyer
- Baxter MoveIt
- Baxter's moveit configuration is in the
moveit_robots
package- Clone into your source space from
https://github.com/ros-planning/moveit_robots.git
- Configuration and launch files are located in (respectively):
- moveit_robots/baxter/baxter_moveit_config/config
moveit_robots/baxter/baxter_moveit_config/launch
- You may need to disable the robot then enable it for moveit to work
- Clone into your source space from
- Sawyer MoveIt
- Sawyer's moveit configuration is in the
sawyer_movit
package- Clone into your source space from
https://github.com/RethinkRobotics/sawyer_moveit.git
- Configuration and launch files are located in (respectively):
sawyer_moveit_config/config
sawyer_moveit_config/launch
- Configuration and launch files are located in (respectively):
- Clone into your source space from
- As your project progresses, you may wish to fork their repository and modify some of the configuration files to tweak moveit settings
- If your project has multiple repositories in your source space, you should create a
repos
file usingvcs export
and add it to your main git repository - You may also copy some of these files (with attribution) to keep your project in a single git repository
- If you go with this option, only take the files you need to modify
- Unlike most other cases, your modifications are likely only useful for your particular project so contributing to upstream does not make sense
- Having the files in your own project will make it harder to incorporate beneficial changes from upstream
- If your project has multiple repositories in your source space, you should create a
Important Configuration Files
baxter.srdf.xacro
/sawyer.srdf.xacro
: Defines several "move groups", groups of joints that are controlled and planned for together. It requires several arguments to configure properly (for example, what grippers are installed)- The
srdf
must match theurdf
being used bybaxter=/=sawyer
. - The
urdf
is changed using themutable_robot_state_publisher
depending on the status of its grippers. - If the
urdf
andsrdf
are not in sync, you will have the grippers constantly in collision with the last arm joint and be unable to motion plan (that is at least one negative affect)
- The
kinematics.yaml
Provides options for the IK solvers. Bothbaxter
andsawyer
can use either IKFast or KDL but use KDL by default. To use a different solver, edit this fileompl_planning.yaml
Options for the motion planner. Many of these parameters require looking at theOMPL
source code to understand as they are not well documented.- The MoveIT setup assistant tweaks these parameters so it is also documented in its source code
- Baxter uses RRT Connect
- Sawyer's planner file also has good comments bout what the parameters do
- it used the default SBL planner
Launch Files
move_group.launch
is the main launch file that includes many of the other launch files and eventually loads the configuration- Do not expect the launch files to "just work".
- You may be able to get them to work by passing the proper parameters
- You may need to include these launch files in other launch files, or fork and modify them
- Gripper settings:
- Your URDF and SRDF must match with respect to the gripper settings to handle collisions properly
- For simulator, use arguments to
xacro
files, for real robots use themutable_robot_state_publisher
- Look at the arguments to the launchfile and adjust them for your situation
- One common problem is that the gripper configuration is not correct.
Grasped Mass
- Baxter (and Sawyer) can compensate for the weight of grasped objects. For Baxter see here. For Sawyer, assume it works like Baxter and do your best; it is not documented as far as I know.
Trajectory Execution Speed
- Especially at first, you will want your trajectories to move slowly
- Editing
joint_limits.yaml
is an effective hack for quick debugging, but ultimately that file should reflect the true capabilities of the robot. - There is a
/move_group/trajectory_execution/execution_velocity_scaling
that can be used to slow down a trajectory. It has been known not to work reliably however. - Time Parameterization of your trajectory can be used to slow down the speed of the trajectory. Here is some python API documentation:
Joint Trajectory Action Server
- To use MoveIt with sawyer or baxter, you will want to have the Joint Trajectory Action Server running
- This server must be explicitly run
- It may interfere with normal commands, so you may need to start and stop this server as needed if you wish to use a combination of rethink's API and moveit in your project
- The Joint Trajectory Action Server is part of the sawyer/baxter packages
Collision
- It is a good idea to put some basic collision objects in your planning scene, such as the table
- The easiest way is to use
moveit_commander.PlanningSceneInterface()
in python.- You can use this class to attach objects to the gripper once they've been picked up
- Thus, moveit can account for objects the robot is holding
- Baxter has demos for using the Asus
xtion
camera (withdemo_xtion.launch
) to find collisions in the environment- It is hopefully not to difficult to adjust for the RealSense, although we have
xtion
cameras as well
- It is hopefully not to difficult to adjust for the RealSense, although we have
Grasping
- MoveIt Has the ability to do grasping and pick and place.
- It is difficult to get this working and may or may not be worth the effort
- Recently released is a method that uses deep learning for planning grasps. Could be interesting
Fake Controller
- For a Kinematic simulation rather than needing gazebo you can use the Fake Controller package
- This enables you to use moveit without a separate action server.
- The movement will follow trajectory exactly and no dynamics are involved
- You can use this in conjunction with
rviz
to visualize and debug your robot without gazebo when working on kinematic tasks. - Baxter has demo_dummy.launch to help launch in this mode.
Debugging Checklist
- Is the Robot On?
- Is the ethernet cable plugged in?
- Is the network up with
nmcli con up Rethink
? - Can you ping the robot?
- Is the Rethink workspace sourced?
- Are the
ROS_IP
andROS_MASTER_URI
andROS_HOSTNAME
variables set properly? - Is the robot enabled?
- Check the
estop
- Check the robot state
enable_robot.py -s
- Check the
Moviet
- Is the
joint_trajectory_action_server
running? - Does the =SRDF and URDF match the actual robot
- Grippers must be accounted for using the
mutable_robot_state_publisher
- Grippers must be accounted for using the