Joint Trajectory Playback Example

Revision as of 10:54, 7 November 2016 by Swang (talk | contribs) (Interfaces)
Jump to: navigation , search

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.


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.


Verify that the robot is enabled from an SDK terminal session, ex:

$ rosrun intera_interface

Record a joint position file using the example, ex:

$ rosrun intera_examples -f <position_file_name>

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.

NOTE: You can open and close the gripper while recording by using the robot's cuff buttons: Oval(lower) = Close, Circle(Upper) = Open

Start the joint trajectory controller, ex:

$ rosrun intera_interface --mode velocity

In another RSDK terminal session, Run the joint trajectory playback example program, ex:

$ rosrun intera_examples -f <position_file_name>

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.


Important Arguments: Arguments for

See the trajectory controller's usage on the command line by passing the -h, help argument:

$ rosrun intera_interface -h
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:

Important Arguments: Arguments for

See the joint_trajectory_file_playback's usage on the command line by passing the -h, help argument:

$ rosrun intera_interface -h
RSDK Joint Trajectory Example: File Playback

    Plays back joint positions honoring timestamps recorded
    via the joint_recorder example.

    Run the 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)


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: