Jerky trap moves in vertical axis, gravity compensation


I have a vertical axis which I’m running with an odrive controlling a Nanotec BLDC. The axis is backdriveable and has significant mass, approx 4kg. I’m using trap moves and when doing vertical descends I see some jerkiness as the axis decelerates. I’m using different accelerations for upward vs downward moves, but I see the jerkiness when decelerating from downward jogs whatever values I use.

Although I can configure the axis inertia in the trap generator, I don’t know how to tell it about gravity (or if I can), and I suspect this is a factor in the jerkiness I’m seeing.

Can I somehow set a constant baseline torque for the motor to offset the gravity force, or otherwise improve the performance?

Thanks for any help and suggestions.



I just happened upon someone talking here about using torque feed forward commands. This sounds like what I need. Can I use these in conjunction with trap moves? And can I send a torque feed forward via CAN?


1 Like

Yes you can. Set the controller.input_torque value to set a feedforward torque, and you will also find that it is documented in the CAN protocol.

The trapezoidal planner automatically generates the feed forward commands, as long as controller.config.inertia is set

Right, that’s what I was wondering. So basically the trapezoidal planner will overwrite any feedforward torque I set? The thing is if I set the inertia correctly, it still won’t know about the gravity force.

If I don’t set an inertia value (i.e. set it to zero), will a feed forward torque I set before a trap move remain in effect?


1 Like

If the gravity torque is constant you could just let the integrator in the velocity controller take up that gravity torque.
If the gravity torque changes (rotational joint, or similar) then unfortunately you need a fancier trajectory planner that includes knowledge of the kinematics. We don’t have that available (yet).

1 Like

No, but that’s a good idea for a workaround.