0
$\begingroup$

Rosanswers logo

I've followed this tutorial

When I tried to fill in the action goal of the type JointTrajectoryActionGoal, I didn't know what value shoud goal.goal.trajectory.points[i].velocities[i] and goal.goal.trajectory.points[i].time_from_start be, which belonged to trajectory_msgs/JointTrajectoryPoint.msg

I've tried several value and felt that time_from_start seemed to be related to the total execution time, but still got no idea about velocities, which tended to make the trajectory weird.

I would like to know what's the meaning behind these parameters and how to set it up properly. Thanks~


Originally posted by Albert K on ROS Answers with karma: 301 on 2012-12-16

Post score: 3

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.0]
        time_from_start: 
          secs: 1
          nsecs: 324259613
      - 
        positions: [-1.7266965336015323, 2.13549384276445, -2.1556486321117725, -1.971949347057968, -1.7078876877058584]
        velocities: [1.0955434012456187, 0.0, 0.0, 5.577067357268163e-16, 1.0836096846920393]
        accelerations: [0.0, 0.0, 0.0, 0.0, 0.0]
        time_from_start: 
          secs: 1
          nsecs: 544259614
      - 
        positions: [-1.5618053834346186, 2.13549384276445, -2.1556486321117725, -1.971949347057968, -1.5447926911610177]
        velocities: [1.1002506664107818, 0.0, 0.0, -1.6280551286439496e-16, 1.0882656737798182]
        accelerations: [0.0, 0.0, 0.0, 0.0, 0.0]
        time_from_start: 
          secs: 1
          nsecs: 694259614
      - 
        positions: [-1.352801108899281, 2.13549384276445, -2.1556486321117725, -1.971949347057968, -1.3380650929928186]
        velocities: [1.0995760502885568, 0.0, 0.0, 3.1423072274376064e-17, 1.087598406227786]
        accelerations: [0.0, 0.0, 0.0, 0.0, 0.0]
        time_from_start: 
          secs: 1
          nsecs: 884388906
      - 
        positions: [-1.2428109699673853, 2.13549384276445, -2.1556486321117725, -1.971949347057968, -1.229273072857686]
        velocities: [1.099721341194797, 0.0, 0.0, -1.0271726233852743e-17, 1.0877421144851813]
        accelerations: [0.0, 0.0, 0.0, 0.0, 0.0]
        time_from_start: 
          secs: 1
          nsecs: 984388907
      - 
        positions: [-1.0668126798340363, 2.13549384276445, -2.1556486321117725, -1.971949347057968, -1.0551919260396805]
        velocities: [1.101621901250425, 0.0, 0.0, 3.1360609511064693e-18, 1.0896219718055542]
        accelerations: [0.0, 0.0, 0.0, 0.0, 0.0]
        time_from_start: 
          secs: 2
          nsecs: 144388907
      - 
        positions: [-0.8186363391284005, 2.13549384276445, -2.1556486321117725, -1.971949347057968, -0.8097189616694035]
        velocities: [1.0917942273591639, 0.0, 0.0, -6.310525555784859e-19, 1.079901350427656]
        accelerations: [0.0, 0.0, 0.0, 0.0, 0.0]
        time_from_start: 
          secs: 2
          nsecs: 370054003
      - 
        positions: [-0.6872969356042933, 2.13549384276445, -2.1556486321117725, -1.971949347057968, -0.6798102337462729]
        velocities: [1.1073704870325298, 0.0, 0.0, 2.6560761706557022e-19, 1.0953079384406423]
        accelerations: [0.0, 0.0, 0.0, 0.0, 0.0]
        time_from_start: 
          secs: 2
          nsecs: 490054004
      - 
        positions: [-0.10077700694030943, 2.13549384276445, -2.1556486321117725, -1.971949347057968, -0.09967924647315002]
        velocities: [0.6703568712225323, 0.0, 0.0, -4.289222110264426e-20, 0.663054696902626]
        accelerations: [0.0, 0.0, 0.0, 0.0, 0.0]
        time_from_start: 
          secs: 3
          nsecs: 76996454
      - 
        positions: [-0.00012129289047690934, 2.13549384276445, -2.1556486321117725, -1.971949347057968, -0.00011997165119668348]
        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: 3
          nsecs: 356996686
  path_tolerance: []
  goal_tolerance: []
  goal_time_tolerance: 
    secs: 0
    nsecs: 0

Originally posted by Martin Günther with karma: 11816 on 2012-12-17

This answer was ACCEPTED on the original site

Post score: 7


Original comments

Comment by Adolfo Rodriguez T on 2012-12-18:
Trajectory endpoints don't need to have zero vel/acc. This is especially so for the first point: if it has time_from_start>0, a spline will be traced from the current state (can also have nonzero vel/acc) in time_from_start sec. We use this a lot for online trajectory substitution.

Comment by Albert K on 2012-12-18:
Thank you very much~ I have two questions. Is time from start equals to the execution time? Can I deduce that accelerations term equals to the acceleration at that trajectory point?

Comment by Albert K on 2012-12-18:
Actually, I've tried trajectory filter and get problems : http://answers.ros.org/question/50611/trajectory-filter-response-with-nothing/

Comment by Albert K on 2012-12-18:
Why is that some of the time_from_start are the same as (not greater than) the last points in the example?

Comment by Adolfo Rodriguez T on 2012-12-18:
Trajectories with unspecified accelerations use cubic spline interpolation, hence have no acceleration continuity. Trajectories specifying accelerations use quintic splines and guarantee acceleration continuity. Setting them to zero at waypoints is a perfectly valid choice (and used in practice).

Comment by Adolfo Rodriguez T on 2012-12-18:
Total desired trajectory duration is the time_from_start of the last trajectory point. In the posted example all waypoint times are monotonically increasing, as expected. Note that durations consist of two fields: secs and nsecs, and although the secs field may be equal for two points, nsec is not.

Comment by Martin Günther on 2012-12-18:
Thanks for your helpful comments, Adolfo! I forgot about trajectory substitution and acceleration continuity; the Katana arm is more limited than the PR2's arms, so it cannot do either of them.

Comment by varunagrawal on 2016-02-01:
Hi, I am using FollowJointTrajectoryGoal to define trajectories for the UR5. Would you recommend FollowJointTrajectoryAction for it as well? I am using the ros-industrial/universal_robot package.

Comment by varunagrawal on 2016-02-01:
Also, I can't seem to make sense of the values of the positions and velocities. What are their units? Metres and m/sec? Also, how do I specify the velocity with which the UR should move? When I run the program, the UR just goes full speed to the goal point.

Comment by Martin Günther on 2016-02-05:
All units in ROS are SI units (m, m/s, m/s^2, ...).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.