Yes, the semantics of the joint trajectory messages is a little under-specified. Some pointers:
time_from_start
is relative to trajectory.header.stamp
; each trajectory point's time_from_start must be greater than the last - the velocities specify the joint velocities you would like the joints to have at that trajectory point
- the velocities should be all 0 for the first and last trajectory point
- you shouldn't execute such a "hand-crafted" trajectory directly on the robot; instead, run it through a properly set-up
trajectory_filter
pipeline first to make sure it's physically possible to reach the desired joint trajectories at the given time points
I think an example would be nice, so this is a trajectory generated and executed on the Katana robot arm. (Actually, this is the new FollowJointTrajectoryAction and not the old JointTrajectoryAction format, but they are almost identical).
I just noticed while writing this answer that this trajectory might not be an ideal example. The accelerations are all 0, which doesn't make sense; they should either be empty (saying that there are no desired accelerations, and the controller is free to choose) or be filled to sensible values. Seems to be a bug in my trajectory filtering pipeline. Anyway, here you go:
header:
seq: 0
stamp:
secs: 1355824277
nsecs: 243513013
frame_id: ''
goal_id:
stamp:
secs: 1355824277
nsecs: 243517830
id: /kurtana_move_arm-1-1355824277.243517830
goal:
trajectory:
header:
seq: 0
stamp:
secs: 1355824277
nsecs: 443477691
frame_id: ''
joint_names: ['katana_motor1_pan_joint', 'katana_motor2_lift_joint', 'katana_motor3_lift_joint', 'katana_motor4_lift_joint', 'katana_motor5_wrist_roll_joint']
points:
-
positions: [-2.9641690268167444, 2.13549384276445, -2.1556486321117725, -1.9719493470579683, -2.9318804356548496]
velocities: [0.0, 0.0, 0.0, 0.0, 0.0]
accelerations: [0.0, 0.0, 0.0, 0.0, 0.0]
time_from_start:
secs: 0
nsecs: 0
-
positions: [-2.9251733424342388, 2.13549384276445, -2.1556486321117725, -1.9719493470579683, -2.8933095299198217]
velocities: [0.29930315443351097, 0.0, 0.0, -6.139114030773157e-19, 0.2960428554763487]
accelerations: [0.0, 0.0, 0.0, 0.0, 0.0]
time_from_start:
secs: 0
nsecs: 228646348
-
positions: [-2.8849641701621285, 2.13549384276445, -2.1556486321117725, -1.9719493470579683, -2.853538354776994]
velocities: [0.44598050148009644, 0.0, 0.0, 1.823853811086392e-18, 0.4411224512312072]
accelerations: [0.0, 0.0, 0.0, 0.0, 0.0]
time_from_start:
secs: 0
nsecs: 339639817
-
positions: [-2.52736640929761, 2.13549384276445, -2.1556486321117725, -1.9719493470579683, -2.4998358940105807]
velocities: [1.0028722191625212, 0.0, 0.0, -1.6240875412254114e-17, 0.9919479666049925]
accelerations: [0.0, 0.0, 0.0, 0.0, 0.0]
time_from_start:
secs: 0
nsecs: 800369305
-
positions: [-2.2959492044755803, 2.13549384276445, -2.1556486321117725, -1.9719493470579683, -2.2709395088336946]
velocities: [1.0910884747158898, 0.0, 0.0, 4.7121007739083667e-17, 1.0792032855236304]
accelerations: [0.0, 0.0, 0.0, 0.0, 0.0]
time_from_start:
secs: 1
nsecs: 20369305
-
positions: [-2.1094083544721736, 2.13549384276445, -2.1556486321117725, -1.9719493470579683, -2.0864306418873473]
velocities: [1.0870331216234024, 0.0, 0.0, -1.5451562371091847e-16, 1.0751921072527668]
accelerations: [0.0, 0.0, 0.0, 0.0, 0.0]
time_from_start:
secs: 1
nsecs: 190369305
-
positions: [-1.9654064488044534, 2.13549384276445, -2.1556486321117725, -1.9719493470579683, -1.9439973440205225]
velocities: [1.0735605072416647, 0.0, 0.0, 5.153091454187644e-16, 1.0618662495956706]
accelerations: [0.0, 0.0, 0.0, 0.0, 0 ...
(more)