Difference between revisions of "API Reference"

Jump to: navigation , search
(Enable Robot)
(Python Code API)
(67 intermediate revisions by one other user not shown)
Line 5: Line 5:
  
 
</div>
 
</div>
 +
 +
{{TOClimit|limit=2}}
  
 
<div class="content-block">
 
<div class="content-block">
  
== ROS Topic API Reference ==
+
= ROS Topic API Reference =
  
  
===Python Code API===
+
==Python Code API==
: For the [[Robot Interface|Robot Interface]] Python classes (built on top of the ROS API), please see the [https://rethinkrobotics.github.io/intera_sdk_docs/5.0.4/index.html Code API Reference] page.
+
: For the [[Robot Interface|Robot Interface]] Python classes (built on top of the ROS API), please see the [https://rethinkrobotics.github.io/intera_sdk_docs/index.html Code API Reference] page.
 
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 27: Line 28:
 
||
 
||
 
* [[#Joints|Joints]]  
 
* [[#Joints|Joints]]  
** [[Arm Joints]]
+
** [[#Arm Joints|Arm Joints]]
** [[Head Joints]]
+
** [[#Head Joints|Head Joints]]
 
* [[#Cartesian Endpoint|Cartesian Endpoint]]
 
* [[#Cartesian Endpoint|Cartesian Endpoint]]
** [[Endpoint State|Endpoint State]]
+
** [[#Endpoint State|Endpoint State]]
** [[Inverse Kinematics Solver Service|IK Solver]]
+
** [[#Kinematics Solver Service|Kinematics Solver Service]]
 
* [[#Gripper (End-Effector)|Gripper (End-Effector)]]
 
* [[#Gripper (End-Effector)|Gripper (End-Effector)]]
 
||
 
||
* [[#Sensors|Sensors]]
+
* [[#Accelerometer|Accelerometer]]
 
* [[#Cameras|Cameras]]
 
* [[#Cameras|Cameras]]
 
* [[#Head Display Screen|Head Display Screen]]
 
* [[#Head Display Screen|Head Display Screen]]
Line 41: Line 42:
 
* [[#Cuff Buttons|Cuff Buttons]]
 
* [[#Cuff Buttons|Cuff Buttons]]
 
* [[#Lights|LED Lights]]
 
* [[#Lights|LED Lights]]
* [[#Digital IO|Digital IO]]
 
* [[#Analog IO|Analog IO]]
 
 
|}
 
|}
  
Line 49: Line 48:
 
<div class="content-block">
 
<div class="content-block">
  
== Robot ==
+
= Robot =
 +
 
 +
 
 +
== Enable Robot ==
 +
Be sure that you 'Enable' the robot before attempting to control any of the motors.  The easiest method for controlling the robot is to use the <code>enable_robot.py</code> ROS executable found in the following example:[https://github.com/RethinkRobotics/intera_sdk/blob/master/intera_interface/scripts/enable_robot.py Enable Robot Script]
 +
 
 +
=== Robot State ===
 +
<code>/robot/state</code> ([https://rethinkrobotics.github.io/intera_sdk_docs/5.0.4/intera_core_msgs/html/msg/AssemblyState.html intera_core_msgs/AssemblyState])
 +
Subscribe to the Robot State for the enabled and error state of the robot hardware itself. It also includes information on the EStop.
 +
The robot must be enabled (<code>enabled: true</code>) in order to move the robot. Use the [https://github.com/RethinkRobotics/intera_sdk/blob/master/intera_interface/scripts/enable_robot.py Enable Robot Script], or the "Enable Robot Topic" below, to enable the robot.
 +
It is possible for the robot to have non-fatal errors, so <code>error</code> can be <code>true</code> while <code>enabled</code> is also <code>true</code>.
 +
For more complete information on robot state, see [[E-STOP and Enable Robot]].
 +
 
 +
=== Enable Robot ===
 +
<code>/robot/set_super_enable</code> ([http://www.ros.org/doc/api/std_msgs/html/msg/Bool.html std_msgs/Bool]) 
 +
<code>data</code>: <code>true</code> to Enable robot motors; <code>false</code> to disable.
 +
You can check the Robot State Topic to see if the robot enabled properly or if it has an error.
 +
 
 +
=== Reset Robot State ===
 +
<code>/robot/set_super_reset</code> ([http://www.ros.org/doc/api/std_msgs/html/msg/Empty.html std_msgs/Empty]) 
 +
Publish an Empty message to reset the state after an error.
 +
A reset will clear all pre-existing errors and the state (it will disable).
 +
 
 +
 
 +
== Robot Description (URDF) ==
 +
 
 +
Sawyer automatically builds an appropriate URDF (Unified Robot Description Format) on boot and loads it onto the ROS Parameter Server, under the ROS parameter name <code>/robot_description</code>.  From here, it is accessible by rviz, tf and other ROS utilities that use the URDF.
 +
 
 +
The [http://wiki.ros.org/urdf Unified Robot Description Format (URDF)] is the standard ROS XML representation of the robot model (kinematics, dynamics, sensors) describing Sawyer.
 +
 
 +
Sawyer generates his URDF dynamically on robot startup. This model is updated when any gripper is attached or detached, an object is 'grasped' or released and its mass is compensated for, and when new urdf segments are provided/commanded to the gripper plugins. As of SDK versions >= 1.0.0 Sawyer's internal robot model, is loaded to the [http://wiki.ros.org/Parameter%20Server parameter server] on the topic <code>/robot_description</code>
 +
 
 +
The default URDF for Sawyer is available in the [https://github.com/RethinkRobotics/intera_common intera_common] repository. The package <code> sawyer_description </code> contains the URDF and accompanying meshes.
 +
 
 +
=== Getting a Copy of the URDF from the parameter server ===
 +
 
 +
You can now get the current URDF describing '''your''' Sawyer.
 +
 
 +
From a [[SDK_Shell | properly initialized]] Sawyer environment, export the URDF from the <code>/robot_description</code> parameter on the ROS parameter server where it is stored, to a file of your choice (ex: <code>sawyer_urdf.xml</code>):
 +
 
 +
<source lang="bash">
 +
$ rosparam get -p /robot_description | tail -n +2 > sawyer_urdf.xml
 +
</source>
 +
 
 +
The <code>-p</code> outputs the parameter using pretty print. The output urdf is piped through the <code>tail</code> command first to remove a dummy first line - an artifact of the pretty print. 
  
=== [[Enable Robot|Enable Robot]] ===
+
'''Tip:''' You can check that you now have a proper URDF by running:
Be sure that you 'Enable' the robot before attempting to control any of the motors.  The easiest method for controlling the robot is to use the <code>enable_robot.py</code> ROS executable found in the following example.
+
<source lang="bash">
* [https://github.com/RethinkRobotics/intera_sdk/blob/master/intera_interface/scripts/enable_robot.py Enable Robot Script]
+
$ rosrun urdfdom check_urdf sawyer_urdf.xml
* [[Key Use Tips in Enable Robot]]
+
</source>
  
=== Robot Description (URDF) ===
+
=== Robot State Publisher ===
Sawyer automatically builds an appropriate URDF (Unified Robot Description Format) on boot and loads it onto the ROS Parameter Server, under the ROS parameter name <code>/robot_description</code>.  From here, it is accessible by rviz, tf and other ROS utilities that use the URDF.  If you want to grab a copy of the actual URDF xml file yourself, see the [[HowTo - Main|How To's]].
 
*  [[Robot Description]]
 
*  [[HowTo - Main|Getting the URDF]]
 
  
 +
The URDF is used by Sawyer's [http://wiki.ros.org/urdf Robot State Publishers] to create a tree of [http://wiki.ros.org/tf transforms (tfs)]. In fact, Sawyer has two of such publishers:
 +
'''robot_ref_publisher''': publishes transforms that reflect the commanded robot state.
 +
'''robot_state_publisher''': publishes transforms that reflect the measured state of the robot.
 +
 +
These robot publishers live internal to Sawyer and are accessible to the RSDK over ROS. The "ref" tfs are used by the robot internals, but you may find them useful to see where the robot will move at the next timestep. Otherwise, be sure to use the non-"ref" transforms if you're only interested in the Sawyer's current state.
 +
 +
=== Getting a Copy of the URDF Dynamically ===
 +
Sawyer generates the URDF dynamically on initialization, based on the attached arm.  In some cases, users may want to get the current URDF off the robot. 
 +
From a working Sawyer RSDK environment, export the URDF from the <code>/robot_description</code> parameter on the ROS parameter server where it is stored, to a file of your choice (ex: <code>sawyer_urdf.xml</code>):
 +
 +
<source lang="bash">
 +
$ rosparam get -p /robot_description | tail -n +2 > sawyer_urdf.xml
 +
</source>
 +
 +
The <code>-p</code> outputs the parameter using pretty print.  The output urdf is piped through the <code>tail</code> command first to remove a dummy first line - an artifact of the pretty print. 
 +
 +
'''Tip:''' You can check that you now have a proper URDF by running:
 +
 +
<source lang="bash">
 +
$ rosrun urdf_parser check_urdf sawyer_urdf.xml
 +
</source>
 +
 +
If this doesn't work, you can just remove the tail command and use a text editor to manually remove the first few lines before the actual xml (all the lines before <code><?xml version="1.0" ?></code>).
 +
<source lang="bash">
 +
    $ rosparam get -p /robot_description > sawyer_urdf.xml
 +
    $ head sawyer_urdf.xml
 +
    | 
 +
      <?xml version="1.0" ?> 
 +
      <!-- =================================================================================== --> 
 +
      <!-- |    This document was autogenerated by xacro from sawyerp2.urdf.xacro            | --> 
 +
    ... 
 +
    $ gedit sawyer_urdf.xml &
 +
    $ head sawyer_urdf.xml
 +
      <?xml version="1.0" ?> 
 +
      <!-- =================================================================================== --> 
 +
      <!-- |    This document was autogenerated by xacro from sawyerp2.urdf.xacro            | --> 
 +
    ...
 +
</source>
 
</div>
 
</div>
 +
  
 
<div class="content-block">
 
<div class="content-block">
  
== Movement ==
+
= Movement =
  
=== Joints ===
+
 
 +
== Joints ==
 
Sawyer has 7 joints (DoF) in arm and one more joint in its head (side-to-side panning).  The control for the head is done separately from the arm; however, you can read the current joint states (position, velocity, and effort) for all the joints on arm and head by subscribing to one topic:
 
Sawyer has 7 joints (DoF) in arm and one more joint in its head (side-to-side panning).  The control for the head is done separately from the arm; however, you can read the current joint states (position, velocity, and effort) for all the joints on arm and head by subscribing to one topic:
 
<code>/robot/joint_states</code> ([http://www.ros.org/doc/api/sensor_msgs/html/msg/JointState.html sensor_msgs-JointState])   
 
<code>/robot/joint_states</code> ([http://www.ros.org/doc/api/sensor_msgs/html/msg/JointState.html sensor_msgs-JointState])   
 
where the units for the position of a joint are in (rad), the units of velocity are in (rad/s) and the units of effort in each joint is in (Nm).
 
where the units for the position of a joint are in (rad), the units of velocity are in (rad/s) and the units of effort in each joint is in (Nm).
  
The following sections cover the individual joint sensing and control in more detail:  
+
=== Arm Joints ===
* [[Arm Joints]]
+
The following sections cover the arm joints sensing and control in more detail: [[Arm Joints]].
* [[Head Joints]]
+
 
 +
=== Head Joints ===
 +
The head state topic will give you the current <code>pan</code> angle (side-to-side) of the head and report boolean status flags if the robot is currently moving its head. 
 +
 
 +
'''Note: Flags may not report 'true' values until after the first respective movement command is sent.''' 
  
=== Cartesian Endpoint ===
+
'''Component ID:'''<code>head_pan</code>
Published at 100 Hz, the endpoint state topic provides the current Cartesian Position, Velocity and Effort at the endpoint for either limb.
 
  
The following sections covered the endpoint state and IK Solver in more detail:  
+
'''Head State:'''  <br />
* [[Endpoint State]]
+
<code>/robot/head/head_state</code> ([https://rethinkrobotics.github.io/intera_sdk_docs/5.0.4/intera_core_msgs/html/msg/HeadState.html intera_core_msgs-HeadState]). <code>pan</code> field gives you the current angle (radians) of the head.  0 is forward, <code>-pi/2</code> to Sawyer's right, and <code>+pi/2</code> to Sawyer's left. <code>isPanning</code> is boolean field that will switch to True while the robot is executing a command. 
* [[Inverse Kinematics Solver Service|IK Solver]]
 
  
=== Gripper (End-Effector) ===
+
'''Note: The <code>isPanning</code> field is initialized to True upon startup and will update thereafter.'''
Before using an End-Effector, or Gripper, you must first send the calibration command. You can check whether the gripper has been calibrated yet by echoing on the gripper state topic for that hand. Once calibrated, gripper can be controlled using the simplified command_grip and command_release topics, or using the more direct command_set topic.
 
For more information on using the gripper, see the [[Gripper_Example | Gripper Example Program]].
 
  
The following sections cover the gripper configuration, gripper state and simple gripper control in more detail:
+
'''Head (Joint) State:'''  <br />
* [[Gripper Details]]
+
<code>/robot/joint_states</code> ([http://www.ros.org/doc/api/sensor_msgs/html/msg/JointState.html sensor_msgs-JointState]).The position of the head may also be determined from the <code>joint_state</code> message.
  
</div>
+
=== Head Movement Control ===
 +
'''Pan Head:'''  <br />
 +
<code>/robot/head/command_head_pan</code> ([https://rethinkrobotics.github.io/intera_sdk_docs/5.0.4/intera_core_msgs/html/msg/HeadPanCommand.html intera_core_msgs-HeadPanCommand]) 
 +
<code>target</code> sets the target angle.  0.0 is straight ahead.
 +
<code>speed</code> is an integer from [0-100], 100 = max speed.
 +
Setting an angle in the command_head_pan topic does not gurantee the head will get to that position.  There is a small deband around the reference angle around the order of +/- 0.12 radians.
  
<div class="content-block">
+
=== Example: ===
 +
<source lang="bash">
 +
    # Check head position/state:
 +
    $ rostopic echo /robot/head/head_state
 +
    # Move (pan) head side-to-side:
 +
    $ rostopic pub /robot/head/command_head_pan intera_core_msgs/HeadPanCommand -- 0.0 100
 +
</source>
  
== Sensors+ ==
 
  
=== Sensors ===
 
Multiple sensors are included inside of the Sawyer Robot.
 
* [[Sensors on Sawyer]]
 
** [[#Accelerometers|Accelerometers]]
 
** [[#IR Range|IR Range]]
 
** [[#Sonar|Sonar]]
 
  
=== Cameras ===
+
== Cartesian Endpoint ==
 +
Published at 100 Hz, the endpoint state topic provides the current Cartesian Position, Velocity and Effort at the endpoint for either limb.
  
You can access Sawyer's hand camera and the head camera using the standard ROS image types and image_transport mechanism. You can use the ROS Services to open, close, and configure each of the cameras. See the link below for more info:
+
=== Endpoint State ===
 +
'''Endpoint State''': <code>/robot/limb/right/endpoint_state</code>  [https://rethinkrobotics.github.io/intera_sdk_docs/5.0.4/intera_core_msgs/html/msg/EndpointState.html intera_core_msgs-EndpointState]).
 +
The endpoint state message provides the current <code>position/orientation pose</code>, <code>linear/angular velocity</code>, and <code>force/torque effort</code> of the robot end-effector at 100 Hz. Pose is in Meters, Velocity in m/s, Effort in Nm.
 +
The robot's "endpoint" is definied as the <code>right_gripper</code> tf frame. This frame is updated dynamically when gripper is connected to the robot <!--or a [[Gripper Customization]] command is sent-->.
 +
The [[Robot Description | URDF]] on the parameter server will now update when the Robot Model is updated by Gripper changes. Check the ROS Parameter for an updated copy of the URDF, especially before using IK or motion planners, such as [[MoveIt_Tutorial|MoveIt!]].
  
* [[Cameras]]
+
=== Kinematics Solver Service ===
 +
The following sections cover the Forward Kinematics Solver Service and Inverse Kinematics Solver Service in more detail: [[Kinematics Solvers |Kinematics Solvers]]
  
=== Head Display Screen ===
 
Images can be displayed on Sawyer's LCD screen by publishing the image data. For detailed info regarding the head display, please see:
 
  
* [[Head Display Screen]]
 
  
</div>
+
== Gripper (End-Effector) ==
 +
Before using an End-Effector, or Gripper, you must first send the calibration command. You can check whether the gripper has been calibrated yet by echoing on the gripper state topic for that hand. Once calibrated, gripper can be controlled using the simplified command_grip and command_release topics, or using the more direct command_set topic.
 +
For more information on using the gripper, see the [[Gripper_Example | Gripper Example Program]].
  
<div class="content-block">
+
=== Gripper Configuration ===
 +
([https://rethinkrobotics.github.io/intera_sdk_docs/5.0.4/intera_core_msgs/html/msg/IOComponentCommand.html intera_core_msgs-IOComponentCommand])
  
== Inputs and Outputs ==
+
'''Calibrate Gripper'''  <br />
 +
Publish an IO Command message to calibrate a new gripper by set signal <code>calibrate</code> to <code>True</code>. Gripper should open and close once.
 +
The <code>calibrated</code> field of the gripper state topic will also update to '1' after successful calibration.
 +
Once calibrated, the gripper will not calibrate again unless the command reset message is sent, or the robot is restarted.
  
=== Navigators ===
+
'''Reset Gripper'''  <br />
There are four Navigators on Baxter's body: two on each side of the torso and one on each arm. Each Navigator is comprised of three push buttons, one of which is also an indexing scroll wheel, and two sets of blue LED lights.
+
Publish an IO Command message to reset the gripper state by set signal <code>reboot</code> to <code>True</code>.
 +
The <code>calibrated</code> field of the gripper state message will reset to '0'.
  
'''Component IDs:'''<br />
+
=== Gripper State ===
<code>left_itb</code>, <code>right_itb</code>, <code>torso_left_itb</code>, <code>torso_right_itb</code>
+
'''Gripper State''' <br />
 +
<code>/io/end_effector/state</code>
 +
The io signal <code>calibrated</code> field must be true (1) before you can control the gripper.  Use the IO command to calibrate the gripper.
 +
The gripper state message will also give you the current <code>position</code>, <code>force</code>, and if the gripper is current <code>moving</code>.  Position is from [0.0-100.0] [close-open].
  
==== Navigator Input Buttons ====
+
=== Simple Gripper Control ===
''Read Button States'' <br />
+
'''Simple Gripper Close''' <br />  
<code>/robot/itb/<component_id>/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/ITBState.msg baxter_core_msgs-ITBState]) 
+
<code>/io/end_effector/command</code> the signal <code>'position_m'</code> value to MIN_POSITION: 0.0.
* The states of the three push buttons are the first three values in the boolean <code>buttons[]</code> array.  A value of 'True' indicates the button is currently pushed down. The order is as follows:
+
Publish an IO Command message to grip.
*  OK_BUTTON (<code>buttons[0]</code>):  The circular button in the middle of the Navigator.
 
*  CANCEL_BUTTON (<code>buttons[1]</code>):  The button 'above' the OK_BUTTON, typically with a 'Back' arrow symbol.
 
*  SHOW_BUTTON (<code>buttons[2]</code>):  The SHOW_BUTTON, or "Rethink Button", is 'below' the OK_BUTTON, and typically is labeled with the Rethink logo.
 
  
''Read Wheel Index''  <br />
+
'''Simple Gripper Open'''  <br />
<code>/robot/itb/<component_id>/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/ITBState.msg baxter_core_msgs-ITBState]) 
+
<code>/io/end_effector/command</code> the signal <code>'position_m'</code> value to MAX_POSITION: 0.041667.
* The <code>wheel</code> field returns an integer between [0-255]. Each physical 'click' of the wheel corresponds to a +/-1 increment. The value will loop when it goes above or below the bounds. 
+
Publish an IO Command message to release.
  
==== Control Navigator Lights ====
+
</div>
There are two sets of lights on each Navigator: the 'inner' light ring around the circular OK Button, and the 'outer' oval light ring around the entire Navigator.  Each light is identified by the 'Component ID' of its Navigator followed by <code>_light_inner</code> or <code>_light_outer</code>.
 
  
'''Component IDs:'''  <br />
 
Inner Lights: <code>left_itb_light_inner</code>, <code>right_itb_light_inner</code>, <code>torso_left_itb_light_inner</code>, <code>torso_right_itb_light_inner</code>  <br />
 
Outer Lights: <code>left_itb_light_outer</code>, <code>right_itb_light_outer</code>, <code>torso_left_itb_light_outer</code>, <code>torso_right_itb_light_outer</code> 
 
  
''Turn LEDs On/Off''  <br />
+
<div class="content-block">
<code>/robot/digital_io/command</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/DigitalOutputCommand.msg baxter_core_msgs-DigitalOutputCommand])
 
* name: <code><navigator_component_id>_light_inner</code>, <code><navigator_component_id>_light_outer</code> 
 
* value: {True, False} 
 
   
 
* Publish a DigitalOutputCommand message with the component id of the light as the <code>name</code> and a <code>value</code> of <code>True</code> or <code>False</code> to turn the LEDs On or Off, respectively.
 
  
''Check State of LEDs''  <br />
+
= Sensors+ =
<code>/robot/digital_io/<light_component_id>/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg//DigitalIOState.msg baxter_core_msgs-DigitalIOState]) 
 
* The <code>state</code> field will give you the current setting of the LED, ON(1) or OFF(0).
 
  
=== Shoulder Buttons ===
+
== Accelerometer ==
There are two shoulder buttons on the back of the torso, one on each side.  The state of each button is published in a DigitalIOState message under its own topic (DigitalIOState constants: PRESSED==1, UNPRESSED==0).
+
The robot hand has a 3-axis accelerometer located inside the cuff, in the same plane as the gripper electrical connection header.  The positive z-axis points back 'up' the arm (towards the previous wrist joint, j6).  The positive x-axis points towards the direction of gripper, and the y-axis points towards the cuff buttons, using standard [http://en.wikipedia.org/wiki/Right-hand_rule Right-Hand-Rule] notation.
  
'''Component IDs:'''<br />
+
'''Component IDs:''' <br />
<code>left_shoulder_button</code>, <code>right_shoulder_button</code>
+
<code>right_accelerometer</code>
  
''Read Button Pressed'' <br />
+
'''Accelerometer State:''' <br />
<code>/robot/digital_io/<side>_shoulder_button/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/DigitalIOState.msg baxter_core_msgs-DigitalIOState])
+
<code>/robot/accelerometer/<component_id>/state</code>([https://http://docs.ros.org/api/sensor_msgs/html/msg/Imu.html sensor_msgs-ImuMessage])  
* The integer field <code>state</code> will read PRESSED (1) when the button is pressed down, and UNPRESSED (0) otherwise.
 
  
=== Cuff Buttons ===
+
Acceleration values (in m/s^2) are published under <code>linear_acceleration</code> for the x, y, and z axes.  The force of gravity is NOT compensated for.
There are two buttons and one touch sensor in the cuff of each hand.  The state of each button is published in a DigitalIOState message under its own topic (DigitalIOState constants: PRESSED==1, UNPRESSED==0).
 
  
==== Cuff (Squeeze) Sensor ====
+
<source lang="bash">
'''Component IDs:''' <Br />
+
names: ['right_accelerometer']
<code>left_lower_cuff</code>, <code>right_lower_cuff</code>
+
states:
 +
  -
 +
    header:
 +
      seq: 120921
 +
      stamp:
 +
        secs: 0
 +
        nsecs: 0
 +
      frame_id: ''
 +
    orientation:
 +
      x: 0.0
 +
      y: 0.0
 +
      z: 0.0
 +
      w: 0.0
 +
    orientation_covariance: [-1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
 +
    angular_velocity:
 +
      x: 0.0
 +
      y: 0.0
 +
      z: 0.0
 +
    angular_velocity_covariance: [-1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
 +
    linear_acceleration:
 +
      x: 0.0
 +
      y: 0.0
 +
      z: 0.0
 +
    linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
 +
</source>
  
''Read Cuff Squeezed''  <br />
 
<code>/robot/digital_io/<side>_lower_cuff/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/DigitalIOState.msg baxter_core_msgs-DigitalIOState]) 
 
* Integer <code>state</code> will read PRESSED (1) when the cuff sensor is squeezed, and UNPRESSED (0) otherwise.
 
  
==== Cuff OK Button ====
+
== Cameras ==
This is the circular button on the cuff. <br />
+
You can access Sawyer's hand camera and the head camera using the standard ROS image types and image_transport mechanism listed below.  You can use the ROS Services to open, close, and configure each of the cameras. See the [[Camera Image Display Example]] for more information on using the cameras. Useful tools for using cameras in ROS include [http://wiki.ros.org/rviz/DisplayTypes/Camera rviz Camera Display]. 
'''Component IDs:'''<br />
 
<code>left_lower_button</code>, <code>right_lower_button</code>
 
  
''Read OK Button Pressed''<br  /> 
+
'''IMPORTANT:''' You can only have one open at a time at standard resolutions, due to bandwidth limitations.
<code>/robot/digital_io/<side>_lower_button/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/DigitalIOState.msg baxter_core_msgs-DigitalIOState]) 
 
* Integer <code>state</code> will read PRESSED (1) when the button is pressed, and UNPRESSED (0) otherwise.
 
  
==== Cuff Grasp Button ====
+
'''Component IDs:''' <code>right_hand_camera</code>, <code>head_camera</code>
This is the long, thin button on the cuff. 
 
'''Component IDs:'''<br />
 
<code>left_upper_button</code>, <code>right_upper_button</code>
 
  
''Read Grasp Button Pressed''<br /> 
+
'''Camera Published Topics'''
<code>/robot/digital_io/<side>_upper_button/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/DigitalIOState.msg baxter_core_msgs-DigitalIOState]) 
 
* Integer <code>state</code> will read PRESSED (1) when the button is pressed, and UNPRESSED (0) otherwise.
 
  
=== Lights ===
+
Raw Image: <code>/internal_camera/<component_id>/image_raw</code> ([http://www.ros.org/doc/api/sensor_msgs/html/msg/Image.html sensor_msgs-Image])  
  
* LEDs <span id="LEDs">&nbsp;</span>
+
Camera Intrinsics: <code>/internal_camera/<component_id>/camera_info</code> ([http://www.ros.org/doc/api/sensor_msgs/html/msg/CameraInfo.html sensor_msgs-CameraInfo])
** [[#Halo LEDs|Head Halo (Red, Green)]]
 
** [[#Sonar LED Indicators|Sonar Rings (Yellow)]]
 
** [[#Navigator Lights|Navigator LEDs (inner, outer)]]
 
  
=== (Head) Halo LEDs ===
+
Rectify Color Image: <code>/internal_camera/head_camera/image_rect_color</code> ([http://wiki.ros.org/image_proc image_proc])
The 'Halo' light is the red/green light at the top of Baxter's head. The Halo is actually two separate lights - one for the red, one for the green - whose intensity levels can be independently controlled and mixed to produce a range of colors.
 
  
''Control Light Brightness'' <br />
+
Rectify Image: <code>/internal_camera/right_hand_camera/image_rect</code> ([http://wiki.ros.org/image_proc image_proc])
<code>/robot/sonar/lights/set_red_level</code> ([http://www.ros.org/doc/api/std_msgs/html/msg/Float32.html std_msgs-Float32]) <br />
 
<code>/robot/sonar/lights/set_green_level</code> ([http://www.ros.org/doc/api/std_msgs/html/msg/Float32.html std_msgs-Float32])
 
* Set the brightness level of the red or green light using a value between 0.0 (full off) and 100.0 (full on).
 
  
''Read Current Light Levels''  <br />
 
<code>/robot/sonar/head_sonar/lights/red_level</code> ([http://www.ros.org/doc/api/std_msgs/html/msg/Float32.html std_msgs-Float32]) <br />
 
<code>/robot/sonar/head_sonar/lights/green_level</code> ([http://www.ros.org/doc/api/std_msgs/html/msg/Float32.html std_msgs-Float32]) 
 
* Brightness ranges from 0.0 (full off) to 100.0 (full on).
 
  
=== Sonar LED Indicators ===
+
== Head Display Screen ==
 +
Images can be displayed on Sawyer's LCD screen by publishing the image data as a ROS <code>sensor_msgs/Image</code>. 
  
The yellow LEDs surrounding each sonar sensor on the head default to automatically being turned on or off when something enters/leaves the respective sensor's range. This behavior can be overridden by publishing on the control topic below. The published value should be the bit-wise OR of the desired mode and state for the 12 individual LEDs. The two modes are Normal (sensor-based) operation, and Manual Override.  See the definitions below.  '''Note:''' Make sure you constantly publish the values at rate of at least 100Hz or the LEDs will timeout and revert to Normal operation.
+
'''Display Image'''<code>/robot/head_display</code> ([http://www.ros.org/doc/api/sensor_msgs/html/msg/Image.html sensor_msgs-Image]).
  
To set the LEDs, pick one of the 'Mode's and OR it with any of the individual LED States desired:
+
Publish image data as a [http://ros.org/wiki/sensor_msgs ROS Image message] to update the display.
<code>
+
The screen resolution is 1024 x 600.  Images smaller than this will appear in the top-left corner. 
    # Mode
+
There are dedicated ROS packages for working with and sending ROS Image messages, including [http://ros.org/wiki/image_transport image_transport] and [http://ros.org/wiki/image_pipeline image_pipeline].  
    DEFAULT_BEHAVIOR = 0x0000;
+
Useful tools for working with images in ROS include [http://wiki.ros.org/image_view Image_view] and [http://ros.org/wiki/image_transport#republish republish]. Also see [http://ros.org/wiki/camera_drivers camera_drivers] for assistance working with your own cameras.
    OVERRIDE_ENABLE = 0x8000;
 
    # States
 
    ALL_LIGHTS_OFF  = 0x8000;
 
    ALL_LIGHTS_ON    = 0x0fff;
 
    LED_0_ON    0x0001
 
    LED_1_ON    0x0002
 
    LED_2_ON    0x0004
 
    LED_3_ON    0x0008
 
    LED_4_ON    0x0010
 
    LED_5_ON    0x0020
 
    LED_6_ON    0x0040
 
    LED_7_ON    0x0080
 
    LED_8_ON    0x0100
 
    LED_9_ON    0x0200
 
    LED_10_ON    0x0400
 
    LED_11_ON    0x0800
 
    LED_ALL_ON  0x8FFF
 
    LED_ALL_OFF  0x8000
 
</code>
 
  
''Control Lights'' 
+
For more information on displaying images to Sawyer's LCD screen, see the [[Head Display Image Example]].
<code>/robot/sonar/head_sonar/lights/set_lights</code> ([http://www.ros.org/doc/api/std_msgs/html/msg/UInt16.html std_msgs-UInt16]) 
+
</div>
* If bit 15 is zero, LEDs are controlled locally by Sonar.
 
* Set bit 15 to enable overrides, bits 0-11 to control individual channel LEDs.
 
* To use these flags, OR the OVERRIDE_ENABLE flag with the desired x_ON flags.
 
  
''State of Lights'' 
+
<div class="content-block">
<code>/robot/sonar/head_sonar/lights/state</code> ([http://www.ros.org/doc/api/std_msgs/html/msg/UInt16.html std_msgs-UInt16])
 
  
=== Navigator LEDs ===
+
= Inputs and Outputs =
''(See: [[#Navigator Lights|Navigator Lights]])''
 
  
=== Digital IO ===
 
  
''Read Digital Input State''  <br />
+
== Navigators ==
<code>/robot/digital_io/<component_id>/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/DigitalIOState.msg baxter_core_msgs-DigitalIOState]) 
+
There are two Navigators on Sawyer's body: one on side of the body and one on the armEach Navigator is comprised of three push buttons, one of which is also an indexing scroll wheel, and one set of white LED light.
* <code>state</code>: field will be 0 (for True, Pressed, On) or 1 (for False, Released, Off)If the component is an output, then the <code>state</code> field will be the current setting of the output.
 
* <code>isInputOnly</code>: field tells you if the component is an input (sensor) only, and cannot output (not a light, actuator, nor indicator).
 
  
''Control Digital Output''
+
'''Component IDs''': <code>right, head</code>
<code>/robot/digital_io/command</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/DigitalOutputCommand.msg baxter_core_msgs-DigitalOutputCommand]) 
 
* name: <code><component_id></code>
 
* value: {True, False}
 
   
 
* Publish a DigitalOutputCommand message with the component id of the Output as the <code>name</code> and a <code>value</code> of <code>True</code> or <code>False</code> to turn the Output On or Off, respectively.
 
  
 +
'''Read Button States:'''<code>/io/robot/navigator/state</code> ([https://rethinkrobotics.github.io/intera_sdk_docs/5.0.4/intera_core_msgs/html/msg/IODeviceStatus.html intera_core_msgs-IODeviceStatus])
  
 +
'''Wheel State:'''<code>/io/robot/navigator/state</code> ([https://rethinkrobotics.github.io/intera_sdk_docs/5.0.4/intera_core_msgs/html/msg/IODeviceStatus.html intera_core_msgs-IODeviceStatus])
  
{| class="wikitable"
+
'''Command Buttons:'''<code>/io/robot/navigator/command</code>([https://rethinkrobotics.github.io/intera_sdk_docs/5.0.4/intera_core_msgs/html/msg/IOComponentCommand.html intera_core_msga-IOComponentCommand])
!colspan="3"|All Digital Component IDs:
 
|-
 
!colspan="3" style="text-align:left;"|Outputs
 
|-
 
|style="width:3em;"| <!-- spacer cell for columns; need once in table -->
 
|Nav Inner Lights: || <code>left_itb_light_inner</code>, <code>right_itb_light_inner</code>, <code>torso_left_itb_light_inner</code>, <code>torso_right_itb_light_inner</code>
 
|-
 
| ||Nav Outer Lights || <code>left_itb_light_outer</code>, <code>right_itb_light_outer</code>, <code>torso_left_itb_light_outer</code>, <code>torso_right_itb_light_outer</code>
 
|-
 
| ||Configure Valves: || <code>left_blow</code>, <code>right_blow</code>, <code>left_suck</code>, <code>right_suck</code>
 
|-
 
| ||Actuate Pneumatics:|| <code>left_pneumatic</code>, <code>right_pneumatic</code>
 
|-
 
| ||Camera Power: || <code>left_hand_camera_power</code>, <code>right_hand_camera_power</code>, <code>torso_camera_power</code>
 
|-
 
!colspan="3" style="text-align:left;"|Inputs
 
|-
 
| ||(Analog) Raw IR Range Values: || <code>left_hand_range</code>, <code>right_hand_range</code>
 
|-
 
| ||Back Shoulder Buttons: || <code>left_shoulder_button</code>, <code>right_shoulder_button</code>
 
|-
 
| ||Cuff (Squeeze) Sensor: || <code>left_lower_cuff</code>, <code>right_lower_cuff</code>
 
|-
 
| ||Cuff OK Button: || <code>left_lower_button</code>, <code>right_lower_button</code>
 
|-
 
| ||Cuff Grasp Button: || <code>left_upper_button</code>, <code>right_upper_button</code>
 
|-
 
| ||Safety Mat 'is attached': || <code>torso_process_sense0</code>
 
|-
 
| ||Safety Mat 'is NOT actuated': || <code>torso_safety_stop</code>
 
|}
 
  
=== Pneumatics ===
+
The states of the push buttons are the values type in integer at <code>data</code> area. For the wheel on navigator, the <code>data</code> field returns an integer between [0-255].  Each physical 'click' of the wheel corresponds to a +/-1 increment.  The value will loop when it goes above or below the bounds.
Baxter is equipped with a pneumatic valve system that can be controlled independently on the left and right sides and fed to proper grippers for suction-based picking.
+
The values have corresponding meaning: <code>0:'OFF', 1:'CLICK', 2:'LONG_PRESS', 3:'DOUBLE_CLICK'</code>
&nbsp;&nbsp;
 
  
==== Configure Valves ====
 
''Blow'' 
 
'''Component IDs:'''
 
<code>left_blow</code>, <code>right_blow</code> 
 
<code>/robot/digital_io/<side>_blow/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/DigitalIOState.msg baxter_core_msgs-DigitalIOState]) 
 
* Use to switch on/off the suck ''valve'' -- (does not activate suction).
 
* Use this setting to grip objects in most cases.
 
  
''Suck''   
+
'''<Component ID>_button_ok:'''  The circular button in the middle of the navigator.
'''Component IDs:'''
+
'''<Component ID>_button_back:''' The button above the OK button, typically with a 'Back' arrow symbol.
<code>left_suck</code>, <code>right_suck</code>   
+
*  '''<Component ID>_button_show:'''  The "Rethink Button", is above the OK button, next to back button and typically is labeled with the Rethink logo.
<code>/robot/digital_io/<side>_suck/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/DigitalIOState.msg baxter_core_msgs-DigitalIOState]) 
+
*  '''<Component ID>_button_triangle(the 'X' button):''' The button below circle button and square button.
* Use to switch off the blow ''valve'' -- (does not activate suction).
+
*  '''<Component ID>_button_circle:'''  The button labeled with a circle, next to the square button.
* Use this setting to release objects in most cases.
+
*   '''<Component ID>_button_square:'''  The button labeled with a square, next to the circle button.
 +
*   '''<Component ID>_wheel:''' The wheel of circular button in the middle of the navigator.
  
==== Actuate Pneumatics ====
 
''Turn On/Off Pneumatic Pressure/Airflow'' 
 
'''Component IDs:'''
 
<code>left_pneumatic</code>, <code>right_pneumatic</code> 
 
<code>/robot/digital_io/<side>_pneumatic/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/DigitalIOState.msg baxter_core_msgs-DigitalIOState]) 
 
*  This is how to use the pneumatic message.
 
  
==== Camera Power ====
+
== Cuff Buttons ==
'''Component IDs:'''
+
There are two buttons and one touch sensor in the cuff of the hand: cuff button, OK button and cuff grasp button.  The state of each button is published in a DigitalIOState message under its own topic (DigitalIOState constants: PRESSED==1, UNPRESSED==0). Integer <code>data</code> will read PRESSED (1) when the cuff sensor is squeezed, and UNPRESSED (0) otherwise.
<code>left_hand_camera_power</code>, <code>right_hand_camera_power</code>, <code>torso_camera_power</code> 
 
<code>/robot/digital_io/<location>_camera_power/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/DigitalIOState.msg baxter_core_msgs-DigitalIOState])
 
  
=== Analog IO ===
+
'''Component IDs:''' <code>right_cuff, right_button_lower, right_button_upper</code>.
  
''(Analog) Input State''
+
'''Read Button Squeezed:''' <code>/io/robot/cuff/state</code> ([https://rethinkrobotics.github.io/intera_sdk_docs/5.0.4/intera_core_msgs/html/msg/IODeviceStatus.html intera_core_msgs-IODeviceStatus])
<code>/robot/analog_io/<component_id>/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/AnalogIOState.msg baxter_core_msgs-AnalogIOState])
 
* <code>value</code>: is an integer often either rounded up from the hundreds decimal place or going from [0-100] 
 
  
''(Analog) Output Control''
+
'''Command Cuff:'''<code>/io/robot/cuff/command</code>([https://rethinkrobotics.github.io/intera_sdk_docs/5.0.4/intera_core_msgs/html/msg/IOComponentCommand.html intera_core_msga-IOComponentCommand])
<code>/robot/analog_io/command</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/AnalogOutputCommand.msgbaxter_core_msgs-AnalogOutputCommand])
 
* name: <code><component_id></code>
 
* value: [0-65535] - (uint16)
 
   
 
* Publish a AnalogOutputCommand message with the component id of the Output as the <code>name</code> and a uint16 <code>value</code> from [0-65535].
 
  
  
{| class="wikitable"
+
== Lights ==
!colspan="3"|All Analog Component IDs
+
The head LEDs at the top of Sawyer's head, and navigator LEDs are inside of navigator.
|-
 
!colspan="3" style="text-align:left;"|Outputs
 
|-
 
|style="width:3em;"| <!-- spacer cell for columns; need once in table -->
 
|Workspace Lights: || <code>torso_lighting</code>
 
|-
 
| ||Torso Fan: || <code>torso_fan</code>
 
|-
 
!colspan="3" style="text-align:left;"|Inputs
 
|-
 
| ||(Analog) Raw IR Range Values: || <code>left_hand_range</code>, <code>right_hand_range</code>
 
|-
 
| ||Vacuum Sensor: || <code>left_vacuum_sensor_analog</code>, <code>right_vacuum_sensor_analog</code>
 
|}
 
  
==== Torso Fan ====
+
To get state or set command to HALO and Navigator LEDS, we are using <code>IODeviceInterface</code> to config, status and command topics. The data are type in bool in <code>data</code> area.
'''Component IDs:'''
 
<code>torso_fan</code>
 
''Control Fan Speed'' 
 
<code>/robot/analog_io/command</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/AnalogOutputCommand.msg baxter_core_msgs-AnalogOutputCommand]) 
 
* value: [0-100] power to the fan:
 
* (0 = Auto, 1 = Off, 100 = Full-on)
 
* Auto: Automatic control by hardware, based on torso board heatsink.
 
  
''Fan State''
+
'''Lights Component IDs:'''<br />
<code>/robot/analog_io/torso_fan/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/AnalogIOState.msg baxter_core_msgs-AnalogIOState])  
+
<code>head_red_light</code>, <code>head_blue_light</code>, <code>head_green_light</code>, <code>right_hand_blue_light</code>, <code>right_hand_green_light</code>, <code>right_hand_red_light</code>
* <code>value</code>: Current fan setting [0.0-100.0]
 
  
==== (Analog) Raw IR Range Values ====
+
'''LEDs State:''' <code>/io/robot/robot/state</code> ([https://rethinkrobotics.github.io/intera_sdk_docs/5.0.4/intera_core_msgs/html/msg/IODeviceStatus.html intera_core_msgs-IODeviceStatus])
Values are shifted by 3 decimal points (essentially in mm). 
 
'''Component IDs:'''
 
<code>left_hand_range</code>, <code>right_hand_range</code> 
 
  
''Standard Integer Value'
+
'''Command Light:'''<code>/io/robot/robot/command</code>([https://rethinkrobotics.github.io/intera_sdk_docs/5.0.4/intera_core_msgs/html/msg/IOComponentCommand.html intera_core_msga-IOComponentCommand])
<code>/robot/analog_io/<side>_hand_range/value_uint32</code> ([http://www.ros.org/doc/api/std_msgs/html/msg/UInt32.html std_msgs-UInt32])  <br />
 
''Analog Stamped State'
 
<code>/robot/analog_io/<side>_hand_range/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/AnalogIOState.msg baxter_core_msgs-AnalogIOState])
 
  
==== Vacuum Sensor ====
+
</div>
'''Component IDs:'''
 
<code>left_vacuum_sensor_analog</code>, <code>right_vacuum_sensor_analog</code>  <br />
 
''Standard Integer Value'' 
 
<code>/robot/analog_io/<side>_vacuum_sensor_analog/value_uint32</code> ([http://www.ros.org/doc/api/std_msgs/html/msg/UInt32.html std_msgs-UInt32])  <br />
 
''Analog Stamped State'' 
 
<code>/robot/analog_io/<side>_vacuum_sensor_analog/state</code> ([http://github.com/RethinkRobotics/baxter_common/blob/release-0.7.0/baxter_core_msgs/msg/AnalogIOState.msg baxter_core_msgs-AnalogIOState])
 

Revision as of 14:04, 15 September 2017

This page serves as a lookup reference for all the hardware and functionality for the SDK. The main interface of the SDK is via ROS Topics and Services, which you will find listed and described below along with other core information needed to interface with the robot.

Robot

Enable Robot

Be sure that you 'Enable' the robot before attempting to control any of the motors. The easiest method for controlling the robot is to use the enable_robot.py ROS executable found in the following example:Enable Robot Script

Robot State

/robot/state (intera_core_msgs/AssemblyState) Subscribe to the Robot State for the enabled and error state of the robot hardware itself. It also includes information on the EStop. The robot must be enabled (enabled: true) in order to move the robot. Use the Enable Robot Script, or the "Enable Robot Topic" below, to enable the robot. It is possible for the robot to have non-fatal errors, so error can be true while enabled is also true. For more complete information on robot state, see E-STOP and Enable Robot.

Enable Robot

/robot/set_super_enable (std_msgs/Bool) data: true to Enable robot motors; false to disable. You can check the Robot State Topic to see if the robot enabled properly or if it has an error.

Reset Robot State

/robot/set_super_reset (std_msgs/Empty) Publish an Empty message to reset the state after an error. A reset will clear all pre-existing errors and the state (it will disable).


Robot Description (URDF)

Sawyer automatically builds an appropriate URDF (Unified Robot Description Format) on boot and loads it onto the ROS Parameter Server, under the ROS parameter name /robot_description. From here, it is accessible by rviz, tf and other ROS utilities that use the URDF.

The Unified Robot Description Format (URDF) is the standard ROS XML representation of the robot model (kinematics, dynamics, sensors) describing Sawyer.

Sawyer generates his URDF dynamically on robot startup. This model is updated when any gripper is attached or detached, an object is 'grasped' or released and its mass is compensated for, and when new urdf segments are provided/commanded to the gripper plugins. As of SDK versions >= 1.0.0 Sawyer's internal robot model, is loaded to the parameter server on the topic /robot_description

The default URDF for Sawyer is available in the intera_common repository. The package sawyer_description contains the URDF and accompanying meshes.

Getting a Copy of the URDF from the parameter server

You can now get the current URDF describing your Sawyer.

From a properly initialized Sawyer environment, export the URDF from the /robot_description parameter on the ROS parameter server where it is stored, to a file of your choice (ex: sawyer_urdf.xml):

$ rosparam get -p /robot_description | tail -n +2 > sawyer_urdf.xml

The -p outputs the parameter using pretty print. The output urdf is piped through the tail command first to remove a dummy first line - an artifact of the pretty print.

Tip: You can check that you now have a proper URDF by running:

$ rosrun urdfdom check_urdf sawyer_urdf.xml

Robot State Publisher

The URDF is used by Sawyer's Robot State Publishers to create a tree of transforms (tfs). In fact, Sawyer has two of such publishers: robot_ref_publisher: publishes transforms that reflect the commanded robot state. robot_state_publisher: publishes transforms that reflect the measured state of the robot.

These robot publishers live internal to Sawyer and are accessible to the RSDK over ROS. The "ref" tfs are used by the robot internals, but you may find them useful to see where the robot will move at the next timestep. Otherwise, be sure to use the non-"ref" transforms if you're only interested in the Sawyer's current state.

Getting a Copy of the URDF Dynamically

Sawyer generates the URDF dynamically on initialization, based on the attached arm. In some cases, users may want to get the current URDF off the robot. From a working Sawyer RSDK environment, export the URDF from the /robot_description parameter on the ROS parameter server where it is stored, to a file of your choice (ex: sawyer_urdf.xml):

$ rosparam get -p /robot_description | tail -n +2 > sawyer_urdf.xml

The -p outputs the parameter using pretty print. The output urdf is piped through the tail command first to remove a dummy first line - an artifact of the pretty print.

Tip: You can check that you now have a proper URDF by running:

$ rosrun urdf_parser check_urdf sawyer_urdf.xml

If this doesn't work, you can just remove the tail command and use a text editor to manually remove the first few lines before the actual xml (all the lines before <?xml version="1.0" ?>).

    $ rosparam get -p /robot_description > sawyer_urdf.xml
    $ head sawyer_urdf.xml
    |  
      <?xml version="1.0" ?>  
      <!-- =================================================================================== -->  
      <!-- |    This document was autogenerated by xacro from sawyerp2.urdf.xacro            | -->  
    ...  
    $ gedit sawyer_urdf.xml &
    $ head sawyer_urdf.xml
      <?xml version="1.0" ?>  
      <!-- =================================================================================== -->  
      <!-- |    This document was autogenerated by xacro from sawyerp2.urdf.xacro            | -->  
    ...


Movement

Joints

Sawyer has 7 joints (DoF) in arm and one more joint in its head (side-to-side panning). The control for the head is done separately from the arm; however, you can read the current joint states (position, velocity, and effort) for all the joints on arm and head by subscribing to one topic: /robot/joint_states (sensor_msgs-JointState) where the units for the position of a joint are in (rad), the units of velocity are in (rad/s) and the units of effort in each joint is in (Nm).

Arm Joints

The following sections cover the arm joints sensing and control in more detail: Arm Joints.

Head Joints

The head state topic will give you the current pan angle (side-to-side) of the head and report boolean status flags if the robot is currently moving its head.

Note: Flags may not report 'true' values until after the first respective movement command is sent.

Component ID:head_pan

Head State:
/robot/head/head_state (intera_core_msgs-HeadState). pan field gives you the current angle (radians) of the head. 0 is forward, -pi/2 to Sawyer's right, and +pi/2 to Sawyer's left. isPanning is boolean field that will switch to True while the robot is executing a command.

Note: The isPanning field is initialized to True upon startup and will update thereafter.

Head (Joint) State:
/robot/joint_states (sensor_msgs-JointState).The position of the head may also be determined from the joint_state message.

Head Movement Control

Pan Head:
/robot/head/command_head_pan (intera_core_msgs-HeadPanCommand) target sets the target angle. 0.0 is straight ahead. speed is an integer from [0-100], 100 = max speed. Setting an angle in the command_head_pan topic does not gurantee the head will get to that position. There is a small deband around the reference angle around the order of +/- 0.12 radians.

Example:

    # Check head position/state: 
    $ rostopic echo /robot/head/head_state
    # Move (pan) head side-to-side: 
    $ rostopic pub /robot/head/command_head_pan intera_core_msgs/HeadPanCommand -- 0.0 100


Cartesian Endpoint

Published at 100 Hz, the endpoint state topic provides the current Cartesian Position, Velocity and Effort at the endpoint for either limb.

Endpoint State

Endpoint State: /robot/limb/right/endpoint_state intera_core_msgs-EndpointState). The endpoint state message provides the current position/orientation pose, linear/angular velocity, and force/torque effort of the robot end-effector at 100 Hz. Pose is in Meters, Velocity in m/s, Effort in Nm. The robot's "endpoint" is definied as the right_gripper tf frame. This frame is updated dynamically when gripper is connected to the robot . The URDF on the parameter server will now update when the Robot Model is updated by Gripper changes. Check the ROS Parameter for an updated copy of the URDF, especially before using IK or motion planners, such as MoveIt!.

Kinematics Solver Service

The following sections cover the Forward Kinematics Solver Service and Inverse Kinematics Solver Service in more detail: Kinematics Solvers


Gripper (End-Effector)

Before using an End-Effector, or Gripper, you must first send the calibration command. You can check whether the gripper has been calibrated yet by echoing on the gripper state topic for that hand. Once calibrated, gripper can be controlled using the simplified command_grip and command_release topics, or using the more direct command_set topic. For more information on using the gripper, see the Gripper Example Program.

Gripper Configuration

(intera_core_msgs-IOComponentCommand)

Calibrate Gripper
Publish an IO Command message to calibrate a new gripper by set signal calibrate to True. Gripper should open and close once. The calibrated field of the gripper state topic will also update to '1' after successful calibration. Once calibrated, the gripper will not calibrate again unless the command reset message is sent, or the robot is restarted.

Reset Gripper
Publish an IO Command message to reset the gripper state by set signal reboot to True. The calibrated field of the gripper state message will reset to '0'.

Gripper State

Gripper State
/io/end_effector/state The io signal calibrated field must be true (1) before you can control the gripper. Use the IO command to calibrate the gripper. The gripper state message will also give you the current position, force, and if the gripper is current moving. Position is from [0.0-100.0] [close-open].

Simple Gripper Control

Simple Gripper Close
/io/end_effector/command the signal 'position_m' value to MIN_POSITION: 0.0. Publish an IO Command message to grip.

Simple Gripper Open
/io/end_effector/command the signal 'position_m' value to MAX_POSITION: 0.041667. Publish an IO Command message to release.


Sensors+

Accelerometer

The robot hand has a 3-axis accelerometer located inside the cuff, in the same plane as the gripper electrical connection header. The positive z-axis points back 'up' the arm (towards the previous wrist joint, j6). The positive x-axis points towards the direction of gripper, and the y-axis points towards the cuff buttons, using standard Right-Hand-Rule notation.

Component IDs:
right_accelerometer

Accelerometer State:
/robot/accelerometer/<component_id>/state(sensor_msgs-ImuMessage)

Acceleration values (in m/s^2) are published under linear_acceleration for the x, y, and z axes. The force of gravity is NOT compensated for.

names: ['right_accelerometer']
states: 
  - 
    header: 
      seq: 120921
      stamp: 
        secs: 0
        nsecs: 0
      frame_id: ''
    orientation: 
      x: 0.0
      y: 0.0
      z: 0.0
      w: 0.0
    orientation_covariance: [-1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
    angular_velocity: 
      x: 0.0
      y: 0.0
      z: 0.0
    angular_velocity_covariance: [-1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
    linear_acceleration: 
      x: 0.0
      y: 0.0
      z: 0.0
    linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]


Cameras

You can access Sawyer's hand camera and the head camera using the standard ROS image types and image_transport mechanism listed below. You can use the ROS Services to open, close, and configure each of the cameras. See the Camera Image Display Example for more information on using the cameras. Useful tools for using cameras in ROS include rviz Camera Display.

IMPORTANT: You can only have one open at a time at standard resolutions, due to bandwidth limitations.

Component IDs: right_hand_camera, head_camera

Camera Published Topics

Raw Image: /internal_camera/<component_id>/image_raw (sensor_msgs-Image)

Camera Intrinsics: /internal_camera/<component_id>/camera_info (sensor_msgs-CameraInfo)

Rectify Color Image: /internal_camera/head_camera/image_rect_color (image_proc)

Rectify Image: /internal_camera/right_hand_camera/image_rect (image_proc)


Head Display Screen

Images can be displayed on Sawyer's LCD screen by publishing the image data as a ROS sensor_msgs/Image.

Display Image/robot/head_display (sensor_msgs-Image).

Publish image data as a ROS Image message to update the display. The screen resolution is 1024 x 600. Images smaller than this will appear in the top-left corner. There are dedicated ROS packages for working with and sending ROS Image messages, including image_transport and image_pipeline. Useful tools for working with images in ROS include Image_view and republish. Also see camera_drivers for assistance working with your own cameras.

For more information on displaying images to Sawyer's LCD screen, see the Head Display Image Example.

Inputs and Outputs

Navigators

There are two Navigators on Sawyer's body: one on side of the body and one on the arm. Each Navigator is comprised of three push buttons, one of which is also an indexing scroll wheel, and one set of white LED light.

Component IDs: right, head

Read Button States:/io/robot/navigator/state (intera_core_msgs-IODeviceStatus)

Wheel State:/io/robot/navigator/state (intera_core_msgs-IODeviceStatus)

Command Buttons:/io/robot/navigator/command(intera_core_msga-IOComponentCommand)

The states of the push buttons are the values type in integer at data area. For the wheel on navigator, the data field returns an integer between [0-255]. Each physical 'click' of the wheel corresponds to a +/-1 increment. The value will loop when it goes above or below the bounds. The values have corresponding meaning: 0:'OFF', 1:'CLICK', 2:'LONG_PRESS', 3:'DOUBLE_CLICK'


  • <Component ID>_button_ok: The circular button in the middle of the navigator.
  • <Component ID>_button_back: The button above the OK button, typically with a 'Back' arrow symbol.
  • <Component ID>_button_show: The "Rethink Button", is above the OK button, next to back button and typically is labeled with the Rethink logo.
  • <Component ID>_button_triangle(the 'X' button): The button below circle button and square button.
  • <Component ID>_button_circle: The button labeled with a circle, next to the square button.
  • <Component ID>_button_square: The button labeled with a square, next to the circle button.
  • <Component ID>_wheel: The wheel of circular button in the middle of the navigator.


Cuff Buttons

There are two buttons and one touch sensor in the cuff of the hand: cuff button, OK button and cuff grasp button. The state of each button is published in a DigitalIOState message under its own topic (DigitalIOState constants: PRESSED==1, UNPRESSED==0). Integer data will read PRESSED (1) when the cuff sensor is squeezed, and UNPRESSED (0) otherwise.

Component IDs: right_cuff, right_button_lower, right_button_upper.

Read Button Squeezed: /io/robot/cuff/state (intera_core_msgs-IODeviceStatus)

Command Cuff:/io/robot/cuff/command(intera_core_msga-IOComponentCommand)


Lights

The head LEDs at the top of Sawyer's head, and navigator LEDs are inside of navigator.

To get state or set command to HALO and Navigator LEDS, we are using IODeviceInterface to config, status and command topics. The data are type in bool in data area.

Lights Component IDs:
head_red_light, head_blue_light, head_green_light, right_hand_blue_light, right_hand_green_light, right_hand_red_light

LEDs State: /io/robot/robot/state (intera_core_msgs-IODeviceStatus)

Command Light:/io/robot/robot/command(intera_core_msga-IOComponentCommand)