第三方库

Teams that are using non-PWM motor controllers or advanced sensors will most likely need to install external vendor dependencies.

What Are Vendor Dependencies?

A vendor dependency is a way for vendors such as CTRE, REV, and others to add their software library to robot projects. This library can interface with motor controllers and other devices. This way, teams can interact with their devices via CAN and have access to more complex and in-depth features than traditional PWM control.

Managing Vendor Dependencies

Vendor dependencies are installed on a per-project basis (so each robot project can have its own set of vendor dependencies). Vendor dependencies can be installed “online” or “offline”. The “online” functionality is done by downloading the dependencies over the internet, while offline is typically provided by a vendor-specific installer.

警告

If installing a vendor dependency via the “online” mode, make sure to reconnect the computer to the internet and rebuild about every 30 days otherwise the cache will clear, completely deleting the downloaded library install.

备注

Vendors recommend using their offline installers when available, because the offline installer is typically bundled with additional programs that are extremely useful when working with their devices.

How Does It Work?

How Does It Work? - Java/C++

For Java and C++, a JSON file describing the vendor library is installed on your system to ~/wpilib/YYYY/vendordeps (where YYYY is the year and ~ is C:\Users\Public on Windows). This can either be done by an offline installer or the file can be fetched from an online location using the menu item in Visual Studio Code. This file is then used from VS Code to add to the library to each individual project. Vendor library information is managed on a per-project basis to make sure that a project is always pointing to a consistent version of a given vendor library. The libraries themselves are placed in the Maven cache at C:\Users\Public\wpilib\YYYY\maven. Vendors can place a local copy here with an offline installer (recommended) or require users to be connected to the internet for an initial build to fetch the library from a remote Maven location.

This JSON file allows specification of complex libraries with multiple components (Java, C++, JNI, etc.) and also helps handle some complexities related to simulation. Vendors that choose to provide a remote URL in the JSON also enable users to check for updates from within VS Code.

How Does It Work? - LabVIEW

For LabVIEW teams, there might be a few new Third Party items on various palettes (specifically, one in Actuators, one in Actuators -> Motor Control labeled CAN Motor, and one in Sensors). These correspond to folders in C:\Program Files\National Instruments\LabVIEW 2023\vi.lib\Rock Robotics\WPI\Third Party

In order to install third party libraries for LabVIEW, download the VIs from the vendor (typically via some sort of installer). Then drag and drop the third party VIs into the respective folder mentioned above just like any other VI.

How Does It Work? - Python

Third party libraries are packaged into Python wheels and uploaded to PyPI (if pure python) and/or WPILib’s artifactory. Users can enable them as dependencies either by adding the component name to robotpy_extras (recommended) or by adding an explicit dependency for the PyPI package in requires. The dependencies are downloaded when robotpy sync is executed, and installed on the roboRIO when robotpy deploy is executed.

Installing Libraries

VS Code

Using the Manage Vendor Libraries option of the WPILib Command Palette.

要添加由脱机安装程序安装的供应商库,请按Ctrl + Shift + P并输入WPILib/单击右上角的WPILib图标,以打开WPILib命令面板。然后,输入“Manage Vendor Libraries”,然后从下拉菜单中选择它。 选择“Install new libraries (offline)”的选项。

Select the libraries to add.

选中每个库旁边的框,选择 要添加到项目中的所需库,然后单击“确定”。 这样,JSON文件将被复制到项目中的vendordeps文件夹中,并将库添加为项目的依赖项。

In order to install a vendor library in online mode, press Ctrl+Shift+P and type WPILib or click on the WPILib icon in the top right to open the WPILib Command Palette and begin typing Manage Vendor Libraries and select it in the menu, and then click on Install new libraries (online) instead and copy + paste the vendor JSON URL.

Checking for Updates (Offline)

Since dependencies are version managed on a per-project basis, even when installed offline, you will need to Manage Vendor Libraries and select Check for updates (offline) for each project you wish to update.

Checking for Updates (Online)

供应商可以选择填充一部分JSON文件为在线更新。如果库指定了适当的位置,则运行“Check for updates (online)”可检查远程位置是否有可用的较新版本的库。

Removing a Library Dependency

要从项目中删除库依赖性,请从“Manage Vendor Libraries”菜单中选择“Manage Current Libraries”,选中要卸载的任何库的复选框,然后单击“确定”。这些库将从项目中删除。

Command-Line

还可以通过gradle任务通过命令行从供应商URL添加供应商库依赖项。在项目根目录下打开一个命令行,然后输入“gradlew vendordep –url = <url>”,其中<url>是供应商JSON URL。这会将供应商库依赖项JSON文件添加到项目的vendordeps文件夹中。供应商库可以用相同的方式更新。

The vendordep gradle task can also fetch vendordep JSONs from the user wpilib folder. To do so, pass FRCLOCAL/Filename.json as the file URL. For example, gradlew vendordep --url=FRCLOCAL/WPILibNewCommands.json will fetch the JSON for the command-based framework.

All RobotPy project dependencies are specified in pyproject.toml. You can add additional vendor-specific dependencies either by:

  • Adding the component name to robotpy_extras

  • Adding the PyPI package name to requires

WPILib Libraries

Command Library

The WPILib command library has been split into a vendor library. It is installed by the WPILib installer for offline installation.

  • PyPI package: robotpy[commands2] or robotpy-commands-v2

  • In pyproject.toml: robotpy_extras = ["commands2"]

Romi Library

A Romi Library has been created to contain several helper classes that are used in the RomiReference example.

  • PyPI package: robotpy[romi] or robotpy-romi

  • In pyproject.toml: robotpy_extras = ["romi"]

XRP Library

An XRP Library has been created to contain several helper classes that are used in the XRPReference example.

  • PyPI package: robotpy[xrp] or robotpy-xrp

  • In pyproject.toml: robotpy_extras = ["xrp"]

Vendor Libraries

Click these links to visit the vendor site to see whether they offer online installers, offline installers, or both. URLs below are to plug in to the VS Code -> Install New Libraries (online) feature.

CTRE Phoenix Framework - Contains CANcoder, CANifier, CANdle, Pigeon IMU, Pigeon 2.0, Talon FX, Talon SRX, and Victor SPX Libraries and Phoenix Tuner program for configuring CTRE CAN devices

Phoenix (v6): https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-frc2024-latest.json

Phoenix (v5): https://maven.ctr-electronics.com/release/com/ctre/phoenix/Phoenix5-frc2024-latest.json

备注

All users should use the Phoenix (v6) library. If you also need Phoenix v5 support, additionally install the v5 vendor library.

Vendor’s package:

  • PyPI package: robotpy[phoenix6] or phoenix6

  • In pyproject.toml: robotpy_extras = ["phoenix6"]

Community packages:

  • PyPI package: robotpy[phoenix5] or robotpy-ctre

  • In pyproject.toml: robotpy_extras = ["phoenix5"]

Redux Robotics ReduxLib - Library for all Redux devices including the Canandcoder and Canandcolor

https://frcsdk.reduxrobotics.com/ReduxLib_2024.json

Not yet available

Playing With Fusion Driver - 包括 Venom motor/controller在内的所有PWF设备的库

https://www.playingwithfusion.com/frc/playingwithfusion2024.json

Community-supported packages:

  • PyPI package: robotpy[playingwithfusion] or robotpy-playingwithfusion

  • In pyproject.toml: robotpy_extras = ["playingwithfusion"]

Kauai Labs - NavX-MXP, NavX-Micro, 与Sensor Fusion的库

https://dev.studica.com/releases/2024/NavX.json

Community-supported packages:

  • PyPI package: robotpy[navx] or robotpy-navx

  • In pyproject.toml: robotpy_extras = ["navx"]

REV Robotics REVLib - Library for all REV devices including SPARK Flex, SPARK MAX, and Color Sensor V3

https://software-metadata.revrobotics.com/REVLib-2024.json

Community-supported packages:

  • PyPI package: robotpy[rev] or robotpy-rev

  • In pyproject.toml: robotpy_extras = ["rev"]

社区库

PhotonVision-PhotonVision CV软件库

https://maven.photonvision.org/repository/internal/org/photonvision/photonlib-json/1.0/photonlib-json-1.0.json

  • PyPI package: photonlibpy

  • In pyproject.toml: requires = ["photonlibpy"]

PathPlanner - Library for PathPlanner

https://3015rangerrobotics.github.io/pathplannerlib/PathplannerLib.json

  • PyPI package: pathplannerlib

  • In pyproject.toml: requires = ["pathplannerlib"]

ChoreoLib - Library for reading and following trajectories generated by Choreo

https://sleipnirgroup.github.io/ChoreoLib/dep/ChoreoLib.json

Not available

YAGSL - Library for Swerve Drives of any configuration

https://broncbotz3481.github.io/YAGSL-Lib/yagsl/yagsl.json

Not available