![]() |
[FTC]: Post your code!
3 Attachment(s)
Post your code so that others may learn from you and you may learn from others!
Here is our code, its not exactly the most readable, we made a lot of changes during our competition and I didn't do any comments for that code, and I'm not exactly good about my commenting in the first place, bet here ya go. Alot of the stuff is very poorly written, from when I was first learning RobotC, so we aren't as bad at coding as you might think from some of this. ;) What each function does: MotorDeadZone: Limits our joystick values to be within +/- 100 and sets it to zero if it is close to zero (this accounts for the joysticks not always returning to zero) Drive: sets the drive motor speed and turns our servo powered castors to the proper position for the setting (we used the d-pad for driving) Arm: pretty self explanatory Flippers: our flippers were NXT powered, and used to quickly knock out opponents puck racks. Uses a button to set a position for the flipper (either up or down) the function is intentionally written so there are no loops, so you can drive regardless of the position LiftBucketToVerticle, LiftBucketToVerticleSlow, BackwardsGoal, BucketToGround, CollectPucksLeft, ColelctPucksRight, and CollectPucksBack are all button activated subroutines to automate difficult and/or common tasks. DriveToTapePlusEncoder: this function was originally supposed to drive until it hits the tape then keep going for an encoder distance, but we switched to a time instead. |
Re: [FTC]: Post your code!
2 Attachment(s)
Attached in the files below. There is only 1 autonomous routine as I wrote a program chooser which hijacks the entire screen from the Driver's Diagnostic Subroutine. (ask any questions that you want about it, if you want to know how to modify it for your own use, tell me, and I will be more than happy to help you do so)
|
Re: [FTC]: Post your code!
I'll post our code later (maybe) but I just thought I'd point something pretty funny out, like unlimited, we numbered our auto and tele-op versions (I highly recommend it as it allows restoring when you screw up (PS do it often)), by the end of the season we were at about version 50 for the new code, until we restarted the numbering, which then counted up to 21, and the old code counted to almost 70, or about 140 version of our auto code.
You know how we wasted our lives now, PS wow, after reading unlimitted's code, I realize how badly commented ours is, and how unrequiredly long. |
Re: [FTC]: Post your code!
Quote:
|
Re: [FTC]: Post your code!
Our code is a few extra hundred lines from the Program chooser, that is a long piece of code...but so very useful by having all your autonomous rountines in one program :). That program chooser was so hard to write, but when it all came together it was so great, the team loved to use it because they could use the screen to choose a program and not have to worry about which code specificly would do what, and could select the alliance, the starting position and finally what routine to run.
|
Re: [FTC]: Post your code!
Quote:
|
| All times are GMT -5. The time now is 18:38. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi