V2024.01 WPILib LabVIEW Math - Control and Trajectory Library
Description
This is a LabVIEW port of the math section of WPILib for the First FRC Robot Competition. This library implements almost all of the C++/Java WPILIB math library for LabVIEW users. This is a native port. The library includes some additional enhancements including digital sequential logic functions, PID autotune, and Simple Motor Feedforward Ka tuning helper. The library also includes a number of utility programs - robot simulators, and trajectory creation utilities.
Some documentation still needs to be finalized. There will updates during the season to address this. If there are questions, please ask via the github issues or via chiefdelphi.
Installation
IMPORTANT If version 2.x of this library are currently installed, open NI Package Manager and remove them before installing this new package. This is needed because of the package name change.
To install:
- Download the "wpilibmathlv23*.nipkg" install file (The * is replaced with the library version number.)
- Double click the "wpilibmathlv23*.nipkg" file. (Administrator permissions are required to install) Previous versions will be upgraded.
Optionally to install the function examples (highly suggested):
- Download the "wpilibmathexamples*.zip" file (The * is replaced with the library version number.)
- Create an empty directory for the examples.
- Unzip the files to this empty directory.
- Alternatively, to install these so that they can be found by LabVIEW "Find examples", unzip the files to: "C:\Program Files (x86)\National Instruments\LabVIEW 2023\Examples\FRC\roboRIO\Math - Control and Trajectory". If your operating system doesn't live on C:, then the drive letter might be different.
Removal
To uninstall:
- Open NI Package Manager. Select the package(s), then select uninstall.
What's New and Changed Since 2024.0
-
Fixed April Tag 12 orientation.
-
Added IZONE to PID controllers. Also changed PID controllers to store total integral instead of total error. This allows online tuning to be done without causing a step change because of a change to Ki.
-
Fixed a few documentation issues.
What's New Since 3.07
-
Added digital sequential logic functions - Edge On, Edge Off, Edge Change
-
Added Boolean Command functions. This provides a simple communications mechanism between parallel loops, such as teleop and periodic tasks. This can be used instead of using global variables or functional globals.
-
Added Numeric Command functions. This provides a simple communications mechanism between parallel loops, such as teleop and periodic tasks. This can be used instead of using global variables or functional globals.
-
Added Drum Sequencer. This function greatly simplifies the creation of state machines that have a simple progression through states. It manages all the timing between steps, allowing the user to concentrate on the function being performed. As the name implies it provides the functionality of a mechanical drum sequencer.
-
Added Double Solenoid Pulse. This helper function provides momentary pulsing for latching double solenoids so that the coils do not need to remain continuously energized.
-
Added Auto Helper functions. These provide a simple mechanism to create a sequence of actions, with built in timeout, during autonomous mode.
-
Added Position Control functions. These provide the position control described in FRC Secret Book of LabVIEW. This is similar to a proportional PID, with a error deadband and a minimum control output.
-
Changes to Holonomic controller to allow it to be "initialized" when starting to follow a new trajectory. Also a rotational velocity feedforward has been added.
-
Added examples for all new functions. Added and updated many other examples. This includes a simulated swerve robot that includes absolute and relative odometry, pose estimation, and trajectory following. Currently there are issues with the examples install NI package, therefore the examples are distributed via a ZIP file.
Complete Change Log
Full Changelog: V2024.00...V2024.01
Previous recent change logs:
V3.07...V2024.00
V3.06...V3.07
V3.05...V3.06
V3.04...V3.05
V3.03...V3.04
V3.02...V3.03
V3.01...V3.02
V2.12...V3.01
V2.12A...V2.12B
V2.12...V2.12A
V2.10...V2.12
Notes for users upgrading from version 2.x
If you use any of the 2d geometry routines directly from previous versions of the library before they were renamed with the 2d suffix, they will cause an issue the first time your project is opened. If this happens "browse" to "c:\program files (x86)\nationalinstruments\labview2020\vi.lib\rock robotics\third party\jasjunk\trajlib" (I may have the name not exactly correct) and find the routine with 2d in the name. For example pose_interpolate becomes pose2d_interpolate.
Known Bugs
- If the create trajectory utility version 2.03 was used, the new utility might not read the config XML file. (Prior and later versions should be okay.) The format of the file was changed slighted. If this problem is encountered, the XML file can be edited (with Notepad) and changed as follows:
Change this:
<Boolean>
<Name>UseWeights</Name>
<Val>0</Val>
</Boolean>
to:
<Boolean>
<Name>UseWeights</Name>
<Val>0</Val>
</Boolean>
<String>
<Name>FieldName</Name>
<Val>2020 Infinite Recharge</Val>
</String>
Other Notes
The source code for the utility programs are not included in this repository. There is a separate containing the utilities, samples, and test programs. That repository can be found here: https://github.com/jsimpso81/WPIlibMathLabVIEW_Examples
Please report issues using github. I'll try to handle them in a timely manner (no promises however). Suggestions, and enhancements are always welcome.