WPILib

Simplified Robot Controller Programming

Introduction

WPILib is a framework for programming FIRST Robotics Competition robots. This version of the library will work with FRC 2006-2007 and 2004/2005 robot controllers. This is an expanded version of the library that is used by easyC Pro. WPILib is available for FREE to all FIRST teams.

What WPILib does for you

Using WPILib you get these features:

Using WPILib with Microchip MPLab

You can create robot programs with any development tools. You need to link the application with the correct version of WPILib and the IFI library. The version depends on the robot controller model (2004-5 or 2006-7). You can either write a single main program (main C function) or a competition program with three functions: Initialize(), Autonomous(), and OperatorControl(). These functions will automatically be run by WPILib. By default a single main program is assumed, if you want a competition project you need to add an IO_Initialization function that calls SetCompetitionMode(1). This will cause WPILib to look for your Autonomous, OperationControl and Initialize functions.

Here is an example of creating a project with MPLab, the software from Microchip that ships with the FRC kit of parts.

How to get WPILib

Downloading:
WPILib documentation

WPILib is incorporated into all the samples programs in the next section. It is version 785 software (currently FRC 2004-2006 version, and now VEX ). To get the software - extract the zip file into c:\WPILib and it will work with all the sample programs in the next section.

Sample Programs

There are a bunch of sample programs that were shown at the kickoff workshops that show the use of basic motor operation, gyros, gear tooth sensor, and camera. These can be found here.

Using Eclipse with WPILib

You can build programs using eclipse as the development environment for WPILib or straight any projects based on the default code.

You need install the following components: 

1.       Get a copy of mingw from their website: http://www.mingw.org/download.shtml. You want to e MinGW installation half way down the page.

2.       You also need to install the C18 compiler and tools from the IFI software CD that came with the kit.

3.       You need the CDT (C development tools) that you can add to eclipse using its update feature and searching for new features.

4.       Lastly, you need 2 plug-ins, the mcc18 toolchain and a custom error parser. The plug-ins are just copied to the plugins directory in eclipse. 

Install everything and make sure that the mcc18\bin and the mingw\bin directories are in your path so that eclipse can find them. Now, when you create a project using the wizard, make sure it is a “managed make C project”. On the “Select type of project” dialog box, be sure to select “Microchip Embedded Systems”, and make sure that “FRC 18f8722 WPILib Robot” is selected. 

Be sure that mcc18\h is in the include path, 18f8722.lkr is the linker file, mcc18\lib is in the library search path, and that you are including WPILib\2k6\WPILib2k6.lib and WPILib\2k6\FRC2k6_library.lib in that order. 

That should pretty much do it.

How to get help

Currently you can email me (Brad Miller). I'll try to get a forum up here soon.