# Analyzing the result from /follow_joint_trajectory/goal

Hi all,

I am currently trying to understand the result from /follow_joint_trajectory/goal. As you can see below, the position and the corresponding velocity and the time_from_start do not match. For example, the second joint position 0.09417841684822381 from secs: 2 should be the result from secs: 1 + 0.04506825899972304 * (0.719683936 - 674841968) which means 0.047089208424111906 + 0.00202094942 = 0.04911015785.

Can someone point out why the velocity and the corresponding position do not match?

 points:
-
positions: [0.0, 0.0, 0.0, 0.0, 0.0]
velocities: [0.0, 0.0, 0.0, 0.0, 0.0]
accelerations: [-7.253014806617205e-07, 0.0, 0.0, 0.0, 0.0]
effort: []
time_from_start:
secs: 0
nsecs:         0
-
positions: [-1.0172700023905e-06, 0.047089208424111906, -0.11911198434316592, 0.07694271201561491, 0.058570871665028904]
velocities: [-7.90497016460201e-07, 0.03659193594548153, -0.09255917114105806, 0.05979040386895425, 0.04551407118452061]
accelerations: [-2.6931708415450716e-07, 0.012466629585187997, -0.03153429496178598, 0.02037019355558546, 0.015506341813034412]
effort: []
time_from_start:
secs: 1
nsecs: 674841968
-
positions: [-2.034540004781e-06, 0.09417841684822381, -0.23822396868633183, 0.15388542403122982, 0.11714174333005781]
velocities: [-9.736113533161094e-07, 0.04506825899972304, -0.114, 0.07364052591474911, 0.05605715836767851]
accelerations: [0.0, -6.641094172072784e-18, 0.0, 0.0, 0.0]
effort: []
time_from_start:
secs: 2
nsecs: 719683936
-
positions: [-3.0518100071715e-06, 0.14126762527233572, -0.3573359530294978, 0.23082813604684474, 0.17571261499508672]
velocities: [-9.736113533161094e-07, 0.04506825899972304, -0.11399999999999999, 0.07364052591474911, 0.05605715836767851]
accelerations: [0.0, 1.3282188344145571e-17, 1.3282188344145571e-17, 0.0, 0.0]
effort: []
time_from_start:
secs: 3
nsecs: 764525904
-
positions: [-4.069080009562e-06, 0.18835683369644762, -0.47644793737266367, 0.30777084806245963, 0.23428348666011561]
velocities: [-9.736113533161096e-07, 0.04506825899972304, -0.11399999999999999, 0.07364052591474911, 0.05605715836767852]
accelerations: [-4.0534022046342685e-22, -1.3282188344145571e-17, -1.3282188344145571e-17, 0.0, 2.6564376688291142e-17]
effort: []
time_from_start:
secs: 4
nsecs: 809367872
-
positions: [-5.0863500119525006e-06, 0.23544604212055953, -0.5955599217158296, 0.38471356007807456, 0.29285435832514456]
velocities: [-9.736113533161094e-07, 0.04506825899972303, -0.114, 0.07364052591474911, 0.05605715836767851]
accelerations: [8.106804409268535e-22, 0.0, 0.0, 0.0, -4.648765920450949e-17]
effort: []
time_from_start:
secs: 5
nsecs: 854209840
-
positions: [-6.103620014343e-06, 0.28253525054467143, -0.7146719060589956, 0.4616562720936895, 0.35142522999017345]
velocities: [-9.736113533161094e-07, 0.04506825899972303, -0.114, 0.07364052591474911, 0.05605715836767851]
accelerations: [-8.106804409268535e-22, 0.0, 0.0, 0.0, 4.648765920450949e-17]
effort: []
time_from_start:
secs: 6
nsecs: 899051808
-
positions: [-7.120890016733501e-06, 0.32962445896878334, -0.8337838904021615, 0.5385989841093044, 0.4099961016552024]
velocities: [-9.736113533161094e-07, 0.045068258999723054, -0.11399999999999999, 0.07364052591474911, 0.05605715836767851]
accelerations: [8.106804409268539e-22, 3.320547086036393e-17, 1.3282188344145574e-17, 0.0, -5.3128753376582296e-17]
effort: []
time_from_start:
secs: 7
nsecs: 943893775
-
positions: [-8.138160019124e-06, 0.37671366739289525, -0.9528958747453273, 0.6155416961249193, 0.46856697332023123]
velocities: [-9.736113533161088e-07, 0.045068258999723027, -0.11399999999999999, 0.0736405259147491, 0.05605715836767848]
accelerations: [2.0267011023171338e-22, -7.96931300648734e-17, 0.0, -2.6564376688291136e-17, 0.0]
effort: []
time_from_start:
secs: 8
nsecs: 988735743
-
positions: [-9.1554300215145e-06, 0.42380287581700715, -1.0720078590884934, 0.6924844081405342, 0.5271378449852602]
velocities: [-9.736113533161096e-07, 0.045068258999723027, -0.11399999999999999, 0.0736405259147491, 0.056057158367678536]
accelerations: [-1.8240309920854203e-21, 7.96931300648734e-17, 0.0, 2.6564376688291136e-17, 9.961641258109176e-17]
effort: []
time_from_start:
secs: 10
nsecs:  33577711
-
positions: [-1.0172700023905001e-05, 0.47089208424111906, -1.1911198434316592, 0.7694271201561491, 0.5857087166502891]
velocities: [-9.736113533161098e-07, 0.04506825899972307, -0.11399999999999999, 0.07364052591474911, 0.056057158367678536]
accelerations: [1.6213608818537083e-21, 0.0, 0.0, 0.0, -9.961641258109184e-17]
effort ...
edit retag close merge delete

1

Are you including the acceleration in your math?

( 2021-02-23 02:57:52 -0500 )edit
1

In addition to the comment by @fvd: a JointTrajectory describes the state of the system under control at each time_from_start point in time.

Each JointTrajectoryPoint is not a "motion command", but a node in a spline (almost). It's the executing entity's job to drive the system under control to that state, using whatever (smooth) motion control it is capable of.

( 2021-02-23 03:20:09 -0500 )edit

In my case, I am trying to send this data from /follow_joint_trajectory/goal to my action server which communicates with the velocity-controlled cylinders. My idea is to use the position values from /follow_joint_trajectory/goal to define the goal with goal_ = as_.acceptNewGoal()->des_trajectory.points[iterator].positions; and iterates over des_trajectory.points to mimic the planned trajectory with the real robot. Does this sound ok from your experienced point of view?

( 2021-02-23 04:54:39 -0500 )edit

The reason that I am using positions for the velocity-controlled cylinders (takes PWM values as input and gives encoder positions as output) is that I can not actually fully control the cylinder with the velocity. Since the robot is a hydraulic actuator and the dynamic effects are bigger in this case, I have decided to go for a position-controlled robot.

( 2021-02-23 04:59:05 -0500 )edit