diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76d4170..30edf6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: git config --global --add safe.directory /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }} - name: Build with Gradle run: ./gradlew build --max-workers 1 ${{ matrix.build-options }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact-name }} path: build/allOutputs @@ -60,7 +60,7 @@ jobs: architecture: ${{ matrix.architecture }} - name: Build with Gradle run: ./gradlew build -Pbuildalldesktop - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact-name }} path: build/allOutputs @@ -73,7 +73,7 @@ jobs: - uses: actions/checkout@v4 with: repository: wpilibsuite/build-tools - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: path: combiner/products/build/allOutputs - name: Flatten Artifacts @@ -85,7 +85,7 @@ jobs: - name: Combine run: ./gradlew publish -Pthirdparty working-directory: combiner - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: Maven path: ~/releases/maven/development/ diff --git a/README.md b/README.md index 1ac5576..9fac40d 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,9 @@ By default, this project builds against the latest WPILib development build. To ## Data Format -### Revision 2 +### Revision 2/3 + +Revision 2 = 2024, Revision 3 = 2025 (no model frames) - "Raw/Persistent" - Buffer Length, Not Published (uint32) diff --git a/URCL.json b/URCL.json index cd66abf..f1e84ee 100644 --- a/URCL.json +++ b/URCL.json @@ -1,25 +1,25 @@ { "fileName": "URCL.json", "name": "URCL", - "version": "2024.1.0", - "frcYear": "2024", + "version": "2025.0.0-beta-1", + "frcYear": "2025", "uuid": "84246d17-a797-4d1e-bd9f-c59cd8d2477c", "mavenUrls": [ - "https://raw.githubusercontent.com/Mechanical-Advantage/URCL/2024.1.0" + "https://raw.githubusercontent.com/Mechanical-Advantage/URCL/2025.0.0-beta-1" ], "jsonUrl": "https://raw.githubusercontent.com/Mechanical-Advantage/URCL/maven/URCL.json", "javaDependencies": [ { "groupId": "org.littletonrobotics.urcl", "artifactId": "URCL-java", - "version": "2024.1.0" + "version": "2025.0.0-beta-1" } ], "jniDependencies": [ { "groupId": "org.littletonrobotics.urcl", "artifactId": "URCL-driver", - "version": "2024.1.0", + "version": "2025.0.0-beta-1", "skipInvalidPlatforms": true, "isJar": false, "validPlatforms": [ @@ -34,7 +34,7 @@ { "groupId": "org.littletonrobotics.urcl", "artifactId": "URCL-cpp", - "version": "2024.1.0", + "version": "2025.0.0-beta-1", "libName": "URCL", "headerClassifier": "headers", "sharedLibrary": false, @@ -49,7 +49,7 @@ { "groupId": "org.littletonrobotics.urcl", "artifactId": "URCL-driver", - "version": "2024.1.0", + "version": "2025.0.0-beta-1", "libName": "URCLDriver", "headerClassifier": "headers", "sharedLibrary": false, @@ -62,4 +62,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 48ff2ad..bad8909 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ plugins { id 'cpp' id 'java' id 'edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin' version '2020.2' - id 'edu.wpi.first.NativeUtils' version '2024.6.1' + id 'edu.wpi.first.NativeUtils' version '2025.3.0' id 'edu.wpi.first.GradleJni' version '1.1.0' id 'edu.wpi.first.GradleVsCode' version '2.1.0' } @@ -33,7 +33,6 @@ dependencies { implementation "com.fasterxml.jackson.core:jackson-annotations:2.12.4" implementation "com.fasterxml.jackson.core:jackson-core:2.12.4" implementation "com.fasterxml.jackson.core:jackson-databind:2.12.4" - // implementation 'edu.wpi.first.thirdparty.frc2024.opencv:opencv-java:4.8.0-2' } // Set up exports properly @@ -98,5 +97,5 @@ model { apply from: 'publish.gradle' wrapper { - gradleVersion '8.4' + gradleVersion '8.10.2' } diff --git a/config.gradle b/config.gradle index c9933e6..fb2a7c5 100644 --- a/config.gradle +++ b/config.gradle @@ -8,10 +8,8 @@ nativeUtils { configureDependencies { wpiVersion = "2025.+" opencvYear = "frc2024" - googleTestYear = "frc2024" niLibVersion = "2025.0.0" - opencvVersion = "4.8.0-2" - googleTestVersion = "1.14.0-1" + opencvVersion = "4.8.0-4" } } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135..a4b76b9 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3fa8f86..df97d72 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a4..f5feea6 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 6689b85..9b42019 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/publish.gradle b/publish.gradle index c223312..4eb571b 100644 --- a/publish.gradle +++ b/publish.gradle @@ -2,7 +2,7 @@ apply plugin: 'maven-publish' ext.licenseFile = files("$rootDir/LICENSE.txt") -def pubVersion = '2024.1.0' +def pubVersion = '2025.0.0-beta-1' def outputsFolder = file("$buildDir/outputs") diff --git a/src/main/driver/cpp/URCLDriver.cpp b/src/main/driver/cpp/URCLDriver.cpp index 4f69351..e7ea12b 100644 --- a/src/main/driver/cpp/URCLDriver.cpp +++ b/src/main/driver/cpp/URCLDriver.cpp @@ -21,20 +21,16 @@ extern "C" { constexpr HAL_CANManufacturer manufacturer = HAL_CAN_Man_kREV; constexpr HAL_CANDeviceType deviceType = HAL_CAN_Dev_kMotorController; -constexpr int firmwareApi = 0x98; +constexpr int firmwareApiClass = 9; +constexpr int firmwareApiIndex = 8; +constexpr int firmwareApi = + (firmwareApiClass & 0x3f) << 4 | (firmwareApiIndex & 0xf); constexpr int firmwareMessageId = ((deviceType & 0x1f) << 24) | ((manufacturer & 0xff) << 16) | ((firmwareApi & 0x3ff) << 6); constexpr int firmwareMessageIdMask = 0x1fffffc0; -constexpr int modelApi = - 0x300 | 155; // Parameter Access | Parameter Number (Device Model) -constexpr int modelMessageId = ((deviceType & 0x1f) << 24) | - ((manufacturer & 0xff) << 16) | - ((modelApi & 0x3ff) << 6); -constexpr int modelMessageIdMask = 0x1fffffc0; - -constexpr int periodicApiClass = 6; // Periodic Status +constexpr int periodicApiClass = 46; constexpr int periodicMessageId = ((deviceType & 0x1f) << 24) | ((manufacturer & 0xff) << 16) | ((periodicApiClass & 0x3f) << 10); @@ -46,14 +42,12 @@ char *periodicBuffer; int32_t halStatus; uint32_t timeOffsetMillis; uint32_t firmwareStreamHandle; -uint32_t modelStreamHandle; uint32_t periodicStreamHandle; uint32_t persistentMessageCount = 0; uint32_t readCount = 0; uint64_t devicesFound = 0; uint64_t devicesFirmwareReceived = 0; -uint64_t devicesModelReceived = 0; uint64_t devicesCANReady = 0; HAL_CANHandle devicesCANHandles[64]; @@ -68,9 +62,6 @@ void URCLDriver_start(void) { HAL_CAN_OpenStreamSession(&firmwareStreamHandle, firmwareMessageId, firmwareMessageIdMask, maxPersistentMessages, &halStatus); - HAL_CAN_OpenStreamSession(&modelStreamHandle, modelMessageId, - modelMessageIdMask, maxPersistentMessages, - &halStatus); HAL_CAN_OpenStreamSession(&periodicStreamHandle, periodicMessageId, periodicMessageIdMask, maxPeriodicMessages, &halStatus); @@ -132,12 +123,9 @@ void URCLDriver_read(void) { if (readCount >= 20) { readCount = 0; uint64_t unknownFirmwareDevices = devicesFound & ~devicesFirmwareReceived; - uint64_t unknownModelDevices = devicesFound & ~devicesModelReceived; for (uint8_t i = 0; i < 64; i++) { bool unknownFirmware = (unknownFirmwareDevices >> i) & 1; - bool unknownModel = (unknownModelDevices >> i) & 1; - if ((unknownFirmware || unknownModel) && - ((devicesCANReady >> i) & 1) == 0) { + if (unknownFirmware && ((devicesCANReady >> i) & 1) == 0) { devicesCANHandles[i] = HAL_InitializeCAN(manufacturer, i, deviceType, &halStatus); devicesCANReady |= (uint64_t)1 << i; @@ -145,9 +133,6 @@ void URCLDriver_read(void) { if (unknownFirmware) { HAL_WriteCANRTRFrame(devicesCANHandles[i], 0, firmwareApi, &halStatus); } - if (unknownModel) { - HAL_WriteCANRTRFrame(devicesCANHandles[i], 0, modelApi, &halStatus); - } } } @@ -165,16 +150,6 @@ void URCLDriver_read(void) { devicesFirmwareReceived |= (uint64_t)1 << deviceId; } - // Read model messages - HAL_CAN_ReadStreamSession(modelStreamHandle, messages, maxPersistentMessages, - &messageCount, &halStatus); - for (uint32_t i = 0; i < messageCount; i++) { - writeMessagePersistent(messages[i]); - uint8_t deviceId = messages[i].messageID & 0x3f; - devicesFound |= (uint64_t)1 << deviceId; - devicesModelReceived |= (uint64_t)1 << deviceId; - } - // Read periodic messages HAL_CAN_ReadStreamSession(periodicStreamHandle, messages, maxPeriodicMessages, &messageCount, &halStatus); diff --git a/src/main/java/org/littletonrobotics/urcl/URCL.java b/src/main/java/org/littletonrobotics/urcl/URCL.java index b90e562..4dab61b 100644 --- a/src/main/java/org/littletonrobotics/urcl/URCL.java +++ b/src/main/java/org/littletonrobotics/urcl/URCL.java @@ -94,13 +94,13 @@ public static void start(Map aliases) { // Start publishers persistentPublisher = NetworkTableInstance.getDefault() .getRawTopic("/URCL/Raw/Persistent") - .publish("URCLr2_persistent"); + .publish("URCLr3_persistent"); periodicPublisher = NetworkTableInstance.getDefault() .getRawTopic("/URCL/Raw/Periodic") - .publish("URCLr2_periodic"); + .publish("URCLr3_periodic"); aliasesPublisher = NetworkTableInstance.getDefault() .getRawTopic("/URCL/Raw/Aliases") - .publish("URCLr2_aliases"); + .publish("URCLr3_aliases"); notifier = new Notifier(() -> { var data = getData(); persistentPublisher.set(data[0]); @@ -137,9 +137,9 @@ public static void start(Map aliases, DataLog log) { periodicBuffer.order(ByteOrder.LITTLE_ENDIAN); persistentLogEntry = new RawLogEntry(log, "URCL/Raw/Persistent", "", - "URCLr2_persistent"); - periodicLogEntry = new RawLogEntry(log, "/URCL/Raw/Periodic", "", "URCLr2_periodic"); - aliasLogEntry = new RawLogEntry(log, "/URCL/Raw/Aliases", "", "URCLr2_aliases"); + "URCLr3_persistent"); + periodicLogEntry = new RawLogEntry(log, "/URCL/Raw/Periodic", "", "URCLr3_periodic"); + aliasLogEntry = new RawLogEntry(log, "/URCL/Raw/Aliases", "", "URCLr3_aliases"); notifier = new Notifier(() -> { var data = getData(); persistentLogEntry.update(data[0]); diff --git a/src/main/native/cpp/URCL.cpp b/src/main/native/cpp/URCL.cpp index fb3e599..4779dad 100644 --- a/src/main/native/cpp/URCL.cpp +++ b/src/main/native/cpp/URCL.cpp @@ -79,13 +79,13 @@ void URCL::Start(std::map aliases) { // Start publishers persistentPublisher = nt::NetworkTableInstance::GetDefault() .GetRawTopic("/URCL/Raw/Persistent") - .Publish("URCLr2_persistent"); + .Publish("URCLr3_persistent"); periodicPublisher = nt::NetworkTableInstance::GetDefault() .GetRawTopic("/URCL/Raw/Periodic") - .Publish("URCLr2_periodic"); + .Publish("URCLr3_periodic"); aliasesPublisher = nt::NetworkTableInstance::GetDefault() .GetRawTopic("/URCL/Raw/Aliases") - .Publish("URCLr2_aliases"); + .Publish("URCLr3_aliases"); aliasesPublisher.Set(aliasesVector); @@ -134,11 +134,11 @@ void URCL::Start(std::map aliases, periodicBuffer = URCLDriver_getPeriodicBuffer(); persistentLogEntry = wpi::log::RawLogEntry{log, "/URCL/Raw/Persistent", "", - "URCLr2_persistent"}; + "URCLr3_persistent"}; periodicLogEntry = - wpi::log::RawLogEntry{log, "/URCL/Raw/Periodic", "", "URCLr2_periodic"}; + wpi::log::RawLogEntry{log, "/URCL/Raw/Periodic", "", "URCLr3_periodic"}; aliasesLogEntry = - wpi::log::RawLogEntry{log, "/URCL/Raw/Aliases", "", "URCLr2_aliases"}; + wpi::log::RawLogEntry{log, "/URCL/Raw/Aliases", "", "URCLr3_aliases"}; aliasesLogEntry.Append(aliasesVector);