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.
Robot.driveTrain.drive(forward, 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

Friday, February 26, 2016

Material Design - The Much-Needed Standard for Web Design

Material Design is a concept created by Google that standardizes web design. Without Material Design, there is no real set of guidelines for design specifically geared towards the web and mobile apps. The web needs a better standard for design that is user-friendly, easy-to-use, and visually appealing. This is where Material Design comes in.

"We challenged ourselves to create a visual language for our users that synthesizes the classic principles of good design with the innovation and possibility of technology and science. This is material design." – Google

Material Design imagines elements made out of "paper", which has properties much like real life. Through visual effects, mainly to do with lighting, it can be easy to make "material" (the "paper" mentioned above) feel like the user is manipulating a physical object. By blending the boundaries between user interaction and the results that come from it, Material Design focuses on making every action feel as natural as possible.


Material Design focuses on three major principles. First of all, the foundation is built by "material," using visual cues to make the overall design feel like a physical layout that the user is manipulating. Second of all, Material design is bold, in that every fine detail is intentional, creating a structure, and maintaining focus throughout the website or app. Third of all, Material Design is meant to empower the user, putting the user in control of every motion, and making the user the "God" of the layout.

Material Design provides the necessary tools that will allow web developers to unify the web into a fluid, user-friendly design, improving the experience of everyday users, while diminishing the patchwork state that the web is in today.

Wednesday, February 10, 2016

Vim – Making CLI Programming Bearable

Programmers use a variety of text editors, ranging from Xcode to IntelliJ. One text editor, vim, is a very popular alternative. It runs on the command line, making it different from most other editors. One thing that sets vim apart is its customizability. Vim includes its own programming language, VimScript, exclusively for customization. It is a very unique text editor that can take some time to get used to, but will be worth it in the end.

The number of features in this command-line editor may be surprising; in fact, hardcore people would probably use vim as an entire operating system if they could. It has a file explorer, syntax highlighting, auto completion, code folding, outlining, plugin support, and just about anything you can think of. Because it's terminal based, it fully supports ssh. Want to run an external command without exiting vim, simple put a ! before it, such as :!git commit.

Vim is one of the most configurable editors out there, with an entire programming language dedicated to configuring vim. Every feature can be toggled, every key mapped and remapped, and every aspect changed. If you can manage to find something that isn't possible in vimscript, vim also has a plugin system that allows you to download a whole host of third-party plugins (such as Eclim, an Eclipse IDE implementation for vim).


A small sample of the an average-sized vim configuration file
Vim can be used as a simple text editor or a fully fledged IDE, making it better than most graphical text editors.