|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Re: Team 254 2011 FRC Code
Thanks for posting! The attention to detail is astounding. 4 different sets of PID gains for the elevator, depending on direction and number of stages engaged?
![]() EDIT: And that's before I even saw the state space controller for the drive ![]() Last edited by Jared Russell : 14-11-2011 at 15:42. |
|
#2
|
|||||
|
|||||
|
Re: Team 254 2011 FRC Code
Incredibly exciting to see such sophisticated robot code being open sourced. I would love to see other teams follow suite
![]() |
|
#3
|
|||
|
|||
|
Re: Team 254 2011 FRC Code
Quote:
Quote:
If you or anyone else has any questions, we'd be glad to try and answer them. |
|
#4
|
||||
|
||||
|
Re: Team 254 2011 FRC Code
Quote:
|
|
#5
|
|||
|
|||
|
Re: Team 254 2011 FRC Code
We used a simple PD loop on the wrist and elevator with some gain scheduling, since it worked well enough after hand tuning. The elevator changes mass when it starts to lift the second stage, so there is a second set of constants for that case. For both the arm and elevator, they would undershoot when approaching the goal from below, and overshoot when approaching the goal from above. To solve this, we have 2 sets of constants, one per direction. This solved our overshoot problems. I also avoid integral whenever possible. We just accepted the small steady state error on the elevator and wrist, and moved on, rather than spending the extra time to tune the integral constant across 6 sets of constants. We pass a goal into the two sub systems when we hit the setpoint buttons. The manual joysticks for those two systems also tweak the goals, rather than doing anything with power.
One thing we realized when driving the robot was that it was very useful for the arm to be angled ~50 degrees above horizontal when lining up to place a tube. To facilitate this, whenever a setpoint button is hit, the elevator raises up, and then when it is all the way up, the arm tilts forwards. When the driver hits another button, the robot then goes through an "auto-score" motion which opens the claw, spits out, lowers the elevator, then raises the arm back up, and backs the robot up. This offloads a lot of stuff from the drivers. Most of the fancy controls is in the drivetrain, which we spent easily over a month working on to tune the robot so that it was accurate and precise enough to score two tubes. |
|
#6
|
|||||
|
|||||
|
Re: Team 254 2011 FRC Code
Ah, if only I knew enough C to appreciate it. (LabVIEW team here) I'm sure it would make me wanna tear up a bit..
|
|
#7
|
||||
|
||||
|
Re: Team 254 2011 FRC Code
Quote:
|
|
#8
|
|||||
|
|||||
|
Re: Team 254 2011 FRC Code
Quote:
Is there any reason that you didn't run the elevator and arm as a single integrated system, to simplify things like this? We ran our elevator/arm as a single state machine, and part of the state transition handled actions like this (with the data input being a requested state, and the data output being a pair of setpoints), and fed the positions output into a pair of setpoint controllers and anti-death logic. |
|
#9
|
|||
|
|||
|
Re: Team 254 2011 FRC Code
Quote:
Looking back, I really like how easy it was to write auto modes with the multi-threading that we did, and would like to make it that easy to write auto-score functions as well. |
|
#10
|
|||||
|
|||||
|
Re: Team 254 2011 FRC Code
Yes, multithreading can lead to prettier/less verbose auto modes, in my experience. We have been prototyping a trapezoidal motion profile as well, and I really like how smoothly it achieves distance setpoints with sub-inch accuracy. Are you using a trapezoidal profile for turning in place, as well? (I didn't notice it, but haven't gone through line by line - yet)
EDIT: Yes, I see that you did ![]() Last edited by Jared Russell : 15-11-2011 at 09:03. |
|
#11
|
||||
|
||||
|
Re: Team 254 2011 FRC Code
I perused the code over lunch and noticed something that confused me. In your ports file you've assigned both the "B" port of an encoder and a limit switch to digital I/O 10. In order to facilitate this, was there a specific order the wires had to go into the DIN for I/O 10?
We rely heavily on limit switches to act as redundant safeties during programming as well as sensor failures, so being able to pair limit switches with encoders in this manner could save us from having to make I/O port tradeoffs. |
|
#12
|
|||||
|
|||||
|
Re: Team 254 2011 FRC Code
The port definitions for the top and bottom roller encoders are probably obsolete. It doesn't look like either of those encoders is actually used in the code, so there's no real conflict.
|
|
#13
|
|||
|
|||
|
Re: Team 254 2011 FRC Code
Correct. There are no encoders on the rollers. That sounds like a very old piece of code that didn't get removed as the code evolved...
|
|
#14
|
|||||
|
|||||
|
Re: Team 254 2011 FRC Code
Austin,
Could you or one of your programmers explain the rationale behind the design of your victor_linearize function? You average 5th and 7th order polynomials together, but it isn't obvious why you do this. Thanks This question was brought on by this thread: http://www.chiefdelphi.com/forums/sh...02#post1085502 |
|
#15
|
|||
|
|||
|
Re: Team 254 2011 FRC Code
Quote:
Here is the data and the three polynomials that are in the function. ![]() I generated the red data points by putting the robot up on blocks and applying PWM to the motors. I then read out the wheel speed at steady state for various PWM values. From there, I tried to fit the data. I first started with a 5th order odd polynomial (The + and - response should be the same, which means that f(x) = -f(-x)). It is shown in green. That wasn't a great fit, so I tried a 7th order polynomial, shown in blue. Neither of them were great fits. They are not monatonically increasing functions. When you drive the robot with them, the robot doesn't feel like the throttle is a consistent function, and it feels weird (it has been a while, and feelings don't translate to words so well.) From there, on a whim, I tried averaging the two functions. This actually turned out quite well. But, when I put it on the robot, it felt like the power was reduced too much at low speeds. To try to compensate for this, I added in a bit of y=x to get the equation shown in the legend above for the pink plot and to boost the power applied at low speeds. This is what is in use today in the victor_linearize function. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|