Using C (and Linux!) for Programming (and interfacing with FMS, etc.)

This year is the first year that I’ll be programming a FRC robot (one from a previous season, and for experimental purposes). The main problem with our existing system is that we use Windows for programming our robot. That works fine, and I think for the next season or so we’ll keep using it, but we’d like to transition to a more “free” alternative. Rather than paying money for LabVIEW, we’d like to be able to program our robot using C (and any command-line tools), a text editor, and Linux. We’ve heard of the WPI library, but there doesn’t seem to be a C version (or, at least, I haven’t heard of it working in C).

I’m sure we’d be fine with using the Driver Station software that is provided, but beyond that we’d like to shy away from graphical utilities and use text editors and command-line compilers.

Does anyone have any level of experience with this kind of stuff in competition? Is it possible that we could get everything interfacing nicely with the FMS and the Driver Station? Do you have any helpful tips or examples? Thanks a bunch.

If you decide to use Java, all the build tools (ie. netbeans with ant integrated) are free and cross-platform, and you should be able to build & deploy on the command line with ant once you create the project and the corresponding build.xml with netbeans. I would certainly like to be able to use Linux (and vim especially), but trying to get the Driver Station working on any OS but Windows is more effort than I’m willing to apply, for little actual gain.

We use Java on Linux every year to program our robot, and it works perfectly fine. I doubt that you would be able to get C to play nice without some fairly in-depth changes, and I’m not sure those would be legal anyway. If you are looking to move towards free and open-source options, Java on Linux is a good choice.

Using the standard toolchain increases the number of people who can help you if you have problems, particularly if you need programming help at a regional. Netbeans on Linux would likely be familiar enough that you’d be able to get help.

I think it’s cumbersome to need two computer to test robot code, but that’s a personal decision.

Don’t expect any support for running the driver station on anything but Win7 or Win8/8.1.

You get Windows 7 in the Classmate image, but it only works on the Classmate.

Have you checked out ucpp before? I’ve never used it, but I’ve heard of teams using it in the past. It’s supposed to let you compile and deploy from a linux command line in C++. Here’s the Github Repo.

GCC 4.8 has been ported to vxWorks and there’s a cross compiler for linux, and you can build C++ programs for the cRio using that toolchain. Check out this thread, or this site.

I created a linux-based VM that you can build to build stuff using this toolchain on: https://github.com/virtuald/frc-gcc-vm

You don’t have to pay anything for LabVIEW (besides what you already did in order to participate in FRC). You receive both LabVIEW and the WindRiver C programming environment in the Kit of Parts. The WPI library is provided with interfaces for LabVIEW, C/C++, and Java.

Many of the important programs you will need are available only as Windows executable files. It take extreme effort to avoid Windows in FRC, and it is literally against the rules not to use it during a match. Since money for LabVIEW isn’t an issue, what is your real reason for wanting to dump Windows (which you admit is working fine for you)?