Official Repository of WPILibJ and WPILibC
Switch branches/tags
v2019.1.1-beta-2 v2019.1.1-beta-1 v2018.4.1 v2018.3.3 v2018.3.2 v2018.3.1 v2018.2.2 v2018.2.1 v2018.1.1 v2018.1.1-beta-5 v2018.1.1-beta-4 v2018.1.1-beta-3 v2018.1.1-beta-2 v2018.1.1-beta-1 v2018.1.1-alpha-1 v2017.3.1 v2017.2.1 v2017.1.1 v2017.1.1-rc-2 v2017.1.1-rc-1 v2017.1.1-beta-3 v2017.1.1-beta-2 v2017.1.1-beta-1 v2016.5.1 test-tag jenkins-stable-2016.433 jenkins-stable-2016.422 jenkins-stable-2015.340 jenkins-stable-2015.332 jenkins-stable-2015.330 jenkins-stable-2015.326 jenkins-stable-2015.312.beta jenkins-stable-2015.308.beta jenkins-stable-2015.286.beta jenkins-stable-2015.262.beta jenkins-stable-2015.247.beta jenkins-stable-2015.230.beta jenkins-stable-2015.213.beta jenkins-stable-2015.130.beta jenkins-stable-2015.129.beta jenkins-stable-2015.117.beta jenkins-stable-2015.83.beta jenkins-stable-2015.80.beta jenkins-stable-2015.79.beta jenkins-stable-2015.73.beta jenkins-stable-2015.69.beta jenkins-stable-2015.66.beta jenkins-stable-2015.29.beta jenkins-stable-2015.26.beta jenkins-stable-2015.23.beta jenkins-stable-2015.9.beta jenkins-release-2016.433 jenkins-release-2016.413 jenkins-release-2016.405 jenkins-release-2016.404 jenkins-release-2015.337 jenkins-release-2015.332 jenkins-release-2015.330 jenkins-release-2015.326 jenkins-release-2015.312.beta jenkins-release-2015.308.beta jenkins-release-2015.286.beta jenkins-release-2015.262.beta jenkins-release-2015.247.beta jenkins-release-2015.230.beta jenkins-release-2015.213.beta jenkins-release-2015.173.beta jenkins-release-2015.130.beta jenkins-release-2015.129.beta jenkins-release-2015.117.beta jenkins-release-2015.66.beta jenkins-release-2015.65.beta jenkins-release-2015.26.beta jenkins-beta-2015.304 2014-simulation-alpha-rc3 2014-simulation-alpha-rc1
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
buildSrc/src/main/groovy Export C functions from JNI statically linked library (#1425) Nov 13, 2018
cameraserver CameraServer: enable usb cameras on non-Linux platforms (#1411) Nov 10, 2018
cmake/modules cmake: Compile cscore and wpiutil examples (#1286) Aug 20, 2018
cscore Add support for USB Webcams on Windows (#1390) Nov 18, 2018
docs Enable HTML5 javadocs (#1267) Oct 29, 2018
gradle/wrapper Update to gradle 4.9 (#1193) Jul 19, 2018
hal Convert ReadInterrupt* to return int64_t time (#1417) Nov 16, 2018
myRobot Update build setup for raspbian and debug binaries (#1384) Oct 27, 2018
ntcore Export C functions from JNI statically linked library (#1425) Nov 13, 2018
shared Add support for USB Webcams on Windows (#1390) Nov 18, 2018
simulation Remove large HAL headers from wpilibc headers (#1386) Oct 29, 2018
styleguide Update to 2019 RoboRIO and 2019 v4 image (#1352) Oct 8, 2018
test-scripts Stop webserver on test run (#1420) Nov 10, 2018
wpilibc Add mechanism to control Shuffleboard recordings and add event markers ( Nov 19, 2018
wpilibcExamples Add an example of using the HAL directly (#1374) Nov 16, 2018
wpilibcIntegrationTests Move applicable integration tests to native build as unit tests (#1364) Oct 29, 2018
wpilibj Add mechanism to control Shuffleboard recordings and add event markers ( Nov 19, 2018
wpilibjExamples Fix deprecation warning in wpilibj shuffleboard example (#1427) Nov 13, 2018
wpilibjIntegrationTests Move HAL classes to their own base package (#1317) Sep 21, 2018
wpiutil cscore: Add JSON for source settings (#1423) Nov 11, 2018
.clang-format Set up wpiformat Jan 2, 2018
.gitignore Bring back the gazebo plugins (#1063) Jun 30, 2018
.styleguide Move CameraServer and WPILib headers into their own folder Jul 23, 2018
.styleguide-license Set up wpiformat Jan 2, 2018
CMakeLists.txt cmake: Compile cscore and wpiutil examples (#1286) Aug 20, 2018
CONTRIBUTING.md Run wpiformat on merged repo (#1021) May 14, 2018
LICENSE.txt LICENSE.txt: Update copyright date to 2018. (#1100) May 26, 2018
MavenArtifacts.md Add maven documentation (#1140) Jun 29, 2018
README-CMAKE.md Adds CMake Readme (#1042) May 13, 2018
README.md Fix link for license (#1367) Oct 14, 2018
ThirdPartyNotices.txt Discuss and include licenses for third party software. (#1101) Jun 29, 2018
azure-pipelines.yml Update build setup for raspbian and debug binaries (#1384) Oct 27, 2018
build.gradle Add support for USB Webcams on Windows (#1390) Nov 18, 2018
gradlew Switches to the new build system (#87) Aug 19, 2017
gradlew.bat Adds new build system to repo (#1) Jul 28, 2017
settings.gradle Use external dependencies for NI and NetComm libraries (#1304) Sep 20, 2018
tidy-html.conf Format HTML and XML files (#944) May 16, 2018
tidy-xml.conf Format HTML and XML files (#944) May 16, 2018
wpilib-config.cmake.in Adds CMake Builds (#1015) May 3, 2018

README.md

WPILib Project

Build Status

Welcome to the WPILib project. This repository contains the HAL, WPILibJ, and WPILibC projects. These are the core libraries for creating robot programs for the roboRIO.

WPILib Mission

The WPILib Mission is to enable FIRST Robotics teams to focus on writing game-specific software rather than focusing on hardware details - "raise the floor, don't lower the ceiling". We work to enable teams with limited programming knowledge and/or mentor experience to be as successful as possible, while not hampering the abilities of teams with more advanced programming capabilities. We support Kit of Parts control system components directly in the library. We also strive to keep parity between major features of each language (Java, C++, and NI's LabVIEW), so that teams aren't at a disadvantage for choosing a specific programming language. WPILib is an open source project, licensed under the BSD 3-clause license. You can find a copy of the license here.

Building WPILib

Using Gradle makes building WPILib very straightforward. It only has a few dependencies on outside tools, such as the ARM cross compiler for creating roboRIO binaries.

Requirements

  • A C++ compiler
    • On Linux, GCC works fine
    • On Windows, you need Visual Studio 2015 (the free community edition works fine). Make sure to select the C++ Programming Language for installation
  • ARM Compiler Toolchain
    • Note that for 2017-2018 and beyond, you will need version 5 or greater of GCC
  • Doxygen (Only required if you want to build the C++ documentation)

Setup

Clone the WPILib repository. If the toolchains are not installed, install them, and make sure they are available on the system PATH.

See the styleguide README for wpiformat setup instructions.

Building

All build steps are executed using the Gradle wrapper, gradlew. Each target that Gradle can build is referred to as a task. The most common Gradle task to use is build. This will build all the outputs created by WPILib. To run, open a console and cd into the cloned WPILib directory. Then:

./gradlew build

To build a specific subproject, such as WPILibC, you must access the subproject and run the build task only on that project. Accessing a subproject in Gradle is quite easy. Simply use :subproject_name:task_name with the Gradle wrapper. For example, building just WPILibC:

./gradlew :wpilibc:build

If you have installed the FRC Toolchain to a directory other than the default, or if the Toolchain location is not on your System PATH, you can pass the toolChainPath property to specify where it is located. Example:

./gradlew build -PtoolChainPath=some/path/to/frc/toolchain/bin

If you also want simulation to be built, add -PmakeSim. This requires gazebo_transport. We have tested on 14.04 and 15.05, but any correct install of Gazebo should work, even on Windows if you build Gazebo from source. Correct means CMake needs to be able to find gazebo-config.cmake. See The Gazebo website for installation instructions.

./gradlew build -PmakeSim

If you prefer to use CMake directly, the you can still do so. The common CMake tasks are wpilibcSim, frc_gazebo_plugins, and gz_msgs

mkdir build #run this in the root of allwpilib
cd build
cmake ..
make

The gradlew wrapper only exists in the root of the main project, so be sure to run all commands from there. All of the subprojects have build tasks that can be run. Gradle automatically determines and rebuilds dependencies, so if you make a change in the HAL and then run ./gradlew :wpilibc:build, the HAL will be rebuilt, then WPILibC.

There are a few tasks other than build available. To see them, run the meta-task tasks. This will print a list of all available tasks, with a description of each task.

wpiformat can be executed anywhere in the repository via py -3 -m wpiformat on Windows or python3 -m wpiformat on other platforms.

Publishing

If you are building to test with the Eclipse plugins or just want to export the build as a Maven-style dependency, simply run the publish task. This task will publish all available packages to ~/releases/maven/development. If you need to publish the project to a different repo, you can specify it with -Prepo=repo_name. Valid options are:

  • development - The default repo.
  • beta - Publishes to ~/releases/maven/beta.
  • stable - Publishes to ~/releases/maven/stable.
  • release - Publishes to ~/releases/maven/release.

The following maven targets a published by this task:

  • edu.wpi.first.wpilib.cmake:cpp-root:1.0.0 - roboRIO C++
  • edu.wpi.first.wpilibc.simulation:WPILibCSim:0.1.0 - Simulation C++
  • edu.wpi.first.wpilibj:wpilibJavaFinal:0.1.0-SNAPSHOT - roboRIO Java
  • edu.wpi.first.wpilibj:wpilibJavaSim:0.1.0-SNAPSHOT - Simulation Java
  • edu.wpi.first.wpilibj.simulation:SimDS:0.1.0-SNAPSHOT - The driverstation for controlling simulation.
  • org.gazebosim:JavaGazebo:0.1.0-SNAPSHOT - Gazebo protocol for Java.

Structure and Organization

The main WPILib code you're probably looking for is in WPILibJ and WPILibC. Those directories are split into shared, sim, and athena. Athena contains the WPILib code meant to run on your roboRIO. Sim is WPILib code meant to run on your computer with Gazebo, and shared is code shared between the two. Shared code must be platform-independent, since it will be compiled with both the ARM cross-compiler and whatever desktop compiler you are using (g++, msvc, etc...).

The Simulation directory contains extra simulation tools and libraries, such as gz_msgs and JavaGazebo. See sub-directories for more information.

The integration test directories for C++ and Java contain test code that runs on our test-system. When you submit code for review, it is tested by those programs. If you add new functionality you should make sure to write tests for it so we don't break it in the future.

The hal directory contains more C++ code meant to run on the roboRIO. HAL is an acronym for "Hardware Abstraction Layer", and it interfaces with the NI Libraries. The NI Libraries contain the low-level code for controlling devices on your robot. The NI Libraries are found in the ni-libraries folder.

The styleguide repository contains our style guides for C++ and Java code. Anything submitted to the WPILib project needs to follow the code style guides outlined in there. For details about the style, please see the contributors document here.

Contributing to WPILib

See CONTRIBUTING.md.