Controlling an arm with MP

Hi guys, I am wondering how to implement a motion profiling control on a arm system.

In order to control it you need to give the talon a certain output based on the current point target velocity and the current angle.
You can’t change the feed forward implementation (due to the fact that we are using the talon API) to make it calculate the angle based on the current encoder position and add it to the motion profiling calculation.

Does using a secondary PID is the solution here?

Thanks in advance!

Yes, the talon srx has an arbitrary feed forward mode that you can use:

talon.set(controlMode, setpoint, DemandType.ArbitraryFeedForward, feedForward);

If you go down this route I’d reccomend setting kF to zero and passing in all the feedforward values through the arbitrary feedforward—it’s easier to keep track of things.

319 uses Motion Magic to do the motion profiling control for us.

Here’s a link to our 2018 wrist code in which we implemented motion magic to go to and hold positions. We made a bunch of our own classes in an effort to make it easy to follow. You can most certainly use the feed forward component of PIDF.

If you have any questions, I’m happy to answer them.

1 Like

This is the approach I did for my elevator this year. Let the Talon handle the motion profile, and continuously update the arbitrary feedforward value (albeit at a slower rate.)

Ok, so you mean i can just wirte

talon.set(ContorlMode.MotionProfile, SetValueMotionProfile.Enable, DemandType.ArbitraryFeedForward, cos(angle) and some math...);

and continually update it? the result will be output = cos(angle) and some math… + FPID (from MP)?

Amm, sounds interesting!
I will be sure to check it out, but I did not completely understood the difference between MP and motion magic.
You still need to set max V and acceleration and it will be different for each angle(?)