Log in

View Full Version : 1678 code release


wesleyac
31-08-2016, 22:55
1678 is proud to present our code for our 2016 robot, Adrian (https://github.com/frc1678/robot-2016)!

Some cool features of our code include:


5 different control loops
Unit-aware variables (https://github.com/frc1678/robot-2016/tree/master/unitscpp) (no more unit errors)
Custom programming language (https://github.com/donald-pinckney/lemonscript) for describing auto routines
Two ball auto (https://github.com/frc1678/robot-2016/blob/master/frc1678/auto/two_ball.auto), that even works sometimes!
Custom build system
Vision alignment (https://github.com/frc1678/robot-2016/tree/master/vision)


If you're interested in building the code, you'll need a computer running linux or mac (although all of our students use linux, so I'm not sure if it still builds on mac).

You'll need to install bazel. Once you've done that you can run:


bazel build //frc1678 --cpu=roborio # Builds the code
./deploy # Deploys the code to the robot



We're also releasing our code for our 2015 robot Lemon Drop (https://github.com/frc1678/robot-2015).

If you have any questions about our code, feel free to ask! Most of our students spend all their waking hours on chief, so we should get back to you quickly :P

azaclauson
01-09-2016, 01:16
I've got a question :).

Was there any particular reason not to use Commands?

It looks like your 2016 program would have suited the command based approach so I'm wondering if you tried it and encountered some shortcomings or something else?

wesleyac
01-09-2016, 02:08
There are a few reasons that we didn't use wpilib's command based system. The first one is that our tendency is to look at what we want to do, and decide and create the architecture based on that - if we choose to use wpilib's command based system, we don't have very much flexibility to change it.

Another reason is that programmers on our team tend to distrust wpilib. I've seen what I think it should do and what it's actually doing vary far too many times for me to trust it. We've gotten to the point of isolating all calls to wpilib to one wrapper thread, just so we don't have to deal with interfacing with it directly anymore.

I haven't looked into command based programming much, but it looks like it has the following problems:


Poor/no (?) threading support
only runs when it gets DS packets


We end up having a similar system to command based programming in some places (lemonscript, the drivetrain subsystem, etc), but this allows us to implement it in a way that fits into our codebase well, and also lets us only use it where it makes sense to use it - in other places different methods work just as well, or better.

apache8080
08-12-2016, 23:44
Is lemonscript what allows you guys to avoid using wpilib through your main code?

After looking at your code a little closer, it seems like you guys are using lemonscript as a scripting language for autonomous loops. I get how this works during the autonomous period since the robot doesn't need to actually be communicating with the DS during that time other than when auto begins and when it ends. I don't get how you guys are getting joystick input during teleop. Does lemonscript handle this in someway?

This may be a dumb question but thanks for the help.

Also thanks for the great resources.