2067 LabVIEW Code: Swerve, Auto Scripting, Gyro

Our LabVIEW code has been public on GitHub, but I thought I should share it here, in case any teams find some of the code to be useful.

Here is the 2014 Robot Code: https://github.com/applepi-2067/Robot-2014

Swerve Drive
4 wheel independent swerve.
After rewriting the swerve code a few times, I feel that this current version is fairly elegant and easy to understand. If any LabVIEW teams are interested in our code, it’s all in the “Swerve Drive” folder. There’s also a presentation describing how it works.
If you want to see what it looks like, here’s an image of the main swerve block, and here’s an image of Swerve Wheel.vi, which is used to control one wheel.

Autonomous Scripting
This was never actually used in competition; I wrote it during the summer. It’s called AppleScript, and is designed to be easily updated on the fly in a competition. The autonomous script is stored on the driver station computer, and when you make changes to it, the code is immediately updated on the robot, without need for redeploying code. A one ball auto might look like this:
(I made some custom syntax highlighting on Notepad++). There’s also a manual for this scripting language.
Since I wrote the code somewhat recently, it’s not bug-free. A few weeks ago, I had trouble writing a two ball auto, as the command timer wasn’t functioning correctly. I think I fixed it, but I haven’t been able to test my changes. The code is under the “AppleScript” folder on the GitHub repo.

Custom Gyro Code
During the season, our main problem with swerve was dealing with gyro drift and whatnot. In the offseason, I rewrote the gyro library, which alleviated most of the problems. The code is based off Chris Hibner’s great advice here. Basically, the gyro is continuously calibrated (bias is calculated) up until the start of the match. Our code actually has support for up to two gyros, one mounted upside down, one facing up. We tested this setup to see if it would help the gyros behave better, but the results for that were rather inconclusive. This code is under the “Gyro” folder on the GitHub repo.

Note: might want to pick a better name for your auto scripting language… [http:// https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html](http:// https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html)

Otherwise thanks for posting this

Thanks for posting code! This will come in very handy for swerve teams.
Also, Applescript is neat.

Yeah, I recently noticed this. I was too lazy to rename everything, though :stuck_out_tongue:

If like to see the presentation but get an error when I click it. Can you check the link?

See if this one works:

Much better. Thanks for sharing.

dude this is awesome. Is the scripting LabView-only?

The script interpreter is written in LabVIEW, so that probably means yes.