FRC stands for the FIRST Robotics Competition, and it is a robot competition for high school students to compete in. They have 6 weeks to model, design, build, program, wire, and media-ify and business-ify the robot! Afterwards, they go and compete in a regional competition! I am currently mentoring a Montreal high school team in programming- teaching them Java for the first time! Here were my thoughts about week 2!
During the week the students at the other school had their first experience with programming through Processing. Processing is a Java environment used to create interactive art projects. Since they all are “Photoshop gurus” already, this would be a fantastic way to introduce programming to them. We created a “sketch” where an ellipse was drawn. We then were able to move the ellipse around, and in the process learned about integers, operators, and the coordinate system.
This knowledge solidified some students to join the programming team for the big meeting on Saturday. We began by detailing the things we wanted to do today, and what goals we will need to achieve in the following weeks.
For this Saturday, we wanted to…
– Read from the encoders
– Analyze the default line sensing code, and try the line sensor
– Set up the wireless on the robot
We were able to achieve most of these, and learn even more about WPIlibJ in the process.
The lead veteran programmer of the team describes Java as a bittersweet change from LabView. Although Java is used more in real world computer science scenarios (client programs, university courses, Android apps), its vision processing is not as accessible as LabView. On top of that, there is the learning curve with learning a completely new way of writing, organizing, and displaying algorithms.
The three programmers got set up with the Netbeans distribution and the proper nbm files. We then dove head first into the code, and started with a simple program that would read an encoder, and display it on the screen. Once that worked, we added on to that and made the motor move.
Afterwards, we added a tick-tock algorithm that introduced the modulus operator to the programmers. This was designed to change the motor direction every five seconds. The three programmers grasped this algorithm and understood it fully after explanation.
A little bit of a design oversight, the cRio is such a fast processor, that it became stuck in the tick-tock quite often, as we were rounding the time from a double to an integer, and comparing it to a value of 5 seconds. Had this have been in milliseconds, there would not have been a problem. The veteran programmer suggested a “first pass” check, which fixed the problem.
After the lunch break, the veteran programmer was also able to make the camera display on the driver station, and control the servos with a joystick.
During that time, the other programmers took some time to play with Processing a bit more. They were able to setup the basic sketch template, and added text drawn to the screen with a customized font. We explored the nature of for loops by drawing the text multiple times inside of the loop. This was a great demonstration of iteration in action.
We almost had time to play with the light sensors, but the connections took quite a bit of time.
Nearing the end of the day, we were trying to get the wireless set up, the last item on our todo list. Although Chief Delphi was down for the entire time, we were somehow able to figure it out despite the number of road blocks. Hooray for wireless programming!
It was then time to head back home. We departed from week 2 feeling pretty confident about the capabilities that Java will provide us. Next week, our goals are to get some driving working (PID control, maybe), and also get the line sensors to work. Go programming team!
Are you mentoring any FIRST robotics teams? Are you a programming mentor too? What have you run into so far? Leave a comment below! 😀