As the lead (and only) programmer on team 885, The Green Team, I’d like to offer up last season’s Java code to everyone so we can reuse parts of it, and hopefully so that people can learn from it.
My team doesn’t have a huge programming presence; I took on all the robot programming this year, with help from a mentor who’s experienced in Java and Git. I had some experience in Java beforehand but this was also my first year getting my hands dirty with actual robot code. As a result, this robot, like most 885 robots, gets the job done without a lot of bells and whistles like ultrasonic sensors or vision processing. If you’re looking for the next big game-changing control paradigm, you won’t find it here.
However, as a result of a lot of sweat and tears during build season, this robot possesses a respectable PID control scheme for autonomous navigation. Nobody on the team was familiar with implementing PID controllers in Java, so we essentially built it up through trial and error. Two PID controllers, one reading heading from a NavX board and one reading distance from drive encoders, keep the robot going in a straight line as it navigates from point to point in an autonomous routine. This resulted in autonomous routines that were repeatable to within two inches. Teams looking for a quick and dirty way to get their robot to drive straight and drive precisely to a target distance at the same time might find this helpful.
There are more details in the Readme file in the repository. The code can be found at:
distancePID is the most up-to-date branch. The code is contained within an eclipse project, and can either be cloned by those with the know-how, or downloaded using the button on the right.
Again, since I’m new to this, feel free to ask for clarification and let me know if you have issues accessing the code. Thanks!