-
Notifications
You must be signed in to change notification settings - Fork 6
Joint trajectory playback example
Enable the robot joint trajectory interface, parse a file created using the joint position recorder example, and send a the resulting joint trajectory to the action server.
Verify that the robot is enabled from an RSDK terminal session, ex:
$ rosrun tools enable_robot.py -e
Record a joint position file using the joint_position recorder.py example, ex:
$ rosrun joint_position recorder.py example_file
The recorder is now recording joint positions with corresponding timestamps for both arms. Move the arms while holding the cuffs. Press any key to exit when done recording.
Start the joint trajectory controller, ex:
$ rosrun baxter_interface trajectory_controller.py
In another RSDK terminal session, Run the joint trajectory playback example program, ex:
$ rosrun joint_trajectory file_playback.py -f example_file
Both arms 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.
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 baxter_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.
For more information on Baxter's arms, see Using the Arms.
See the trajectory controller's usage on the command line by passing trajectory_controller.py the -h
, help argument:
$ rosrun baxter_interface trajectory_controller.py -h
Usage:
trajectory_controller.py [-h] [-l LIMB]
Optional Arguments
-h, --help
- show this help message and exit
-l LIMB, --limb LIMB
- trajectory controller limb [both | left | right] (default: both)
-r RATE, --rate RATE
- trajectory control rate (Hz) (default: 100.0)
See the trajectory test example's usage on the command line by passing trajectory_test.py the '-h', help argument:
$ rosrun joint_trajectory file_playback.py -h
Usage:
trajectory_test.py [-h] -l LIMB
Required Arguments
-f FILE, --file FILE
- input file
Optional Arguments
-h, --help
- show this help message and exit
-l LOOPS, --loops LOOPS
- number of playback loops. 0=infinite.
See the API Reference page for details.
- Joint Trajectory Action Server - /sdk/robot/limb/right/follow_joint_trajectory [control_msgs/FollowJointTrajectoryAction]
- Joint Trajectory Action Server - /sdk/robot/limb/left/follow_joint_trajectory [control_msgs/FollowJointTrajectoryAction]
- JointTrajectoryActionServer class:
joint_trajectory_action_server.py
###The arm is not executing the trajectory Verify that the robot is enabled:
rosrun tools enable_robot.py -e
Verify that the trajectory controller has been started:
rosrun baxter_interface trajectory_controller.py