Baxter's SDK comes equipped with Joint Trajectory Action Server (JTAS) to facilitate users needing to command either (or both) of Baxter's arms through multiple waypoints. These waypoints are supplied as positions, velocities, and/or accelerations for every joint in Baxter's arms. These waypoints are accompanied by a desired timeframe within which the trajectory must complete. The main benefit of this server is its ability to interpolate between supplied waypoints, command Baxter's joints accordingly, and ensure the trajectory is being followed within a specified tolerance. To read more about JTA Servers in general, please see the ROS Wiki page on Joint Trajectory Action. To jump straight to the source code, see the baxter_interface JTAS page on GitHub.
The JTAS has three modes: Velocity, Position, and Raw Position, which are invoked as arguments when calling the action server:
rosrun baxter_interface joint_trajectory_action_server.py
- Velocity Mode (
- Position Mode (
- Inverse Dynamics Feed Forward Position Mode (default mode)
This mode executes direct control of trajectories by calculating and commanding the velocities required to move the arm through a set of joint positions at a specified time. The end result is fast, but less accurate movement.
This mode allows for simple trajectory execution of position-only trajectories. This mode is significantly more accurate than velocity mode, at a cost of a speed reduction.
Inverse Dynamics Feed Forward Position Mode (using Raw Position Mode)
This mode can allow for the highest speed movement with the most accuracy. By supplying desired Positions, Velocities, and Accelerations for each joint, you give Baxter to anticipate and correct for the dynamics of its movement by "feeding forward" Velocities and Accelerations to the Motor Controller. This enables Baxter to use both feedback from its spring deflection sensors, and feed forward from dynamics of the anticipated trajectory to accurately execute trajectories.
This mode accepts trajectories with Position, Velocity, and/or Acceleration supplied for each joint. Position is required, but Velocity and Acceleration are optional. Supplying Position alone will give you movement very similar to regular Position mode. If the optional Velocities and Accelerations are supplied, they are splined together with Position, and then commanded over the /robot/inverse_dynamics topic. MoveIt! supplies these three dimensions by default, so it is highly recommended that you use this mode when using that motion planner.
In all three modes, sparse points are supplied for each joint, and it is the JTAS' responsibility to interpolate these points in their supplied dimension space into an executable trajectory. This is accomplished through the Bezier Library. Cubic Bezier Splines are calculated for each segment of two points in the trajectory for Position and Velocity and Acceleration (if the latter are supplied). The the tangents of the trajectories must match between segments in all supplied dimensions. Please see this project description by Professor Jean Gallier for an in depth explanation of these Bezier Curves in 2D. Keep in mind, this work was extended to accommodate three dimensions in case Position, Velocity and Acceleration are all supplied.