Optimizing swerve steering ratios and contro

As I have shared in other threads, the azimuth motor has to react the torque induced by drive motor. You may want to run the math on this and see what sort of amperage is needed by the steering motor to hold the azimuth straight during maximum acceleration loading of your drive motor. This is probably a good sanity check on any steering motor gear ratio that you select. You want to have some margin here and compare the amperage that you calculate to the VEX Motor testing data. Also, keep in mind that those motor test curves only cover 5 minutes, so for the 15-20 minute use case that you describe, even the 20A and 10A curves could reach the thermal limit (we don’t know as the testing did not cover such a long duration).

Overall, I would say that if you are hitting the thermal limit after 15 to 20 minutes, that you really don’t have a problem. A single FRC match is 2-1/2 minutes so 15-20 minutes is a significant safety factor.

We have, on occasion, let our drivers practice continuously for long periods (stopping only to swap out batteries but not really giving the motors any cooldown time) and we have experienced some very hot drive as well as steering motors. I don’t think this is an indication that your gear ratio is to low. I think it is an indication that you are pushing your robot really hard (which is a good thing) for much longer durations than your design use case. I know how much fun it is to drive swerve for hours on end. But you may want to consider giving your motors a chance to rest and cool down.

2 Likes

You can use the log file viewer to see the current draw from each individual motor. This is really good information, you can use it to spot mechanical issues (one gearbox is taking a lot more power than the other/s), to monitor performance over time (get an idea of what this data normally looks like and spot changes, or compare logs from different points in time), or to see the effect of changes you make. In this case, I’d be interesting in seeing some of this data from the drive train motors.

Here’s one place the procedure to do this is documented. You should already have the data, so it’s just a matter of looking at it…

I’m not sure this math exists in a form that is accessible to many teams. I genuinely think most swerve teams are throwing darts at numbers on a wall when it comes to the azimuth speeds/feeds and are effectively using TLAR or overkill.

2 Likes

Well, that is why I have posted the math (and the reasoning behind the math, i.e. a verbal description of the free body diagram). Like most things mechanical, if you are going to start pushing beyond your experience base, you can do the math or you can just iterate in a slow progressive fashion until something breaks (or stalls or burns up). I have a spreadsheet with about 20 different motor / gear ratio combinations for both the drive motor and the steering motor. Each combination is just one simple equation and once I have the input torque from a given drive motor + gear ratio combination, I can compare that with any given steering motor + gear ratio combination I am interested in and see what kind of torque margin we are looking at. The math itself is very simple and straightforward once you understand the problem.

Link? Formulas? Spreadsheet? Whiteboard? Photo? Anything?

Link?

Saying “do the math” and “it’s simple” over and over doesn’t do much for me. It’s patronizing at a minimum. So help me out, ok? Prove to me how simple it is. Show the work.

I’ll help out and define the problem better. I want to see and understand the mathematical formulas and physics behind choosing an optimal swerve drive azimuth gear ratio such that I can minimize current draw while maximizing responsiveness for any given motor and driver preference.

We have done this empirically rather than mathematically. A soft goal to hit is each azimuth motor should be under 4 amps in the air. That has worked well for us. The planetary gearbox itself should be less than 2 amps. If it’s more, there’s something wrong with the gearbox. Once the planetary has been tested, we test each module, if the azimuth is more than 4ish amps, something is likely binding. I would check each module individually.

We aim for a speed of around 190-250rpm after reduction (80-100:1) because that has tuned well for us in the past. Stryke Force only uses a Versaplanetary gearbox and a Banebots 550 motor. Translating the Neo 550 to this, a planetary ratio of 9-12 should be tune-able and have sufficient power.

As for how we found the working ratios, we have tried lots of ratios over the years, dating back to long before I came around.

4 Likes

I think this is how most teams have come up with the magic numbers that work for them. Nothing wrong with it but it does mean we’re all probably leaving something on the table for optimization.

2 Likes

Copying and pasting from the link I provided in the earlier post:

When the drive motor applies a torque to drive the wheel, this torque will also try to spin the module due to the reaction torque at the 90 degree bevel gear. If the wheels were unable to turn (such as when you are in a pushing match) and the motor were at max stall torque, the reaction trying to spin the module would be the motor’s stall torque times the gear ratio of the gearing between the motor and the bevel.

For our swerve module, we use a NEO motor for drive and then run with either 3:1 or 4:1 before the bevel and 2:1 after the bevel gear.

So, if you take the stall torque of our NEO motor @40A, times this gearing (we will take the worst case which is the 4:1), you get 2.92 ft-lb of torque trying to spin the module.

I believe that this is the highest load that the steering motor needs to react. So this is what we use to assess our steering motor options.

Taking the NEO 550 steering motor, you have 0.215 ft-lbs of stall torque available @30A. Our module uses a 33.3:1 total steering ratio (10:1 in a VP gearbox and 100:30 in the final drive ratio), so if you multiply the NEO 550 stall torque times the 33.3:1 ratio and you get 7.15 ft-lbs of torque available to resist the spinning of the module. This is 2.45 times the maximum torque from the drive motor described above. So, this gives us a decent factor of safety and ensures that we are not running the motor at excessive amperage at stall as we are resisting the torque of the drive motor. Taking the 30 Amps divided by 2.45, we get 12.25 Amps. REVs testing of the NEO550 says that it can sustain up to 20 amps continuously (over a minute) without failing, so 12 amps seems pretty safe.

Running the same math with a 30:1 ratio shows a similar result with 13.6 Amps at stall needed on the NEO 550 to resist the torque imparted by the NEO drive motor.

I defined the problem a little differently. I defined the problem as “is the steering motor strong enough to keep the wheels aligned”. There is more to the problem which is the control loop tuning. I think everyone will acknowledge that there is a limit to how fast you can spin the motor and be able to control it with a control loop. Brushless motors have really opened up a lot of new frontiers in this area since the built-in encoder that is needed to control the motor gives you a more direct feedback loop for control. We switched to the NEO550s for steering primarily because we could control using the motor’s encoder (rather than the absolute encoder) which gave us much more stable control loops. With a brushed motor running a control loop on the absolute encoder (with all the associated backlash deadband between the motor and the encoder), it was not really possible to spin the module much faster than about 200 rpm and have a stable control. With BLDCs we were very stable in 2020/2021 at 330 RPM and many others have been demonstrating stable operation at even faster rotation speeds. Since control stability was no longer the “barrier” preventing faster rotation, we spent some time trying to understand the motor strength barrier to make sure we were not going to run into that. Hence the problem definition that led to math in the post quoted above.

There is an inverse tradeoff between current draw versus responsiveness. In the extreme, if the gear ratio of the steering motor were set to 1000000:1, the current draw to hold position would be vanishingly small, but the response speed would be unacceptably slow as well. As you decrease the ratio, current draw goes up and responsiveness becomes quicker. If you are trying to optimize for low current draw, you will chose the slowest rotation speed that you find acceptable. If you are trying to optimize for responsiveness, you will choose a faster rotation speed with the accompanying increase in current draw to hold position. So, you can’t really optimize for maximum responsiveness AND minimum current draw. You actually need to trade them off. But the math above gives you what you need to perform those tradeoffs - it gives you current draw for a given gear ratio (I trust that you know how to calculate free rotation speed for a given gear ratio).

2 Likes

I suppose, but what kinds of gains could be had from finding said optional ratio? I’m betting you would be able to save far more amps by spending that time tuning your azimuth control loop.

Let’s say you can save a half an amp per module, for 2 amps total. Over a 2.5 minute match, that’s .08 amp hours. The FRC battery is 18 AH, so you would have saved 0.4% of the battery. If your margins are than thin on your battery draw, you likely have bigger problems. That’s not to mention your batteries are almost definitely not within 0.4% of each other in capacity.

You’re looking at total draw over time not peak draw. Decreasing your instantaneous draw can result in faster accelerations or less voltage drop.

1 Like

Valid point. Again, the question can be asked, how much does this really get you? Especially when compared to the gains comparing a poorly tuned azimuth to a well tuned azimuth.

Sure. But I don’t think we’re saying not to optimize azimuth loop tuning. More focusing on is there room for an optimization as well as an understanding of how we experimentally determined these values.

Some of us have a real issue with not understanding why certain things are done.

1 Like

This sums it up. I have a need to understand this. It hasn’t been explained yet outside of the occasional handwaving. Which is totally fine mind you. We run swerve and we’ve waved our hand at this too… but that doesn’t mean I don’t want to understand it.

1 Like

Might warrant its own thread instead of just TTB Swerve?

3 Likes

I see now. Yeah, I’d love a sound mathematical examination. I think we could all stand to learn something from that.

2 Likes

For us, the goal was to eliminate a stage of our steering gearbox. This eliminated the backlash associated with that stage as well as the weight and cost of that stage.

Once we had reduced our 2 stage gearbox to a single stage gearbox, we pretty much stopped pushing any further as there really were not any more to be gained by going faster.

2 Likes

I don’t think you get torque steer with a duelie. I’m willing to learn how reaction torque starting from the carpet, through the wheels, (wheels that are tied together and on opposite sides of the saddle) up to the center shaft moves the azimuth bushing. I think it gets canceled. It’s hurting my head thinking about it. I can see how a single wheel with an offset shaft does it.

1 Like

Yes please. Can we split this into a general “Optimizing swerve steering ratios and control” thread?

3 Likes

Stable loops haven’t ever really been a barrier for us. The bigger issue we’ve had is ensuring a responsive system… which does lead nicely into this:

I think we’re saying the same thing? There is a tradeoff between the two but that also means there is an optimum or at least a range where that trade off favors both sides in some way. Go too far one way or the other and it’s no longer really making anyone happy. I think most teams have come up with numbers in that range but no one has come up with the math behind it all.

I think there are other variables that need to be input into this “equation” though. For one, I’m not sure that full stall is the best place to derive the forces from driving at but I can see where it works. I think that ultimately has an impact on how fast you want to turn the azimuth. There is also a need to take acceleration into account and a lot of the math I’ve seen only seems to rely on peak velocity/power/RPM. Acceleration, in my head at least, is important because these motors are never trying to drive something more than 90 degrees so there is likely a way to stay in the zone where the motor is accelerating at its fastest (this is also probably why brushless is best for azimuth) since you never need to hit a peak velocity.

There is also probably an input for the CoF with the wheel/carpet interaction and the weight on each swerve pod.

I’m not a mechanical engineer. I barely made it through a required statics class so I’m not going to pretend like I can work this out in my head but I suspect a lot of students are in the same boat and it just seems like something that the formulas all exist for but no one has truly put them all together and then created the JVN-style (As if anyone is as cool as JVN) spreadsheet for this.

MOD POST:

I moved the most recent posts related to these topics to a new thread. If I missed any important posts, please DM so I can move those.

6 Likes