# State Space Controllers for Neos

I have personally been interested in proper state space controlling for a while now. I know its overkill for FRC in general but https://github.com/calcmogul/frccontrol has prebuilt controllers for simple mechanisms which is really nice. All of the papers I’ve been reading have purposefully made brushed motor classes, and since Neos are brushless does that change any of the math used for these controllers? Side point: 971 did not use any Neos this year which is another reason for asking. Sorry for being a noob lol.

4 Likes

Not knowing anything about how state space works, I shouldn’t expect brushed vs brushless to make a difference. Assuming that these classes aren’t built with a specific motor in mind. Ie varying power and speed output.

1 Like

I’m not the most knowledgeable on state-space control, but I do know that most of the models in that book assume a linear-time-invariant system. If you look at some of the NEO characterization posts in some other threads, you’ll see they have a fairly significant non-linearity. How much of an impact that will have, I’m not sure, but that is where the issues would probably stem from.

1 Like

Interesting.

I’d expect linearizing about the current operating point would work pretty well for BLDCs modeled with a (well-tuned) “piecewise linear” model. But there are more parameters to tune. Alternatively, you can design your setpoints carefully to ensure you are only ever operating in one of the piecewise segments…e.g. not asking for too much torque at low speeds.

(I’ll also point out that there are ways to commutate BLDCs that result in a ~true LTI system, though no FRC-legal offering can do this)

2 Likes

With DC motors, most models seem to be based around the equations:
V_{applied} = IR + K_v \omega
\tau = K_tI
They can be substituted into a differential equation which is then used for simulation or controllers, and the steady-state of the first equation explains the Kv feed-forward term for velocity control. If I’m not mistaken, they are the underlying model behind the DCMotorTransmission class.

Is there an equivalent for BLDC control? What equations one would linearize in the first place to pursue state-space control? Beyond that, how would you suggest teams velocity-control/characterize BLDC motors?

For a properly commutated BLDC motor, you will still get torque proportional to current (and you should generally be using current control in some form, although if you use the right concept of “voltage” then the equations you cite do actually hold). There are then two main sources of nonlinearity:

• Imperfect commutation (I do not have the experience necessary to know how big a deal this is with the Spark Max/NEO combination–I have not had the chance to investigate the production hardware).
• Explicit current limiting that you have to do at low-speeds to prevent overheating the motor.

The first is going to be harder to deal with if it is an issue, because the effects probably aren’t going to be as easy to compensate for. But that assumes it is an issue at all.

For the second, it will only impact low-speed and high-torque situations. And to be honest, for a drivetrain, I’m not sure that it is actually an issue–if you are stalling a drivetrain with brushed motors then they aren’t going behave like an idealized LTI system either (battery voltage drop alone will be an issue). For lower-power systems, you may be able to observe issues, but it should not be too hard to compensate for and so long as you aren’t hitting the current limits the behavior should still be reasonably linear.

1 Like

Would the same conditions apply to PDF velocity control? ie, taking voltage = motor command * battery voltage (though I’m not sure if that even applies to BLDC motors), should I expect the steady-state velocity to be roughly proportional to that voltage, except in low-speed situations?

Please elaborate on what you meant by “proper commutation” in the context of your post.

.

Functional