|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Team 254 2011 FRC Code
Hey all,
I'm Eric Bakan and I'm Team 254's Head of Programming/Controls aka Chief Executive Brogrammer. With the conclusion of our last offseason event, the MadTown Throwdown, Team 254 is releasing our 2011 FRC codebase. The code can be viewed and downloaded from our team GitHub at https://github.com/Team254/FRC-2011 We had used SVN for the duration of the season but unfortunately our server died and we lost all our SVN backlogs. Based on our programming team's previous experience we've decided to move to Git for our version control, primarily because it allows us to make offline commits when we have intermittent internet access on our developer laptop. At the moment this is merely the snapshot of our code as of the end of Championships. We hope that releasing this code will prove useful to other teams. The included README should provide useful details about the architecture of the system and the individual files should have further notes. Our only request is that you leave a reply if you found any of this code helpful. Everything is released under a 2-Clause BSD License so feel free to use any part of it. Last edited by ebakan : 14-11-2011 at 15:56. |
|
#2
|
|||||
|
|||||
|
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. |
|
#3
|
|||||
|
|||||
|
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
![]() |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
||||
|
||||
|
Re: Team 254 2011 FRC Code
Quote:
|
|
#6
|
|||
|
|||
|
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. |
|
#7
|
|||||
|
|||||
|
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..
|
|
#8
|
||||
|
||||
|
Re: Team 254 2011 FRC Code
Quote:
|
|
#9
|
|||||
|
|||||
|
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. |
|
#10
|
|||
|
|||
|
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. |
|
#11
|
|||||
|
|||||
|
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. |
|
#12
|
||||
|
||||
|
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. |
|
#13
|
|||||
|
|||||
|
Re: Team 254 2011 FRC Code
Quote:
|
|
#14
|
|||
|
|||
|
Re: Team 254 2011 FRC Code
Quote:
|
|
#15
|
|||||
|
|||||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|