Monday, February 29, 2016

FIRST Robotics and WPILib – Robotics Programming Made Possible

Imagine a library that allows you to control any motor or pneumatic servo with one line of code. Rather than spending hours and thousands of lines of code developing sequential command-based runtime, motor control algorithms, steering algorithms, and more, imagine driving a robot (for example) with one line of code., turning);
WPILib, by the respected Worcester Polytechnic Institute, is a Java (and C++, but this will cover the Java portion; expect similar results, when applicable, when it comes to C++) library that makes it easy to program a fully function robot through the RoboRIO-based control system. This system is what FIRST* Robotics Competition (FRC) teams use to program their robot for competition.

The FIRST (For Inspiration and Recognition of Science and Technology) Robotics Competition is a team-building challenge where teams (thousands of them across the country) is given a "game" in which multiple teams will be competing against each other in. The teams must then design, build, program, and test a robot within the next 6 weeks which must play this "game."
"Under strict rules, limited resources, and the guidance of volunteer mentors including engineers, teachers, business professionals, parents, alumni and more, teams of 25+ students have just six weeks to build and program robots to perform challenging tasks against a field of competitors. They must also raise funds, design a team "brand," hone teamwork skills, and perform community outreach. In addition to learning valuable STEM and life skills, participants are eligible to apply for $25+ million in college scholarships." – FIRST
Each match will, typically, last about 2.5 minutes. During the first 15-30 seconds, the robot must act fully autonomously, trying to score as many points as possible (you gain more points during this time). After the autonomous portion, control is handed over to (up to 2) drivers, who must continue the quest to score as many points as possible.

This year (early 2016), I was glad to participate in the Searsport robotics team, the Viking Landers, as part of the programming team (of which I will be taking over as Lead Programmer next year). In this year's competition, each of the 2 alliances (3 teams each) must breach defenses and score boulders into goals to weaken the opponents' tower. During the final 20 seconds of the match, the alliance may surround the opposing tower to capture it, scoring points. As well, teams may scale the tower to score even more points. The alliance with the highest score at the end wins.

WPILib is the Java library that teams use to program their robot. WPILib is the interface between the DriverStation (a remote GUI that provides basic control and status updates) and the hardware on the robot. WPILib includes many features such as control bindings, motor control, command-based programming, communication, image filtering, the SmartDashboard, Vision Tracking, and much more. As a user of WPILib myself, I found that I was very surprised at how easy it was to program the robot, even though I believe that Eclipse will be the end of the world.

For the people, like me, who absolutely hate Eclipse, there are ways to use WPILib in a different IDE (like IntelliJ IDEA). One of which is GradleRIO, which allows you to push code and administer your robot, through simple Terminal commands, with code written from any IDE that supports Gradle. WPILib features a code generator, RobotBuilder, that allows you to develop the structure and flow of your code without writing a single line. FIRST Robotics will send you a direct download link to RobotBuilder (all it is is a .jar file), upon request, so you can happily program away, while using any Gradle-supported IDE you want.

* FIRST is a registered trademark of FIRST

No comments:

Post a Comment