Smart motion for elevator

I tried to make our elevator move more smoothly so I used “smart motion”,but I don’t know how to get max output,vel,accel,min output from motor,and how to calculate kFF.Any suggestions plz!!


All of this can be found with good old fashioned Trial/Error testing. Before I go into that though, it’s important to understand what this things are.

min and max output is how much you are willing to drive the motor. This is handy because you shouldn’t always drive everything all-ahead-full, and min output is helpful because there’s some amount of energy required to move things. It’s highly unlikely that driving a motor at 0.2% power will make it actually do anything. In short, max output is telling the motor “hey don’t go faster than this please”; and min output is saying “if you’re below this point, round down to zero”. That value is typically represented as a percentage.

Velocity is you telling the elevator how fast you want it to go. Even though you could in theory drive it at 80% power, that doesn’t mean it’s necessarily a good idea. This is pretty much saying “okay, here’s where I want you to be”. And it’s represented as encoder ticks per 100ms.

Acceleration is setting a limit on how fast your motor can change it’s velocity when correcting things. Think of it like this: going instantly from point a to point b is a bad idea, and literally impossible. However, the motor controller will try to do whatever you tell it even if it isn’t actually possible. If you tell it to go from 0 rpm to 1600 rpm as soon as possible, it’ll do everything it can to reach that goal. This makes for really janky control loops, not to mention it’s hecking dangerous.

Now, the only ‘complex’ topic here is what kF is. I put ‘complex’ in quotes because it’s actually quite simple. In it’s simplest form, kF is the minimum amount of effort required to convert potential (static) energy to kinetic (moving) energy. How you find this is just seeing what is the lowest percentage of speed you can use to get the elevator to ‘beat’ gravity and move on it’s own at all. The reason this is important is because as you get closer to your desired point, the amount of change needed will (hopefully) get smaller. There’s going to be a point where that difference will not actually do anything, but it’s still not quite where you want it. The kF constant tells the software that on top of whatever change it calculates, it also should add x amount of power to make sure that the elevator can actually move.

Once you have those values, you feed them to the software and it does all of the really complex math to figure out that in order to get from point A to point B without breaking, it needs to go X speed. This happens every scheduler run, so that value will proportionately scale down with it, so you get a nice and smooth acceleration and deceleration that lands it exactly where it needs to be.


We are new to the REV ecosystem, and haven’t attempted it yet. But would you know if there a simple way to introduce a gravity term in smart motion? ie for an elevator, a multiplier for positive rotation (going against gravity) versus going with?

I’d avoid SmartMotion entirely; it cascades through the velocity controller. This is a poor choice when you are attempting to control position, and I have not seen teams have good success with SmartMotion as a result.

Generate your motion profile on the RIO and use position control instead.

1 Like

I don’t use REV, so I wouldn’t know specifics there. The concepts behind it’s smart motion are the same as what I’m more familliar with which is WPIlib’s VScode and PID Control loops.

As far as introducing a constant for gravity, I’m guessing there’s some value (most likely named kFF, or some variant of FeedForward) that you can manipulate. WPIlib’s PID control has a kF constant for the feedforward value, but I’m not sure about REV’s ecosystem.

However, I agree with Oblarg on using a position control instead of velocity control, and that you should use the RIO to do that.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.