Is Tuning Spark Max Smart Motion impossible?

I’m trying to drive our robot straight for 3 feet and use Spark Max Smart Motion because it goes 100 Hz, has no latency, etc.

To keep it simple, I am not setting PID and only setting kFF and max velocity/acceleration and realizing that there is no API call for detecting the Spark Motion’s current intended velocity along the profile, other than the max velocity setting. So to tune kFF properly, I need it to have enough time to accelerate to full speed and compare the current speed to the max velocity. Seems a very roundabout way to do things vs. a simple graph from an API call!

Additionally, the max velocity seems to be in units of RPM and not distance, which is another thing I need to correct for.

Am I thinking about this correctly?

I’m trying to get to a precise turning method, which is definitely going to require PID based on the variability I’m seeing from just feed forward. However, it seems that it always is internally undershooting the target profile since adding P is always overshooting the goal and I don’t hear any oscillations. It’s very confusing relative to WPILib’s implementation.

The Smart Motion control mode actually uses a PIDF Velocity Loop to control how far it travels. So to tune your Smart Motion, what you want to do is:

  1. Head to the Rev Hardware Client

  2. Configure to run multiple motors at once in the telemetry tab (REV shows how to do this on their site)

  3. Set the control mode to Velocity, and begin tuning those PIDF constants

  4. With these PIDF Constants, set the control mode to Smart Motion, and then you can mess around with maximum velocity, acceleration, etc.

This is off the top of my head, another way you could go about it is using the Smart Dashboard to send values back and forth between the driver station and robot so that you can on the fly set PIDF constants when undergoing the velocity tuning stage, this is also easy to find out how to do by looking at the REV Spark Max Hardware examples for Smart Motion

Oh, and very importantly for when you go to actually start using Smart Motion in your program:

The motors will not move unless you:

  1. Set PIDF
  2. Set Max Velocity
  3. Set Max Acceleration
2 Likes

Ok, that sounds workable, since you know the velocity set point. I’ll give that a try. Thanks!