Setpoint oscillations in Trap_Traj

Odrive Pro, fw 0.6.3. T-Motor MN1005, AMT212B encoder. Negligible load/inertia.

After doing some low-speed, low-torque manuevers in trap_traj position mode, the motor started oscillating around the setpoint at ~.2 Hz. If I run in passthrough position control, no problem. Even in Idle, if I switch back to trap_traj, I can see the setpoint start to oscillate in large swings.

Any ideas?

Mess with the position gain or position integrator, probs the gain

Is there a property to limit the position integrator?

I tried taking the gains down, and it didn’t fix it. Even with vel_integrator_gain at 0.

What is different between trap_traj and passthrough modes for position_control that could make this oscillation happen (only in trap_traj mode)?

Maybe lower the vel_gain? There are several gains for the velocity and position PI controller

Passthrough will use a PI controller to move the motor to the input_pos as fast as possible, trap_traj or trapezoidal trajectory control will attempt to ramp the velocity at the rate of trap_traj.accel_lim to the trap_traj.vel_limit then ramp at the rate of trap_traj.decel_lim until the motor stops so that it stops at the desired position, and will adjust velocity to ensure it has the correct final position

I don’t think it’s the gains, as it should behave the same as Passthrough when it has finished the move and is sitting still.

I agree this is suspicious. There was a recent bug that made it so that trajectories never finished but instead repeatedly made tiny trajectory steps that overshot the target back and forth forever. It could be this. Can you plot velocity setpoint in liveplotter or GUI, that would help to confirm. axis0.controller.vel_setpoint.

Thanks for taking a look.
I haven’t had any luck with the GUI on Windows. I’m currently running the Odrive off a Pi, and the GUI works in the Chromium browser, but I wouldn’t call the plotter “working” in that instance. It is really jumpy. Is there a quick fix for that?

Here’s a screenshot. I commanded one setpoint move from 0 to -0.5, then the oscillation started. The portion of the plot here is after the commanded move, during the mystery oscillation.

Is there a way to control the time axis of the plot?

I put the drive back in IDLE state, but the setpoint oscillations continue for quite a while:

Then eventually settle:


Are you sure you sent it to -0.5? input_pos is 0.5 here. Do you have some other module that is also sending it commands?
Are you using circular setpoint mode? That is not supported with the trajectory planner.

It does look like I meant +0.5 in that example. But that doesn’t change the presence of the oscillations.

I am not using circular setpoint mode.

I am still wrestling with a solution here … can you give me a little more insight into why the trap_traj mode starts to oscillate, and why it’s different than the behavior in POS_FILTER or PASSTHROUGH input modes?

If it’s helpful to give you more settings or plotted examples, I’m happy to do that. This behavior has my project development at a bit of a standstill right now.

What happens if you increase accel_limit? Say if you double it?
Does that improve things? If not, does it at least speed up the oscillations?

It looks like there might just be a bug in trap_traj but first just want to make sure it looks like there isn’t some mistake in how things are set up and what inputs are sent.

Increasing accel_limit speeds up the oscillations.

And I think the tuning params are decent, because this is what I get from Pos_Filter mode:

Ok thanks. Sorry to be pedantic, it’s not clear what the decel limit is set to. Plotting input pos here as well is really helpful, thanks for that.
Can you do this screenshot again with the decel_limit box closed so we can get a full set of values to try to reproduce? Thanks.

Hi Wiggle,

We’ve identified an issue. Please use the same value for accel_limit and decel_limit as a workaround until this is solved.

1 Like

Thank you very much!
I can confirm that setting accel_limit < decel_limit induces the oscillation. The magnitude of oscillation seems to scale with the difference between them.
Setting accel_limit > decel_limit does not result in oscillations.

1 Like