Librairies tierces
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 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.
Avertissement
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.
Note
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.
Installing Libraries
VS Code
All vendordep operations can be controlled by the Dependency Manager. Click the WPILib logo in the activity bar as shown above to access the interface.
Select the desired libraries to add to the project by clicking the Install button next to each. The JSON file will be copied to the vendordeps
folder in the project, adding the library as a dependency to the project.
When an update is available for an installed vendordep you will see the To Latest button become available. To update you can either press that or the Update All to move all vendordeps to the latest version.
The button with the trash icon will uninstall the vendordep. The dropdown shows what version is currently installed but you can change that to a different version to update or downgrade to the specified version.
Note
The Dependency Manager will automatically build your program when it loses focus. This allows you to use the changed dependencies.
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
Voir aussi
VS Code
Pour ajouter une librairie d’un fournisseur qui a été installée par un installateur hors ligne, appuyez sur Ctrl+Shift+P et tapez WPILib ou cliquez sur l’icône WPILib en haut à droite pour ouvrir la palette de commande WPILib et commencer à taper Manage Vendor Libraries, puis sélectionnez-la dans le menu. Sélectionnez l’option Install new libraries (offline).
Sélectionnez les librairies que l’on souhaite ajouter au projet en cochant la case à côté de chacune, puis cliquez sur OK. Le fichier JSON sera copié dans le dossier vendordeps
dans le projet, ajoutant la librairie comme une dépendance au projet.
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)
Une partie du fichier JSON que les fournisseurs peuvent optionnellement remplir est un emplacement de mise à jour en ligne. Si une librairie a un emplacement approprié spécifié, l’exécution de Check for updates (online) vérifiera si une nouvelle version de la librairie est disponible à partir de l’emplacement distant.
Removing a Library Dependency
Pour supprimer une dépendance d’un projet à une librairie, sélectionnez Manage Current Libraries du menu Manage Vendor Libraries, cochez les cases correspondant à toutes les librairies à désinstaller et cliquer sur OK. Ces librairies seront supprimées en tant que dépendances du projet.
L’ajout d’une dépendance d’une librairie tierce à partir de l’URL du fournisseur peut également se faire à travers la ligne de commande via une tâche gradle. Ouvrez une instance de ligne de commande à la racine du projet, puis entrez gradlew vendordep --url=<url>
où <url>
est l’URL JSON du fournisseur. Cette ajoutera le fichier JSON de dépendance de la librairie des fournisseurs au dossier vendordeps
du projet. Les librairies des fournisseurs peuvent être mises à jour de la même façon.
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.
How Does It Work?
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 is often done by an offline installer, but may need to be done manually if a .zip
of the .json
files is provided. 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.
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.
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.