Difference between pages "Joint Trajectory Playback Example" and "SDK Concepts"

(Difference between pages)
Jump to: navigation , search
(Usage)
 
 
Line 1: Line 1:
__NOTOC__
 
 
<div class="title-block">
 
<div class="title-block">
 +
<span style="font-size:120%;">'''This page contains a list of Concepts summarizing the basic functionality of the SDK on Intera'''</span>
 +
</div>
  
<span style="font-size:120%;">'''Enable the robot joint trajectory interface, parse a file created using the joint position recorder example, and send the resulting joint trajectory to the action server.'''</span>
+
{{TOClimit|limit=2}}
  
</div>
+
<div class="content-block">
  
<div class="content-block">
+
== Development Environment ==
  
== Code Walkthrough ==
+
Throughout the Wiki, Tutorials, and SDK, we refer to the "SDK Shell" and your "ROS Workspace" or "Environment".  These are simple environment concepts and configurations that are useful to have a basic understanding of when using the Baxter SDK and ROS.
<span style="font-size:120%;">[[Joint Trajectory Playback Example -_Code_Walkthrough | Joint Trajectory Playback Example - Code Walkthrough]]</span>
+
*; ROS Workspace
 +
*: Your "ROS Workspace" (also called a "[http://wiki.ros.org/catkin/workspaces Catkin Workspace]" in the ROS world), is the '''<code>~/ros_ws/</code>''' directory you setup in the [[Getting Started|Getting Started Tutorials]]. Inside the <code>src/</code> sub-directory, you can create or checkout source code as ROS Packages (such as the baxter sdk packages), which you can then compile and link against via the <code>devel/</code> or <code>install/</code> sub-directories.
  
</div>
+
*; [[SDK Shell]]
 +
*: The SDK Shell is a term we use to refer to a session in a [http://en.wikipedia.org/wiki/Shell_(computing) shell], or Terminal, with the ROS Environment Variables properly configured to point to your ROS Workspace, the Baxter Robot, and your computer's ROS ID.
 +
*: The '''<code>[[baxter.sh]]</code>''' file is the script you setup to take care of configuring all that for you.
 +
*: <br />
 +
*: You need to be in a proper RSDK Shell before you use most of the ROS tools or run any of the SDK examples or programs. Therefore you should run the <code>./baxter.sh</code> script at the start of each Terminal session.  All the script does is start a convenient "sub-shell" that fills in the necessary Environment Variables as you configured.
  
<div class="content-block">
+
*; Environment Variables
 +
*: The [http://wiki.ros.org/ROS/EnvironmentVariables ROS Environment Variables] have three important functions:
 +
*:# Identifying your Baxter and Workstation on the ROS Network, based on your [[Networking|Network Configuration]].
 +
*:# Pointing to the path of the ROS Packages, tools, and programs, when you use rosrun (execute programs).
 +
*:# Linking to the libraries and workspaces when compiling source code.
  
== Overview ==
 
  
A commonly used ROS method for robot arm motion control is the joint trajectory action interface. The trajectory_controller and it's corresponding joint trajectory action server is the intera_interface implementation to support this action interface. This example shows usage for launching the joint trajectory action server, and parsing of a text file describing timestamped joint position goals into a joint trajectory action call to be commanded to the joint trajectory action server.
+
If you are new to the ROS world, it is highly recommended you take the time to go through the Beginner Level [http://wiki.ros.org/ROS/Tutorials#Core_ROS_Tutorials Core ROS Tutorials]. My personal recommendation is to at least do:
 +
* The first few Configure through 'Understanding ROS' tutorials - ''('''Remember:''' we use <code>~/ros_ws/</code> instead of <code>~/catkin_ws/</code> but they are exactly the same)''.
 +
* Also, the '[http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28python%29 Writing a Simple Publisher and Subscriber]' tutorials can be pretty useful when it comes to writing your first ROS program for the ROS newbie.
  
 
</div>
 
</div>
Line 23: Line 34:
 
<div class="content-block">
 
<div class="content-block">
  
== Usage ==
+
== Writing Programs ==
 
+
At the core of the SDK are the interfaces provided to control and access all of the Baxter Research Robot's motors and sensors.  These sections describe the hardware components of the robot and the foundation API layers upon which the SDK - and your programs - are built. These sections describe the ''Components of the Robot'', and the ''Interfaces'' to control them.
Verify that the robot is enabled from an [[SDK Shell|SDK terminal session]], ex:
 
  
<syntaxhighlight lang="bash" enclose="div">
+
=== SDK Foundations (Interfaces) ===
$ rosrun intera_interface robot_enable.py
 
</syntaxhighlight>
 
  
Record a joint position file using the recorder.py example, ex:
+
The SDK provides interfaces that control the robot hardware layer via the Robot Operating System (ROS) to any other computers on the robot's network.  By using the ROS network layer API, any client library or program that can "speak ROS" can control the robot directly. For a deeper understanding of the SDK System architecture see:
 +
* [[SDK System Overview|SDK System Overview]]
  
<syntaxhighlight lang="bash" enclose="div">
+
By using the foundation ROS interface layer, the robot can be controlled and programmed in any Programming Language that supports ROS. This has led to a number of user-created interface libraries in different languages.  In addition, the Python Baxter Interface provides a Python Class-based interface library, which wraps many of the ROS interfaces in Python Classes.
$ rosrun intera_examples recorder.py -f <position_file_name>
 
</syntaxhighlight>
 
  
The recorder is now recording joint positions with corresponding timestamps for robot arm. Move the arms while holding the cuffs. If the position file name exists, the function will overwrite existing file.
+
=== ROS Interface ===
 +
The ROS Interface is the foundation upon which all interaction with the Baxter Research Robot passes through and all other interface layers are built upon. The ROS layer is accessible over the network via any of the standard [http://wiki.ros.org/Client%20Libraries ROS Client Libraries] such as [http://wiki.ros.org/rospy rospy (Python)] or [http://wiki.ros.org/roscpp roscpp (C++)].
  
NOTE: You can open and close the gripper while recording by using the robot's cuff buttons: Oval(lower) = Close, Circle(Upper) = Open
+
*; [[API Reference|ROS API Reference]]
 +
*: The ROS API describes the base interface layer for direct access from the command line or any language.
  
Start the joint trajectory controller, ex:
+
=== Python Interface ===
 +
The Baxter SDK also offers a Python API via the <code>baxter_interface</code> module.  This module wraps the ROS Interfaces in component-based Python Classes.  The SDK Examples are written using this library in order to demonstrate how to use the robot interfaces.
 +
*; [[Robot Interface|Robot Interface Overview]]
 +
*: Gives a basic introduction to each class and component in the Python interface library 'baxter_interface'.
  
<syntaxhighlight lang="bash" enclose="div">
+
*; [http://api.rethinkrobotics.com Code API]
$ rosrun intera_interface joint_trajectory_action_server.py --mode velocity
+
*: View the generated Python Code API docs for the baxter_interface module.
</syntaxhighlight>
 
 
 
In another RSDK terminal session, Run the joint trajectory playback example program, ex:
 
 
 
<syntaxhighlight lang="bash" enclose="div">
 
$ rosrun intera_examples joint_trajectory_file_playback.py -f <position_file_name>
 
</syntaxhighlight>
 
 
 
The robot arm will then be commanded to repeat the trajectory recorded during the joint position recording. The difference between this example and the joint_position playback example is that the trajectory controller has the ability to honor the velocities (due to the timestamps) to more accurately repeating the recorded trajectory.
 
  
 
</div>
 
</div>
Line 59: Line 62:
 
<div class="content-block">
 
<div class="content-block">
  
== Arguments ==
+
== Robot Hardware Foundations ==
'''Important Arguments:'''
 
Arguments for joint_trajectory_action_server.py
 
  
See the trajectory controller's usage on the command line by passing trajectory_controller.py the -h, help argument:
+
To learn more about what sensors and motors are on the robot and how to use them, see:
 +
* [[Hardware Components|Sawyer Components]]
 +
When you have run through the Installation procedures and you've established communication with your robot, it is time to start getting familiar with the SDK interface. This page will walk you through the basics of using the SDK.
  
<syntaxhighlight lang="bash" enclose="div">
+
</div>
$ rosrun intera_interface joint_trajectory_action_server.py -h
 
</syntaxhighlight>
 
 
 
<syntaxhighlight lang="bash" enclose="div">
 
Intera SDK Joint Trajectory Controller
 
 
 
    Unlike other robots running ROS, this is not a Motor Controller plugin,
 
    but a regular node using the SDK interface.   
 
 
 
optional arguments:
 
  -h, --help            show this help message and exit
 
  -l {right}, --limb {right}
 
                        joint trajectory action server limb (default: right)
 
  -r RATE, --rate RATE  trajectory control rate (Hz) (default: 100.0)
 
  -m {position_w_id,position,velocity}, --mode {position_w_id,position,velocity}
 
                        control mode for trajectory execution (default:
 
                        position_w_id)
 
 
 
</syntaxhighlight>
 
 
 
'''Important Arguments:'''
 
Arguments for joint_trajectory_file_playback.py
 
 
 
See the joint_trajectory_file_playback's usage on the command line by passing joint_trajectory_file_playback.py the -h, help argument:
 
 
 
<syntaxhighlight lang="bash" enclose="div">
 
$ rosrun intera_interface joint_trajectory_file_playback.py -h
 
</syntaxhighlight>
 
 
 
<syntaxhighlight lang="bash" enclose="div">
 
RSDK Joint Trajectory Example: File Playback
 
 
 
    Plays back joint positions honoring timestamps recorded
 
    via the joint_recorder example.
 
 
 
    Run the joint_recorder.py example first to create a recording
 
    file for use with this example. Then make sure to start the
 
    joint_trajectory_action_server before running this example.
 
 
 
    This example will use the joint trajectory action server
 
    with velocity control to follow the positions and times of
 
    the recorded motion, accurately replicating movement speed
 
    necessary to hit each trajectory point on time.
 
 
 
required arguments:
 
  -f FILE, --file FILE  path to input file
 
optional arguments:
 
  -h, --help            show this help message and exit
 
  -l LOOPS, --loops LOOPS
 
                        number of playback loops. 0=infinite. (default: 1)
 
</syntaxhighlight>
 
  
 
<div class="content-block">
 
<div class="content-block">
 
== Interfaces ==
 
 
ROS APIs
 
See the API Reference page for details.
 
Joint Trajectory Action Server - /robot/limb/right/follow_joint_trajectory [control_msgs/FollowJointTrajectoryAction]
 
 
Intera_interface APIs
 
JointTrajectoryActionServer class: joint_trajectory_action_server.py
 
 
 
</div>
 

Revision as of 21:17, 17 November 2016

This page contains a list of Concepts summarizing the basic functionality of the SDK on Intera

Development Environment

Throughout the Wiki, Tutorials, and SDK, we refer to the "SDK Shell" and your "ROS Workspace" or "Environment". These are simple environment concepts and configurations that are useful to have a basic understanding of when using the Baxter SDK and ROS.

  • ROS Workspace
    Your "ROS Workspace" (also called a "Catkin Workspace" in the ROS world), is the ~/ros_ws/ directory you setup in the Getting Started Tutorials. Inside the src/ sub-directory, you can create or checkout source code as ROS Packages (such as the baxter sdk packages), which you can then compile and link against via the devel/ or install/ sub-directories.
  • SDK Shell
    The SDK Shell is a term we use to refer to a session in a shell, or Terminal, with the ROS Environment Variables properly configured to point to your ROS Workspace, the Baxter Robot, and your computer's ROS ID.
    The baxter.sh file is the script you setup to take care of configuring all that for you.

    You need to be in a proper RSDK Shell before you use most of the ROS tools or run any of the SDK examples or programs. Therefore you should run the ./baxter.sh script at the start of each Terminal session. All the script does is start a convenient "sub-shell" that fills in the necessary Environment Variables as you configured.
  • Environment Variables
    The ROS Environment Variables have three important functions:
    1. Identifying your Baxter and Workstation on the ROS Network, based on your Network Configuration.
    2. Pointing to the path of the ROS Packages, tools, and programs, when you use rosrun (execute programs).
    3. Linking to the libraries and workspaces when compiling source code.


If you are new to the ROS world, it is highly recommended you take the time to go through the Beginner Level Core ROS Tutorials. My personal recommendation is to at least do:

  • The first few Configure through 'Understanding ROS' tutorials - (Remember: we use ~/ros_ws/ instead of ~/catkin_ws/ but they are exactly the same).
  • Also, the 'Writing a Simple Publisher and Subscriber' tutorials can be pretty useful when it comes to writing your first ROS program for the ROS newbie.

Writing Programs

At the core of the SDK are the interfaces provided to control and access all of the Baxter Research Robot's motors and sensors. These sections describe the hardware components of the robot and the foundation API layers upon which the SDK - and your programs - are built. These sections describe the Components of the Robot, and the Interfaces to control them.

SDK Foundations (Interfaces)

The SDK provides interfaces that control the robot hardware layer via the Robot Operating System (ROS) to any other computers on the robot's network. By using the ROS network layer API, any client library or program that can "speak ROS" can control the robot directly. For a deeper understanding of the SDK System architecture see:

By using the foundation ROS interface layer, the robot can be controlled and programmed in any Programming Language that supports ROS. This has led to a number of user-created interface libraries in different languages. In addition, the Python Baxter Interface provides a Python Class-based interface library, which wraps many of the ROS interfaces in Python Classes.

ROS Interface

The ROS Interface is the foundation upon which all interaction with the Baxter Research Robot passes through and all other interface layers are built upon. The ROS layer is accessible over the network via any of the standard ROS Client Libraries such as rospy (Python) or roscpp (C++).

  • ROS API Reference
    The ROS API describes the base interface layer for direct access from the command line or any language.

Python Interface

The Baxter SDK also offers a Python API via the baxter_interface module. This module wraps the ROS Interfaces in component-based Python Classes. The SDK Examples are written using this library in order to demonstrate how to use the robot interfaces.

  • Robot Interface Overview
    Gives a basic introduction to each class and component in the Python interface library 'baxter_interface'.
  • Code API
    View the generated Python Code API docs for the baxter_interface module.

Robot Hardware Foundations

To learn more about what sensors and motors are on the robot and how to use them, see:

When you have run through the Installation procedures and you've established communication with your robot, it is time to start getting familiar with the SDK interface. This page will walk you through the basics of using the SDK.