To communicate with and command Baxter, we must establish the connection between your development PC and the robot and vice versa. Assuming proper [[Networking | network setup]], the RSDK shell refers to the a configuration of your [http://wiki.ros.org/ROS/EnvironmentVariables ROS environment] which points your PC to the [http://wiki.ros.org/Master ROS Master], while registering your IP or Hostname allowing other processes to find you.

+

To communicate with and command Baxter, we must establish the connection between your development PC and the robot. Assuming proper [[Networking | network setup]], the RSDK shell refers to the a configuration of your [http://wiki.ros.org/ROS/EnvironmentVariables ROS environment] which points your PC to the [http://wiki.ros.org/Master ROS Master], while registering your IP or Hostname allowing other processes to find you.

−

The SDK provides a convenient script, baxter.sh, which helps foster the quickest and easiest ROS environment setup to get communicating with Baxter. This script should have been installed/configured during [[Workstation_Setup | Getting Started - Workstation Setup Tutorial]], and the [[Hello_Baxter | Getting Started - Hello Baxter! Tutorial]]

+

+

The SDK provides a convenient script, <code> baxter.sh </code>, which helps foster the quickest and easiest ROS environment setup to get communicating with Baxter. This script should have been installed/configured during [[Workstation_Setup | Getting Started - Workstation Setup Tutorial]], and the [[Hello_Baxter | Getting Started - Hello Baxter! Tutorial]].

The baxter.sh script is a convenient script which allows for intuitive modification of the core ROS environment components. This user edited script will allow for the quickest and easiest ROS setup.

+

The baxter.sh script is a convenient script allowing users to get their ROS environment setup quickly. It should allow for intuitive modification of the core components to get communicating with Baxter setup quickly. It creates a heredoc which verifies all environment variables expected are provided, with a handy sim argument for local configurations (useful for simulation), and local argument (useful when SSH'd into Baxter with no need to communicate to external, off-robot processes). This subshell created has the custom prompt modifications (with color) for quick visual checks as well.

−

=== Checkout Convenient baxter.sh script ===

+

==== Checkout Convenient baxter.sh script ====

<syntaxhighlight lang="bash" enclose="div">

<syntaxhighlight lang="bash" enclose="div">

$ cd ~/ros_ws

$ cd ~/ros_ws

Line 26:

Line 35:

$ gedit baxter.sh

$ gedit baxter.sh

</syntaxhighlight>

</syntaxhighlight>

−

==== Edit the 'baxter_hostname' field ====

==== Edit the 'baxter_hostname' field ====

Line 61:

Line 69:

Modifying where 'your_hostname' is the hostname of your PC.

Modifying where 'your_hostname' is the hostname of your PC.

−

'''Important:''' This hostname must be resolvable to Baxter. To test if your hostname is resolvable to Baxter, please visit the development PC [[Hostname Validation]] page.

+

'''Important:''' This hostname must be resolvable to Baxter. To test if your hostname is resolvable to Baxter, please visit the development PC [[Networking]] page.

==== Edit 'ros_version' field ====

==== Edit 'ros_version' field ====

Please edit the 'ros_version' field:

Please edit the 'ros_version' field:

<syntaxhighlight lang="bash" enclose="div">

<syntaxhighlight lang="bash" enclose="div">

−

***ros_version="groovy"***

+

***ros_version="indigo"***

</syntaxhighlight>

</syntaxhighlight>

Modifying where 'ros_version' is the your chosen ROS release.

Modifying where 'ros_version' is the your chosen ROS release.

Line 80:

Line 88:

</syntaxhighlight>

</syntaxhighlight>

+

You will see that your current shell prompt will be prefixed with:

+

<syntaxhighlight lang="bash" enclose="div">

+

[baxter - http://<robot_hostname>:11311]username@machine$

+

</syntaxhighlight>

+

This allows you to quickly view if your shell is configured for Baxter communication or not, and to which robot you are currently addressing (<code><robot_hostname></code>)

</tab>

</tab>

Line 103:

Line 116:

Please add the following to the bottom of your ~/.bashrc script.

Please add the following to the bottom of your ~/.bashrc script.

−

If using ROS Groovy:

+

If using ROS Indigo:

<syntaxhighlight lang="bash" enclose="div">

<syntaxhighlight lang="bash" enclose="div">

−

source /opt/ros/groovy/setup.bash

+

source /opt/ros/indigo/setup.bash

</syntaxhighlight>

</syntaxhighlight>

Line 113:

Line 126:

</syntaxhighlight>

</syntaxhighlight>

−

==== Set ROS_MASTER_URI ====

+

If using ROS Groovy:

−

+

−

[http://wiki.ros.org/ROS/EnvironmentVariables#ROS_MASTER_URI ROS_MASTER_URI] - Allows the development PC to locate the master. This will typically be the hostname of the robot.

+

−

+

−

Please add the following to the bottom of your ~/.bashrc script.

+

<syntaxhighlight lang="bash" enclose="div">

<syntaxhighlight lang="bash" enclose="div">

−

export ROS_MASTER_URI=http://baxter_hostname:11311

+

source /opt/ros/groovy/setup.bash

</syntaxhighlight>

</syntaxhighlight>

−

Where 'baxter_hostname' is the [[Robot_Hostname hostname of your robot]

==== Set ROS_MASTER_URI ====

==== Set ROS_MASTER_URI ====

Line 171:

Line 179:

</tabs>

</tabs>

−

=== Checkout Convenient Baxter Environment Setup Script ===

+

== Verify RSDK Shell ==

−

<syntaxhighlight lang="bash" enclose="div">

+

−

$ wget https://raw.github.com/RethinkRobotics/baxter/master/baxter.sh

+

−

$ chmod +x baxter.sh

+

−

</syntaxhighlight>

+

−

<<

+

==== Test ability to ping robot. ====

−

+

Ping what you have previously set as your <code>robot_hostname</code>.

To do so, we will edit our [http://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html ~/.bashrc] script which is evoked with new shell instances.

+

−

+

−

==== Customize your ~/.bashrc ====

+

−

+

−

Please edit the ~/.bashrc to set the ROS environment variables necessary for communication with Baxter.

+

−

+

−

Using your favorite editor ([https://wiki.gnome.org/Apps/Gedit gedit] used for example)

+

<syntaxhighlight lang="bash" enclose="div">

<syntaxhighlight lang="bash" enclose="div">

−

$ gedit ~/.bashrc

+

$ ping <robot_hostname>

+

# ex.

+

$ ping 011304P0026.local

</syntaxhighlight>

</syntaxhighlight>

−

At the bottom of your ~/.bashrc script add the following:

+

If unable to ping the robot visit [[Connecting and Testing the Development Workstation|this page]].

−

==== Source ROS setup.bash ====

+

=== Test ability to command the robot ===

−

A ROS environment script is packages will all standard ROS installation. This script will set the standard basic ROS environment variables.

+

1. Enable the robot

−

+

−

Please add the following to the bottom of your ~/.bashrc script.

+

−

+

−

If using ROS Groovy:

+

<syntaxhighlight lang="bash" enclose="div">

<syntaxhighlight lang="bash" enclose="div">

−

source /opt/ros/groovy/setup.bash

+

$ rosrun baxter_tools enable_robot.py -e

</syntaxhighlight>

</syntaxhighlight>

+

The robot is now active. You may now grasp Baxter's arms freely by grasping the cuffs at the hands.

−

If using ROS Hydro:

+

2. Disable the robot

<syntaxhighlight lang="bash" enclose="div">

<syntaxhighlight lang="bash" enclose="div">

−

source /opt/ros/hydro/setup.bash

+

$ rosrun baxter_tools enable_robot.py -d

</syntaxhighlight>

</syntaxhighlight>

+

You should visibly see Baxter's arms gently fall and will no longer have the ability to move the arms freely.

−

==== Set ROS_MASTER_URI ====

+

If unsuccessful in enabling the robot, please follow the instructions below. This is typically due to a ROS_HOSTNAME being set which is not resolvable to Baxter. Please unset your ROS_HOSTNAME, instead using your ROS_IP. Make sure this is reflected permanently in your <code> baxter.sh </code> script.

−

[http://wiki.ros.org/ROS/EnvironmentVariables#ROS_MASTER_URI ROS_MASTER_URI] - Allows the development PC to locate the master. This will typically be the hostname of the robot.

+

==== Timeout observed when trying to enable the robot. ====

+

Assuming that you are able to <code>$rostopic echo /rosout</code> during [[Connecting and Testing the Development Workstation#steps-for-connecting-to-baxter|these prerequisite instructions]]. This error is a sign of the inability to make '''commands''' to the robot. This is due to your ROS_HOSTNAME/ROS_IP being set incorrectly.

−

Please add the following to the bottom of your ~/.bashrc script.

+

View the ROS_ENVIRONMENT set for your current shell.

<syntaxhighlight lang="bash" enclose="div">

<syntaxhighlight lang="bash" enclose="div">

−

export ROS_MASTER_URI=http://baxter_hostname:11311

+

$ env | grep ROS

</syntaxhighlight>

</syntaxhighlight>

−

Where 'baxter_hostname' is the [[Robot_Hostname hostname of your robot]

+

Verify that '''***EITHER***''' the ROS_HOSTNAME or ROS_IP is set for your development workstation.

−

==== Set ROS_MASTER_URI ====

+

If unsuccessful and the ROS_HOSTNAME is set, please unset this variable and use ROS_IP.

−

+

−

[http://wiki.ros.org/ROS/EnvironmentVariables#ROS_MASTER_URI ROS_MASTER_URI] - Allows the development PC to locate the master. This will typically be the hostname of the robot.

+

−

+

−

Please add the following to the bottom of your ~/.bashrc script.

+

<syntaxhighlight lang="bash" enclose="div">

<syntaxhighlight lang="bash" enclose="div">

−

export ROS_MASTER_URI=http://baxter_hostname:11311

+

$ unset ROS_HOSTNAME

+

$ export ROS_IP=<your_development_workstation_ip>

</syntaxhighlight>

</syntaxhighlight>

−

Where 'baxter_hostname' is the [[Robot_Hostname hostname of your robot]

−

==== Set ROS_IP *OR* ROS_HOSTNAME ====

+

Note: You can always view your current development workstation IP address using

−

It will be necessary for other processes to be able to communicate to and from your development PC. For this reason, setting [http://wiki.ros.org/ROS/EnvironmentVariables#ROS_NAMESPACE ROS_IP or ROS_HOSTNAME] advertises your node for networked communication.

+

−

+

−

Please add the ROS_IP (only if not using ROS_HOSTNAME):

+

<syntaxhighlight lang="bash" enclose="div">

<syntaxhighlight lang="bash" enclose="div">

−

export ROS_IP='192.168.XXX.XXX'

+

$ ifconfig

</syntaxhighlight>

</syntaxhighlight>

−

Modifying where 'your_ip' is the IP address of your PC.

−

Useful command for identifying your IP address:

+

If unsuccessful and the ROS_IP is set, verify that this is describes '''your''' ip address and not the '''robot''' ip address.

<syntaxhighlight lang="bash" enclose="div">

<syntaxhighlight lang="bash" enclose="div">

+

# Verify ROS_HOSTNAME is unset

+

$ unset ROS_HOSTNAME

+

# Take note of your IP address

$ ifconfig

$ ifconfig

−

# Result will be contained in the 'inet addr' field (Ubuntu) or 'inet' field (Gentoo Robot PC).

+

# Export this as your ROS_IP

+

$ export ROS_IP=<your_development_workstation_ip>

</syntaxhighlight>

</syntaxhighlight>

−

−

'''Important:''' Only set either ROS_IP '''*OR*''' ROS_HOSTNAME.

−

−

Alternatively, you may choose to use the hostname of your development PC.

−

−

Please edit the ROS_HOSTNAME field (only if not using ROS_IP):

−

<syntaxhighlight lang="bash" enclose="div">

−

export ROS_HOSTNAME='your_hostname'

−

</syntaxhighlight>

−

Modifying where 'your_hostname' is the hostname of your PC.

−

−

'''Important:''' This hostname must be resolvable to Baxter. To test if your hostname is resolvable to Baxter, please visit the development PC [[Hostname Validation]] page.

−

−

==== Save and Close ~/.bashrc ====

−

Please save and close your ~/.bashrc

−

−

==== Initialize your SDK environment ====

−

From this point forward, your ROS environment setup should be preconfigured upon startup of all new terminals (shells). '''Important:''' You will still need to source your development workspace (~/ros_ws/devel/setup.bash) setup script when compiling code from source in your [http://wiki.ros.org/catkin/workspaces Catkin workspace] - following our setup this will be ~/ros_ws.

−

−

Please close your current terminal, and reopen a new terminal instance.

ROS_IP *OR* ROS_HOSTNAME - This should contain '''either''' your IP address or hostname which is resolvable to Baxter.

−

−

We will verify your network setup in the [[Hello_baxter | Next Step: Hello Baxter!]]

−

−

−

=== Prerequisites ===

−

−

* You have completed all of the [[Setup Guide|Getting Started - Setup Guide]] instructions for setting up your robot and development machine.

−

* This includes all steps through [[ Installing the Research SDK|Installing the RSDK]] on your computer.

−

* The developer workstation has been connected to Baxter and connectivity has been validated - [[Connecting and Testing the Development Workstation|instructions here]].

−

−

=== Outcome of this step ===

−

−

* You have successfully initialized a shell giving you the ability to enable/disable Baxter.

−

−

=== Overview ===

−

To properly communicate with Baxter two way communication must occur between the robot and the development workstation. This requires correctly setting the development workstation's [http://www.ros.org/wiki/ROS/EnvironmentVariables ROS Environment Variable]. A convenience script, '''init.sh''', has been created to properly set majority of the required environment variables. With proper usage, running '''init.sh''' will be the only step required to communicate with Baxter from any new shell instance.

'''''Alternatively''''' if your workstation_hostname is not resolvable to Baxter, you will be required to set your ROS_IP environment variable explicitly to your development workstation IP address.

−

<source lang="bash">

−

$ export ROS_IP=<workstation_ip_address>

−

</source>

−

'''''Important''''' ROS_HOSTNAME will take precedence over ROS_IP. If you choose to explicitly set your ROS_IP you must unset your ROS_HOSTNAME.

−

<source lang="bash">

−

$ unset ROS_HOSTNAME

−

</source>

−

For more information visit [http://www.ros.org/wiki/ROS/EnvironmentVariables#ROS_IP.2BAC8-ROS_HOSTNAME ROS_IP/ROS_HOSTNAME]

−

−

3. '''Optional (Recommended)''' export ROS_HOSTNAME/ROS_IP to be persistent when starting a new shell (eliminates step 2, exporting ROS_IP/ROS_HOSTNAME for every new shell).

−

<source lang="bash">

−

$ echo "export ROS_HOSTNAME=<workstation_hostname>" >> ~/.bashrc

−

= OR =

−

$ echo "export ROS_IP=<workstation_ip_address>" >> ~/.bashrc

−

$ source ~/.bashrc

−

</source>

−

−

=== Test your ability to command the robot ===

−

1. Build all the example code (only need to do this once):

−

<source lang="bash">

−

$ rosmake baxter --pre-clean

−

</source>

−

2. Enable the robot

−

<source lang="bash">

−

$ rosrun tools enable_robot.py -e

−

</source>

−

The robot is now active. You may now grasp Baxter's arms freely by grasping the cuffs at the hands.

−

−

2. Disable the robot

−

<source lang="bash">

−

$ rosrun tools enable_robot.py -d

−

</source>

−

You should visibly see Baxter's arms gently fall and will no longer have the ability to move the arms freely.

−

−

=== Troubleshooting ===

−

−

==== Verify ability to ping robot. ====

−

Ping what you have [[RSDK Shell#initialize|previously]] set as your <code>robot_hostname</code>.

−

<source lang="bash">

−

$ ping <robot_hostname>

−

# ex.

−

$ ping 011304P0026

−

</source>

−

If unable to ping the robot visit [[Connecting and Testing the Development Workstation|this page]].

−

−

==== Timeout observed when trying to enable the robot. ====

−

Assuming that you are able to <code>$rostopic echo /rosout</code> during [[Connecting and Testing the Development Workstation#steps-for-connecting-to-baxter|these prerequisite instructions]]. This error is a sign of the inability to make '''commands''' to the robot. This is due to your ROS_HOSTNAME/ROS_IP being set incorrectly.

−

−

View the ROS_ENVIRONMENT set for your current shell.

−

<source lang="bash">

−

$ env | grep ROS

−

</source>

−

Verify that '''either''' the ROS_HOSTNAME or ROS_IP is set for your development workstation.

−

−

If unsuccessful and the ROS_HOSTNAME is set, please unset this variable and use ROS_IP.

−

<source lang="bash">

−

$ unset ROS_HOSTNAME

−

$ export ROS_IP=<your_development_workstation_ip>

−

</source>

−

Note: You can always view your current development workstation IP address using

−

<source lang="bash">

−

$ ifconfig

−

</source>

−

−

If unsuccessful and the ROS_IP is set, verify that this is describes '''your''' ip address and not the '''robot''' ip address.

−

<source lang="bash">

−

# Verify ROS_HOSTNAME is unset

−

$ unset ROS_HOSTNAME

−

# Take note of your IP address

−

$ ifconfig

−

# Export this as your ROS_IP

−

$ export ROS_IP=<your_development_workstation_ip>

−

</source>

Latest revision as of 14:21, 25 August 2016

To communicate with and command Baxter, we must establish the connection between your development PC and the robot. Assuming proper network setup, the RSDK shell refers to the a configuration of your ROS environment which points your PC to the ROS Master, while registering your IP or Hostname allowing other processes to find you.

Quick Environment Setup Via Baxter.sh

Detailed Description/Setup

The baxter.sh script is a convenient script allowing users to get their ROS environment setup quickly. It should allow for intuitive modification of the core components to get communicating with Baxter setup quickly. It creates a heredoc which verifies all environment variables expected are provided, with a handy sim argument for local configurations (useful for simulation), and local argument (useful when SSH'd into Baxter with no need to communicate to external, off-robot processes). This subshell created has the custom prompt modifications (with color) for quick visual checks as well.

Source ROS setup.bash

A ROS environment script is packages will all standard ROS installation. This script will set the standard basic ROS environment variables.

Please add the following to the bottom of your ~/.bashrc script.

If using ROS Indigo:

source/opt/ros/indigo/setup.bash

If using ROS Hydro:

source/opt/ros/hydro/setup.bash

If using ROS Groovy:

source/opt/ros/groovy/setup.bash

Set ROS_MASTER_URI

ROS_MASTER_URI - Allows the development PC to locate the master. This will typically be the hostname of the robot.

Please add the following to the bottom of your ~/.bashrc script.

exportROS_MASTER_URI=http://baxter_hostname:11311

Where 'baxter_hostname' is the [[Robot_Hostname hostname of your robot]

Set ROS_IP *OR* ROS_HOSTNAME

It will be necessary for other processes to be able to communicate to and from your development PC. For this reason, setting ROS_IP or ROS_HOSTNAME advertises your node for networked communication.

Please add the ROS_IP (only if not using ROS_HOSTNAME):

exportROS_IP='192.168.XXX.XXX'

Modifying where 'your_ip' is the IP address of your PC.

Useful command for identifying your IP address:

$ ifconfig# Result will be contained in the 'inet addr' field (Ubuntu) or 'inet' field (Gentoo Robot PC).

Important: Only set either ROS_IP *OR* ROS_HOSTNAME.

Alternatively, you may choose to use the hostname of your development PC.

Please edit the ROS_HOSTNAME field (only if not using ROS_IP):

exportROS_HOSTNAME='your_hostname'

Modifying where 'your_hostname' is the hostname of your PC.

Important: This hostname must be resolvable to Baxter. To test if your hostname is resolvable to Baxter, please visit the development PC Hostname Validation page.

Save and Close ~/.bashrc

Please save and close your ~/.bashrc

Initialize your SDK environment

From this point forward, your ROS environment setup should be preconfigured upon startup of all new terminals (shells). Important: You will still need to source your development workspace (~/ros_ws/devel/setup.bash) setup script when compiling code from source in your Catkin workspace - following our setup this will be ~/ros_ws.

Please close your current terminal, and reopen a new terminal instance.

Test ability to command the robot

The robot is now active. You may now grasp Baxter's arms freely by grasping the cuffs at the hands.

2. Disable the robot

$ rosrun baxter_tools enable_robot.py -d

You should visibly see Baxter's arms gently fall and will no longer have the ability to move the arms freely.

If unsuccessful in enabling the robot, please follow the instructions below. This is typically due to a ROS_HOSTNAME being set which is not resolvable to Baxter. Please unset your ROS_HOSTNAME, instead using your ROS_IP. Make sure this is reflected permanently in your baxter.sh script.

Timeout observed when trying to enable the robot.

Assuming that you are able to $rostopic echo /rosout during these prerequisite instructions. This error is a sign of the inability to make commands to the robot. This is due to your ROS_HOSTNAME/ROS_IP being set incorrectly.

View the ROS_ENVIRONMENT set for your current shell.

$ env|grep ROS

Verify that ***EITHER*** the ROS_HOSTNAME or ROS_IP is set for your development workstation.

If unsuccessful and the ROS_HOSTNAME is set, please unset this variable and use ROS_IP.

$ unset ROS_HOSTNAME$ exportROS_IP=<your_development_workstation_ip>

Note: You can always view your current development workstation IP address using

$ ifconfig

If unsuccessful and the ROS_IP is set, verify that this is describes your ip address and not the robot ip address.