Skip to content
Dr. Juan Rojas edited this page Apr 16, 2021 · 11 revisions

Welcome to the BIRL repository, birl_baxter wiki!

Our code currently uses ROS Noetic and Ubuntu 20.04. Please take a look at all of our demos. However, the instructions below were set for Indigo. There should be small changes to Noetic.

  • i.e. update shebang line from #!/usr/bin/env python2 to #!/usr/bin/env python3
  • i.e. change cmake_minimum_required(VERSION 3.0.2) in CMakeLists.txt
  • i.e. may need to update python's xrange to range or dict's viewitems() to items()

To use this repo, please follow the following Installation Instructions.

Installation Instructions

This repo makes heave use of the RethinkRobotics repo for Baxter. Below are instructions to install the general code.

Dependencies

Our repository has a growing number of dependencies. Please realize that this list may be outdated. Though we try to keep it up to date.

Source Repo's

The following repositories need to be placed in a working ROS workspace(s) (see the following link for a tutorial: http://wiki.ros.org/catkin/Tutorials/create_a_workspace).

We recommend placing all workspaces in a folder called ~/ros/yourdistro, such as: ~/ros/noetic/catkin_ws.

You will also need git (sudo apt-get install git) to clone the repos. After you have cloned them, you will need to run catkin_make from the top of your workspace (i.e. ./baxter_ws) after that you need to source your workspace (source ./baxter_ws/devel/setup.sh).

(1) RBX Workspace (code from the book ROS-By-Example)

  • Set the rbx code in catkin_ws as shown below,
  • git clone two repositories for rbx1 and rbx2, and
  • catkin_make from the top of the workspace
cd ~/ros/noetic/catkin_ws
(if not created then, mkdir -p catkin_ws/src)
source /opt/ros/noetic/setup.bash
git clone https://github.com/pirobot/rbx1.git 
git clone https://github.com/pirobot/rbx2.git 
cd ..
catkin_make
  • Finally, after doing catkin_make, place the newly created ~/ros/indigo/catkin_ws/devel/setup.bash file inside .bashrc
cd ~
emacs .bashrc (emacs is an editor, you can chose your favorite editor as you like i.e. gedit )
source ~/ros/noetic/rbx_ws/devel/setup.bash
  • Exit the emacs editor Cx+Cc
  • re-source the .bashrc file in all your terminals:
source ~/.bashrc

(2) Catkin Simple (program for making code simpler than catkin_make)

  • Place caktin_simple in your catkin_ws as shown below,
  • git clone the repository
  • catkin_make
cd ~/ros/indigo/catkin_ws/src
git clone https://github.com/catkin/catkin_simple 
cd ..
catkin_make

cd ~
emacs .bashrc
source ~/ros/noetic/catkin_ws/devel/setup.bash
  • Exit the emacs editor Cx+Cc
  • re-source the .bashrc file in all your terminals:
source ~/.bashrc

Binaries

All binaries can be conveniently downloaded through a script. Do as follows:

  1. Get the file and download it.
wget https://raw.githubusercontent.com/birlrobotics/birl_baxter/master/birl-prereq.sh
  1. Execute it:
sh birl-prereq.sh

Create the Baxter Workspace

  • We recommend to create a baxter workspace in which to place all baxter related code (rethink robotics code and our code). If you are starting from scratch do the following:
$ cd
$ mkdir -p ros/noetic/baxter_ws/src
$ cd ros/noetic/baxter_ws
$ source ~/ros/noetic/catkin_ws/devel/setup.bash (this is to overlay the workspace)
$ catkin_make

CATKIN_MAKE NOTES

  • If you only want to build one (or selected packages), say the force_controller use the following flag:
catkin_make -DCATKIN_WHITELIST_PACKAGES="force_controller" 
  • if you want to catkin_make all packages after you used the flag:
catkin_make -DCATKIN_WHITELIST_PACKAGES="" 

If you want to ignore a package, go to that package and create a file called CATKIN_IGNORE. An easy way to do that is using the editor touch. For example:

roscd _package_name_
touch CATKIN_IGNORE
  • After this, catkin make will have created two additional folders under baxter_ws: devel/ and build/
  • Inside the devel/ folder you will find a few setup files: setup.bash is meant to be sourced inside .bashrc, setup.sh is meant to be sourced manually in any terminal. These setup files help ROS find any nodes, launch files, message files, action files, or service files in your packages.
  • You always want to source the setup.bash file in the .bashrc file located in ~/ so that all terminals can find ROS commands. This can be done with the following general commands:
$ cd
$ gedit .bashrc                                  # go to the last line of the file and type:
source ~/ros/noetic/baxter_ws/devel/setup.bash
  • Close the file
  • In the same terminal, reload the .bashrc file by typing:
source .bashrc

You can also set a shortcut to your favorite ROS Workspace. A shortcut can be used by typing 'roscd'. This command will take you to the predefined workspace immediately. To set it up, we need to assign a path for the environment variable ROS_WORKSPACE in the .bashrc file:

export ROS_WORKSPACE=~/ros/noetic/baxter_ws/src               # go to the last line of the file and place it there.

Install Baxter's General Code

  • To install Baxter's general code, follow the instructions starting on Step 3. You will want to place all the baxter files inside the "baxter_ws/src" folder you created earlier and not the ros_ws folder as the instructions state.

Note: Do not start earlier as this is a slightly different setup: Step 3 Instructions: http://sdk.rethinkrobotics.com/wiki/Workstation_Setup#Step_3:_Create_Baxter_Development_Workspace.

  • At the end, your file structure should look like this:
../baxter_ws/src:
  |__ baxter
  |__ baxter_common
  |__ baxter_examples
  |__ baxter_interface
  |__ baxter_tools
  |__ CMakeLists.txt
  • Make sure that after you have cloned the repositories through wstool update that you:
  1. do catkin_make from the top of the workspace (and that you can make without any errors)
  2. include the setup.bash of this workspace in the .bashrc file as we did earlier in this wiki.

Install the Baxter Simulator

  1. do catkin_make (again) from the top of the workspace (and that you can make without any errors)
  2. resource ~/.bashrc in all your terminals. This ensures that the newest code can be read in the terminals.

Downloading Gazebo Models

  • Before Gazebo can be visualized properly, we will also need to download some gazebo models form the net.
  • We will use the wget tool to download them and place them in the folder of your choice, standard folder is .gazebo/models folder.
$ cd 
$ cd .gazebo            # don't miss the dot, it indicates it's a hidden folder.
$ ls                    # you should see a models folder, if not, create it.
$ cd models
$  git clone https://github.com/osrf/gazebo_models.git            # downloads all the models automatically. 

Now we need to update Gazebo's environment path variable to look into this new location. To do so you will set the new path in the .bashrc file. You can do so in the last line of the file

emacs ~/.bashrc
export GAZEBO_MODEL_PATH=[...]/models:$GAZEBO_MODEL_PATH  # append new path to existing path

birlBaxter_* Repositories

  • For the birl_baxter repo, create a folder called birl_baxter inside the ~/ros/noetic/catkin_ws/src folder:
$ mkdir birl_baxter
$ cd birl_baxter
  • The birlBaxter_* repositories like the baxter repo is also composed of many repo's. Our repos contain in-house code used with Baxter: tools, sensors, controllers, heuristics,etc.
  • Download and update code with the following 3 step approach:
$ wstool init . # creates an empty .rosinstall file
$ wstool merge https://raw.githubusercontent.com/birlrobotics/birl_baxter/master/birl_baxter.rosinstall
$ wstool update # will call git pull on all relevant repo's.

Now we need to remake this workspace:

$ cd ~/ros/noetic/catkin_ws/
$ catkin_make

You can now resource the .bashrc file which is overlayed with the catkin_ws to access your ROS packages

$ cd
source .bashrc

Errors

  • You may get errors in a few of the demos. Some typical errors are as follows:
  1. Errors inside one of the packages in the demos folder. The demos folder is a growing folder with projects from different students. Sometimes its easy to miss a dependency. catkin_make may give you a clue as to what binary or library may be missing. You can try to get it, either through git clone the_right_url or as a binary: sudo apt-get install the_right_binary_name
  2. If you cannot figure the above step up, place a file named CATKIN_IGNORE inside the package that is giving you problems. This will make catkin_make skip over that package.
  • Finally, remember that you just remade the workspace, and you always need to re-source ~/.bashrc to capture your latest changes, this time for the birl_baxter repo.
  • And, just to make sure, your ~/.bashrc file should have at least the following two lines:
source /opt/ros/indigo/setup.bash
source ~/ros/indigo/baxter_ws/setup.bash
  • To re-source you can run on the same terminal you are working with: source ~/ros/indigo/baxter_ws/devel/setup.sh; or you can close that terminal and open a new one.
  • To test if the packages inside birl_baxter can be seen by ROS try the following:
$ roslaunch baxter_worlds display_baxter.launch
  • If it works, you should see RVIZ open and display baxter inside. Afterwards, kill it with Ctrl+C, and then try:
roslaunch baxter_gazebo baxter_world.launch
  • Here Gazebo will also open.
  • Test controllers and a few demos running the instructions on this section.

Learning About Baxter

  • Best place to start is at the RethinkRobotics wiki page.
  • In particular, you want to learn the Baxter Interface very well. You will use it for all interactions with Baxter.
  • The API is also important to be familiar with and their GitHub page is here
  • Become familiar with the overall structure of the Repository.
  • Also, in the Advanced Section, you want to learn all there is to know about the Arm Control Systems.

Examples

  • Rethink Robotics offer a number of demos that you can try here.
  • Their community page also offers many examples.
  • At our Biomimetics and Intelligent Robotics Lab (BIRL) we will also be expanding our code found in our GitHub page here.