This repository is for the CANBridge software that is run on non-roboRIO platforms.
When sending a frame with a given interval, the behavior when setting a new interval is as follows:
The first time a frame is scheduled with an interval, it will be sent at the next available time. The next instance of the same frame id will be sent after that interval, even if the interval has changed.
See the following pseudo-example:
sendMessage(frame, 5000)
delay(1000)
updateFrameData(frame)
sendMessage(frame, 1000)
delay(500)
updateFrameData(frame)
sendMessage(frame, 2000)
In this case, the first frame will be scheduled immediately, the second will be scheduled 5 seconds later, and after that, subsequent frames will be scheduled every 2 seconds. Note that any change to the data in the second call will not be sent, meaning the second call is essentially a no-op if a new call with different data is sent before the previous interval is up. Sending a frame with an interval of -1 will cancel the repeat, and not send the frame. Sending with an interval of 0 will schedule the new frame once, then stop repeating. Unlike with a positive interval, an interval of 0 guarantees that each new message will be sent.
- Git
- Gradle Build Tool
- Java JDK 11 or newer (we recommend Azul or Eclipse Temurin)
- A modern C++ compiler with C++20 support
Note
All of these, excluding Git, can be installed and configured with the WPILib Installer, which will include specific versions for building FRC robot code. Gradle needs a C++ compiler, which is included with WPILib's development environment.
Building is done using the Gradle wrapper, gradlew
. The Gradle wrapper is located in the root of the project, so Gradle commands must be run from there.
- Clone repository
- Open a terminal inside the newly cloned repository
./gradlew build
The output is placed at ~\releases\maven\release\com\revrobotics\usb\CANBridge-cpp\<version>\
.
Note
Before publishing a new version, run ./gradlew build
locally to run the tests. GitHub Actions cannot run the tests because they depend on having a USB CAN device connected (e.g. SPARK MAX motor controller).
- Bump the version number in
publish.gradle
andCANBridge.json
- Commit the version bump
- Create a new tag named
vX.X.X
at that commit - Push the tag to GitHub
- Wait for the draft release to be created (this is automatically done via GitHub Actions)
- Add release notes to the draft release
- Publish the draft release
Note
This branch is a work in progress, testing does show that it does work, however this still might be some issues. If you do run across those issues, please create an issue so we can diagnose.
The latest firmware version will work with Linux if the SocketCAN
and gs_usb
drivers are enabled. The following udev rule will work to enable this:
Create a new file named and located at: /etc/udev/rules.d/99-canbridge.rules
ACTION=="add", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a30e", RUN+="/sbin/modprobe gs_usb" RUN+="/bin/sh -c 'echo 0483 a30e > /sys/bus/usb/drivers/gs_usb/new_id'"
The SDK Changelog can be viewed with Changelog.md.