![]() |
Jaguars and FAST PID Looptimes
First off, I am back. This time I'm working with Overclocked, #246.
Second, you'll all be shocked SHOCKED our Fall Practice Project* is a swerve drive chassis** Third, since we want to this chassis to go the direction we want it to go and we don't want to be waiting around for the steering error to settle down to an acceptable level, we are going to put as much power as we dare into the steering angle drive . Bottom line, we are using a Banebot RS775-18 on each wheel (and there are 4 of course, 4 wheel independent steer swerve -- how could we do less?). So... we get the torque we need and still have the speed we want. BUT... speed has a dark side. Speed is hard to control, especially at 50hz update rates typically used in FIRST control loops (I want to have 90 degree step change in steering angle in under 60ms -- probably too fast to have a 20ms loop time). I hear good things about the not yet available Talon SRX (coming soon to a FIRST Legal robot near you) but hearing good things doesn't help me today if it isn't available. So, we are left with Jaguars. Now comes my question: Has anyone had good luck using the Jaguar's in their PID mode with high speed actuators and very fast loop times? If so, please let me know in the comments below. I want to know the good the bad and the ugly. Also, Jaguars are also unavailable for sale these days. Anyone willing to sell (or loan) me 4? If so, PM me with details. Stay tuned for more results and videos as the project progresses. Joe J. *Yes, Fall Practice Projects are a thing. If your team is not doing one or more of them, you should be. **Super Thanks go to Anthony Lapp and his company, Team221 Robotics, for helping us out with Wild Swerves. Literally wouldn't have been able to do this practice project without building off a solid swerve design. |
Re: Jaguars and FAST PID Looptimes
Quote:
It is good to hears from you again. In fact, I was literally just thinking about you this morning while considering a simple transmission design. I'm looking forward to what you find in your search for the ability to do a 90 deg step change in under 60ms. This should be FUN!! |
Re: Jaguars and FAST PID Looptimes
Quote:
How did you come up with 90 degrees in 60 ms? |
Re: Jaguars and FAST PID Looptimes
I remember seeing something that said although the jags can do PIDs, they are hard to implement.
|
Re: Jaguars and FAST PID Looptimes
Quote:
Kinda creeped me out frankly. I know that the Jaguar comes with it's own baggage but at least it lets me find out if an updated loop time allows for sufficient control. I may try a half measure where for this project (not FIRST legal obviously) where I put a coprocessor between the CRio and a Talon that is doing the PID loop itself. Kind of a Kludge but answers the question of "can a Talon SRX do this?" As to the oddly specific spec of 90 degrees in 60ms, it falls out of a calculation for path following at the various speeds of interest. But in actual fact, it is somewhat arbitrary (faster is better could have been the spec), but part of the point if a Fall Practice Project is to discover the edges of what is possible. The easiest thing in the world is to slow the steering rate down. And I may have to go there, but i am not starting there. Joe J. |
Re: Jaguars and FAST PID Looptimes
Quote:
On the other hand, velocity PID on a Jaguar is much harder to do. Fortunately, once you understand why it doesn't work the way it "should", tuning it becomes a lot less frustrating. |
Re: Jaguars and FAST PID Looptimes
Here's a summary of update rates
Servo: 50hz Victor and Talon: 100hz (changeable with SetPeriodMultiplier) Jaguar PWM: 200hz Jaguar PID: 1000hz, but you can't read status or set setpoints anywhere close to that fast Driver Station: 50hz Java iterative methods: synced to driver station C++ iterative methods: synced to driver station by default, changeable with SetPeriod WPILib PIDController: 50hz, changeable by changing period parameter in constructor |
Re: Jaguars and FAST PID Looptimes
Good to see you coming back to your roots with swerve.
The issue with all this is available energy and where it gets absorbed. We used window motors for steering for years until the rules limited them to 2. Then we decided on AM9015 motors because the range of BaneBot motors is more versatile. It became quickly obvious that four 85 amp motors and four 120 amp motors all turning on at the same time was more than the battery could supply as the voltage at the terminals of a fully charged Enercel fell to 8 volts. We monitor battery resistance and cycle test and haven't found another brand that is better yet. Some are worse. Most battery specs list max current draw at 20 or 50 amps. We know that isn't possible. We also shorten the 6 gauge wire as much as possible and use 10 gauge to larger motors. This actually makes the problem more acute. This year we are limiting the AM9015s to 75% output but if driving aggressively, the two 775s driving the catapult don't get enough energy to fire. They draw close to 40 amps to start. We used Talons for the drive motors and Jaguars for the rest so we couldn't deduce all power consumed. Next year should be easier as the PDP will allow monitoring of all current sources. The robot will just make it through a 2 minute match with normal driving and defense before the battery charge is reduced to the point that it affects operation. That reads about 80% charge on a Battery Beak after a match. More aggressive steering with defense or a less than absolutely fully charged battery hinders performance by the end of the match. Bottom line is you can choose to steer fast or accelerate fast but not both at the same time. Whatever is left has to operate also. If the Catapult delays firing for a second the shot is usually missed. I'm looking into improving steering efficiency and reducing motor size but until then power management is the only option. This never seemed to be a problem before the larger steering motors arrived. |
Re: Jaguars and FAST PID Looptimes
We used the on-board Jaguar PID for position control for our shooter turret in 2012.
Don't know if that qualifies as "similar" to your swerve application, but I do have a working knowledge of the pitfalls of the Jag's PID (both position and velocity). The bottom line is that we did get it working, although it wasn't pretty, and there was still a lot left to be desired. While we were able to get the turret to go to a commanded position effectively, I wouldn't say we had it "perfectly tuned," nor did our system have a lot of dynamic forces on it. The turret was pretty free-spinning, and remained that way throughout. It was powered by a single RS550 through a planetary. I don't think we were close to hitting your 90 degrees in 60ms spec though. There is a 10-turn pot that you can see in the picture as well. Here's a pic of the setup: ![]() Here is our competition code for the turret on Google Code: https://code.google.com/p/robotics61...ms/Turret.java You can navigate through the source path section to find the PID constants we used as well. Good luck! If you have any other questions, post here, and I'll try and find time to share what I can. |
Re: Jaguars and FAST PID Looptimes
Quote:
How much acceleration is needed for swerve steering? Is Dr. Joe correct about 90 deg in 60 ms? What trajectory, maybe some kind of spline to reduce or eliminate jerks? How important is swerve module moment of inertia about the steering axis? How important is scrub? Will overhung motor mass and fat treads be significant factors? (Is Ether reading this?) John, what do you think are the window motor attributes that kept this from being a problem in the past? Can a motor engineer help with this? |
Re: Jaguars and FAST PID Looptimes
I believe the microcontroller on the jag runs at a rate of 50MHz and the encoder is read at 1/4 of that rate. Not clear on how fast the control loop on the jag is running, but I think it is safe to say it is orders of magnitude higher than the software loop.
However you can only command it and read from it as fast as CAN packets are being sent/received. In your requirement for 90 degrees in 60ms. How much of that is actuation time, and how much of that is settling time? If you want to be at 90 degrees confirmed in 60ms, then you need the mechanical system (wheel/gear) and anything else that is tied to the motor load including friction between wheel and floor to accelerate and decelerate in that amount of time. If your target is 60ms, then you should target an actuation time of 40ms, and a settling time of 20ms. Can your mechanical system move that quickly? That is pretty fast by any FRC standard. If you also plan to run 4 independent loops, they each will settle differently because each motor will react differently. As your speed requirement increases, your engineering tolerances reduce, naturally. You will need very tight tolerances on the manufacture of the assembly, sensor mount, and backlash in order to have reasonable reaction time across all pods. Also take the time to test the motors you are using to ensure their drive characteristics are very similar to each other. We typically run our control loops at 100ms and give our actuators a settling time of around 100-150ms on top of that because that is a very safe margin, and very achievable with the manufacturing tolerances on our team. Although we have not done motion planning on FRC(yet) and all of our control loops run in software. For the motion planning model on my work outside of FRC, a 100ms control loop was more than efficient to follow a waypoint path on a skid steer chassis. Not sure how that equates to the dynamics of a swerve, but I would hope they are somewhat comparable. Plus, the baggage of CAN error implementation, preventing CANTimeOutErrors and all that other good stuff will need to be user implemented as part of the CAN baggage. Regards, Kevin |
Re: Jaguars and FAST PID Looptimes
Quote:
One thing I blew over was whether the strategy is to turn to the intended direction before driving the wheels. Our main driving mode relies on constantly correcting the direction which means running all motors at once. |
Re: Jaguars and FAST PID Looptimes
Quote:
The 90deg/60ms discussion reminds me of a sentence in the last two paragraphs in the swerve inverse kinematics paper1 I posted in March 2011. Quote:
1 FWIW, I recently wrote an integer-math implementation of swerve reverse kinematics for Anthony Lapp for a project he was working on to run swerve on ATmega2560. He has a video posted here. |
Re: Jaguars and FAST PID Looptimes
ChiefDelphi never disappoints.
Thanks to all for the great input. As to John Novak's comments, you've definitely given me a lot to think about. When the Bomb Squad speaks about swerve, you'd have to be a fool not to listen. I am curious about a window motor working better than a higher power motor. It's not obvious why you couldn't gear the higher power motor down to the point that it was pulling less power than the window motor (which is purposefully designed to be inefficient so that it will not backdrive and let your windows fall as you drive). In any case, I will take your advice to keep an eye on overall current draws, especially when shooting mechanisms that are current sensitive are involved. I have a question about the speeds you discuss. You say you have a 9:1 ratio and I think you guys are a 4" wheel shop these days (which roughly checks with your 12 fps top speed). You happy with that? Do you guys wish you had a bit more metal in the pedal when zipping back and forth across the field? Do tell. As to Joe Ross, do the Jaguar's really have 1ms update periods when in PID mode? I don't need to read the sensor anywhere near that fast so that doesn't both me but I would like the faster loop time. (Yes, I know Jaguars have other baggage - but remember this is a Fall Practice Project -- I can afford to take risks now that I would be very hesitant to take come January). Finally, a question for Ether, but of course, all are welcome to comment. Given a 4 wheel independent steer swerve, with the 12fps top speed our good friends from Mountain Home report, what is the minimum steering angle speed you'd recommend before the vehicle kinematics would be compromised? Joe J. |
Re: Jaguars and FAST PID Looptimes
Quote:
Nice try making the font small so we'd not follow the link. But I'm on to your tricks ;-) Very cool chassis. Can you provide details on the ratios and motors involved on that swerve or do I have to go pester Anthony? It seems like there is a point in the video where one of the steering angles is close to 90 degrees in 100ms. I could be wrong because I am just eyeballing it but even so, that's some pretty zippy steering. My kind of swerve if you know what I mean... Joe J. |
Re: Jaguars and FAST PID Looptimes
Quote:
|
Re: Jaguars and FAST PID Looptimes
Quote:
I'd like to help but you'll have to ask Anthony for those details. He contacted me because he needed help implementing integer math. He had coded the swerve inverse kinematics in floating point, and the floating-point emulation library was chewing up all the processing power on the ATmega2560. I sent him an integer-math implementation scaled for his inputs and outputs. |
Re: Jaguars and FAST PID Looptimes
Quote:
Quote:
|
Re: Jaguars and FAST PID Looptimes
Quote:
As a practical matter, as the steering response gets slower and slower, you get more and more wheel scrub, especially during rapid evasive maneuvers. Eventually I suppose you'll reach a point where the vehicle starts exhibiting undesired or unpredictable "macro" behaviors. Calling all teams who have deployed successful "Unicorn" swerves with 3DoF driver interface: please share your experience/data concerning steering dynamic response. |
Re: Jaguars and FAST PID Looptimes
What is the rational for very fast steering response and why is there a need to expend allot of power to accomplish this?
This is a link to a page showing what we have done with swerve. http://wiki.team1640.com/index.php?title=Swerve_Central We use a RS540 and banes bot 1 : 133 trans. Plenty for power and speed. Other designs and drive wheels may need more power but this solution has worked well for us. I would caution on the use of Jags for positional control. We burned up several on the steering motors. We have used Victors and Talons for the steering motors with out failures. For auto navigation, Tight PID tuning, well calibrated and accurate steering angle sensor and a good stable gyro - IMU are needed. Swerve does not like to go straight. For teleop, a looser PID can actually be better. This is especially true if the driver is the button smasher gamer type. Next year we are planning on a very tight PID values for Auto and looser PID values for teleop. This year we tuned it to a value between the 2 ideal settings. For 2015 we are looking forward to the power distribution boards ability to log current draw of all motors. The excel spread sheet and code TOM LINE posted looks very promising for swerve power analysis under battle field conditions. We don't know what our swerve consumes on the field and we should know this. So again I ask why is there a need to bash the steering for very fast and precise angle? |
Re: Jaguars and FAST PID Looptimes
Quote:
The answer depends on what you want to accomplish with the swerve. Rapid evasive maneuvers require faster response than a gently sweeping curve. The steering doesn't have to be perfect or instantaneous. But if the steering is way too slow or inaccurate, the vehicle will not behave as desired. Your team seems to have found an acceptable compromise. Can you link to some videos showing rapid evasive maneuvers? |
Re: Jaguars and FAST PID Looptimes
Quote:
This loop was minimally tuned to stop any shaking. We didn't spend a lot of time optimizing it. Response of wheels turning 90 degrees wasn't timed. I would guess around 250ms. As tuned, it visibly overshoots a little and comes back on a full speed 90 degree move. This was all copied from Bombsquad. Looking back on their original code (2013), it looks like we took D from 0 to .2 and increased the STEERPOW from .75 to 1. I don't know what motor or reduction they used. Next year we'll be looking to decrease the loop period and the tolerance if we do a swerve again. The speed and response was just fine but it could have driven straighter. PID loops setup like this: Code:
#define CONTINUOUS true |
Re: Jaguars and FAST PID Looptimes
Quote:
When you commanded rapid evasive maneuvers, did it consistently behave as expected1? Do you have some videos? 1 i.e. "as expected" according to kinematic calculations. |
Re: Jaguars and FAST PID Looptimes
http://www.thebluealliance.com/match/2014wimi_qf3m1
This is high def match video from Wisconsin. It ended up 3 vs 1 so we have lots of room to drive around at the end. |
| All times are GMT -5. The time now is 01:44. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi