• Stars
    star
    1,046
  • Rank 44,046 (Top 0.9 %)
  • Language
    C++
  • License
    Other
  • Created about 10 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Official Repository of WPILibJ and WPILibC

WPILib Project

Gradle C++ Documentation Java Documentation

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.

Quick Start

Below is a list of instructions that guide you through cloning, building, publishing and using local allwpilib binaries in a robot project. This quick start is not intended as a replacement for the information further listed in this document.

  1. Clone the repository with git clone https://github.com/wpilibsuite/allwpilib.git
  2. Build the repository with ./gradlew build or ./gradlew build --build-cache if you have an internet connection
  3. Publish the artifacts locally by running ./gradlew publish
  4. Update your build.gradle to use the artifacts

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

  • JDK 11
    • Note that the JRE is insufficient; the full JDK is required
    • On Ubuntu, run sudo apt install openjdk-11-jdk
    • On Windows, install the JDK 11 .msi from the link above
    • On macOS, install the JDK 11 .pkg from the link above
  • C++ compiler
    • On Linux, install GCC 11 or greater
    • On Windows, install Visual Studio Community 2022 and select the C++ programming language during installation (Gradle can't use the build tools for Visual Studio)
    • On macOS, install the Xcode command-line build tools via xcode-select --install. Xcode 13 or later is required.
  • ARM compiler toolchain
    • Run ./gradlew installRoboRioToolchain after cloning this repository
    • If the WPILib installer was used, this toolchain is already installed
  • Raspberry Pi toolchain (optional)
    • Run ./gradlew installArm32Toolchain after cloning this repository

On macOS ARM, run softwareupdate --install-rosetta. This is necessary to be able to use the macOS x86 roboRIO toolchain on ARM.

Setup

Clone the WPILib repository and follow the instructions above for installing any required tooling.

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

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.

If opening from a fresh clone, generated java dependencies will not exist. Most IDEs will not run the generation tasks, which will cause lots of IDE errors. Manually run ./gradlew compileJava from a terminal to run all the compile tasks, and then refresh your IDE's configuration (In VS Code open settings.gradle and save).

Faster builds

./gradlew build builds everything, which includes debug and release builds for desktop and all installed cross compilers. Many developers don't need or want to build all of this. Therefore, common tasks have shortcuts to only build necessary components for common development and testing tasks.

./gradlew testDesktopCpp and ./gradlew testDesktopJava will build and run the tests for wpilibc and wpilibj respectively. They will only build the minimum components required to run the tests.

testDesktopCpp and testDesktopJava tasks also exist for the projects wpiutil, ntcore, cscore, hal wpilibNewCommands and cameraserver. These can be ran with ./gradlew :projectName:task.

./gradlew buildDesktopCpp and ./gradlew buildDesktopJava will compile wpilibcExamples and wpilibjExamples respectively. The results can't be ran, but they can compile.

Build Cache

Run with --build-cache on the command-line to use the shared build cache artifacts generated by the continuous integration server. Example:

./gradlew build --build-cache

Using Development Builds

Please read the documentation available here

Custom toolchain location

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

Formatting/linting

Once a PR has been submitted, formatting can be run in CI by commenting /format on the PR. A new commit will be pushed with the formatting changes.

wpiformat

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

Java Code Quality Tools

The Java code quality tools Checkstyle, PMD, and Spotless can be run via ./gradlew javaFormat. SpotBugs can be run via the spotbugsMain, spotbugsTest, and spotbugsDev tasks. These tools will all be run automatically by the build task. To disable this behavior, pass the -PskipJavaFormat flag.

If you only want to run the Java autoformatter, run ./gradlew spotlessApply.

CMake

CMake is also supported for building. See README-CMAKE.md.

Running examples in simulation

Examples can be run in simulation with the following command:

./gradlew wpilibcExamples:runExample
./gradlew wpilibjExamples:runExample

where Example is the example's folder name.

Publishing

If you are building to test with other dependencies 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 maven artifacts are described in MavenArtifacts.md

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, 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 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 project.

The upstream_utils directory contains scripts for updating copies of thirdparty code in the repository.

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.

More Repositories

1

GradleRIO

The official gradle plugin for the FIRST Robotics Competition
Java
259
star
2

frc-docs

Official FRC Documentation powered by Read the Docs
JavaScript
144
star
3

vscode-wpilib

Visual Studio Code WPILib extensions
TypeScript
111
star
4

shuffleboard

A modern dashboard for FRC
Java
79
star
5

sphinxext-opengraph

Sphinx extension to generate unique OpenGraph metadata
Python
74
star
6

PathWeaver

Desktop application for generating motion paths
Java
64
star
7

frc-characterization

Tools to help FRC teams measure the physical parameters of their robot
Python
51
star
8

ntcore

NetworkTables Core Library (ARCHIVED, merged into allwpilib)
C++
39
star
9

RobotBuilder

Generate C++ or Java FRC programs
Java
36
star
10

sphinxext-rediraffe

Sphinx extension to redirect files
Python
32
star
11

2024Beta

Repository for Beta Testing of 2024 Software
32
star
12

sysid

System identification for robot mechanisms
C++
28
star
13

cscore

Camera access and streaming library (ARCHIVED, merged into allwpilib)
C++
24
star
14

SmartDashboard

Java
23
star
15

VisionBuildSamples

ARCHIVED - Samples for building Vision code for desktop and coprocessors
Java
18
star
16

EclipsePlugins

Java
14
star
17

Axon

TypeScript
14
star
18

sphinxext-remoteliteralinclude

Extends literalinclude to include URLs
Python
13
star
19

DetectCoral

Object detection for the FIRST Robotics Competition
Python
13
star
20

gradle-jni

Gradle plugin for ease of creating JNI libraries.
Java
13
star
21

wpilib-ws-robot-romi

TypeScript
10
star
22

sphinxext-pwa

Sphinx extension to make a PWA.
Python
9
star
23

vendor-template

C++
9
star
24

WPILibInstaller-Avalonia

C++
8
star
25

OutlineViewer

Java
8
star
26

Control-System-Vectors

Collection of community contributed vectors of the FRC Control System
7
star
27

wpiutil

WPI Utility Library
C++
7
star
28

docker-images

Docker images for building WPILib
Makefile
7
star
29

xrp-wpilib-firmware

C++
7
star
30

sphinxext-photofinish

Sphinx extension that adds responsive images to documentation
Python
6
star
31

frc-docs-translations

Translation Repository for frc-docs
Python
6
star
32

opensdk

Shell
6
star
33

thirdparty-opencv

OpenCV Maven packaging for FRC
C++
6
star
34

toolchain-builder

RoboRio Compiler < 2020 (See https://github.com/wpilibsuite/roborio-toolchain for 2020+)
Shell
5
star
35

design-docs

Design documents for proposed additions and changes to the wpilibsuite projects
5
star
36

NetworkTablesClients

NT Client implementations for multiple languages
C#
5
star
37

styleguide

Style guides for wpilibsuite projects
Python
5
star
38

ni-libraries

Houses the NI Libraries for WPILib building
C++
5
star
39

sphinxext-toptranslators

Grabs top translation contributors from PO files
Python
4
star
40

WPILibInstaller

The WPILib Offline Installer
C#
4
star
41

ohnoyoudidnt

Sphinx linter for frc-docs
Python
4
star
42

raspbian-toolchain

Toolchain builder for raspbian
Shell
4
star
43

xcode-notarize

Xcode Notarize
JavaScript
4
star
44

java-installer

Creates and installs an embedded JRE on the RoboRIO
Java
4
star
45

roborio-toolchain

GCC cross-compiler toolchain for roboRIO
Shell
4
star
46

native-utils

Gradle utility plugin for compiling native libraries
Java
4
star
47

vendor-json-repo

WPILib Vendor JSON Repository (WIP)
Python
4
star
48

robotbuilder-2

TypeScript
3
star
49

dev-ops

WPILib Suite Dev-Ops Documentation
3
star
50

homebrew-wpilib

This repository contains a collection of Homebrew (aka, Brew) "formulae" for WPILib.
Ruby
3
star
51

nivision

Not supported in 2018
Java
3
star
52

node-wpilib-ws

WebSocket server for interfacing with non-FRC hardware
TypeScript
3
star
53

sphinxext-presentations

Sphinx extension to present documentation
TypeScript
2
star
54

wpilib-version-plugin

Gradle plugin for determing what repository to pull and push dependencies to, and what version a part should be
Java
2
star
55

supervisely

Python
2
star
56

zulu-jre-ipk

Azul Zulu JRE ipk package builder
Makefile
2
star
57

wpimath

Math library (includes units and Eigen)
C++
2
star
58

riolog

Standalone version of Eclipse riolog
Java
2
star
59

roboRIOVisionExamples

Roborio Vision Examples
Java
2
star
60

sphinxext-delta

Sphinx extension for previewing changed github articles
Python
2
star
61

thirdparty-googletest

googletest gradle build for maven packaging
2
star
62

build-tools

Tools used by the Jenkins instance
2
star
63

branding

Branding standards for WPILib
Python
2
star
64

thirdparty-apriltag

Third-party build of apriltag
2
star
65

gradle-cpp-vscode

Gradle Plugin for generating a JSON representation of model based native builds
Java
2
star
66

sfxlib

SFX dashboard data library
Java
1
star
67

sfx

SFX dashboard UI
Ruby
1
star
68

sfxmeta

SFX dashboard annotations
Java
1
star
69

CANJaguar

Libraries for CANJaguar - Removed for the 2018 season
C++
1
star
70

frc-openjfx-windows

1
star
71

apple-signing-test

C++
1
star
72

desktop-common

Common library for WPILib JavaFX desktop applications
Java
1
star
73

wpilib-ws-robot

Base library for a WPILib WebSocket robot (Client/Server implementations)
TypeScript
1
star
74

sfx-livewindow

SFX LiveWindow plugin
Java
1
star
75

sphinxext-linkcheckdiff

Sphinx extension to run diff-only linkchecks.
Python
1
star
76

roborio-ant-tasks

Ant tasks for roboRIO
Java
1
star
77

frc-openjdk-roborio

OpenJDK builds for FRC RoboRIO
Shell
1
star
78

doxygen-mirror

Shell
1
star
79

StandaloneAppSamples

App Samples for running apps standalone
Java
1
star
80

wpilib-repositories-plugin

Gradle plugin for easy configuration of the wpilib repository scheme
Groovy
1
star
81

thirdparty-fonts

Fonts for imgui applications
Shell
1
star
82

deploy-utils

About Additions to the model-based DSL for deploying Java and Native projects to remote targets
Java
1
star