Skip to content

Commit

Permalink
Update to WPILib 2025.1.1-beta-1 (#103)
Browse files Browse the repository at this point in the history
* Update to WPILib 2025.1.1-beta-1

* Fix methods using `WPI_String`

* Fix Java 17 build

* Attempt to fix Windows

* Update vendordep year

* Fix segfault

* Add logging for comms disable count
  • Loading branch information
jwbonner authored Oct 16, 2024
1 parent 445fb09 commit 252cbe1
Show file tree
Hide file tree
Showing 16 changed files with 273 additions and 206 deletions.
7 changes: 5 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ try-import %workspace%/user.bazelrc

build --enable_platform_specific_config
build --enable_runfiles
build --java_language_version=11
build --java_language_version=17
build --java_runtime_version=17
build --tool_java_language_version=17
build --tool_java_runtime_version=17
build --spawn_strategy=local # This disables sandboxing, which is a stopgap instead of using SandboxFS (we'd like to do this eventually, WPILib toolchain doesn't like the symlink tree)
build --incompatible_enable_cc_toolchain_resolution # Enables the new toolchain identification feature which uses platforms to find the right cc toolchain

Expand All @@ -17,6 +20,6 @@ build:athena --cxxopt=-std=c++20 --cxxopt=-pedantic-errors
build:athena --platform_suffix=_athena
build:linux --cxxopt=-std=c++20 --cxxopt=-pedantic-errors
build:macos --cxxopt=-std=c++20 --cxxopt=-pedantic-errors
build:windows --cxxopt=/std:c++20
build:windows --cxxopt=/std:c++20 --cxxopt=/utf-8

test --test_output=all # Show stdout for any tests that do not pass
22 changes: 11 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "11"
java-version: "17"
- name: "Build all"
run: bazelisk build --config=athena --verbose_failures ...
- name: "Release: Get version number"
Expand Down Expand Up @@ -149,9 +149,9 @@ jobs:
- name: 'Release: Upload "junction/shims/wpilib" to GitHub'
if: github.event_name == 'release'
run: bazelisk run --define "maven_repo=https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit" --define "maven_user=Mechanical-Advantage" --define "maven_password=${{ secrets.GITHUB_TOKEN }}" --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //junction/shims/wpilib:wpilib-export.publish

# Upload local repo
- name: 'Release: Upload local repo'
- name: "Release: Upload local repo"
uses: actions/upload-artifact@v3
if: github.event_name == 'release'
with:
Expand All @@ -163,25 +163,25 @@ jobs:
matrix:
host:
- {
os: macos-12,
displayName: "macOS",
os: macos-12,
displayName: "macOS",
classifier: "osxuniversal",
mavenLocal: "file://$HOME/maven_offline",
mavenLocalUpload: "~/maven_offline"
mavenLocalUpload: "~/maven_offline",
}
- {
os: ubuntu-22.04,
displayName: "Linux",
classifier: "linuxx86-64",
mavenLocal: "file://$HOME/maven_offline",
mavenLocalUpload: "~/maven_offline"
mavenLocalUpload: "~/maven_offline",
}
- {
os: windows-2019,
displayName: "Windows",
classifier: "windowsx86-64",
mavenLocal: "file://%userprofile%\\maven_offline",
mavenLocalUpload: "%userprofile%/maven_offline"
mavenLocalUpload: "%userprofile%/maven_offline",
}

name: Build for ${{ matrix.host.displayName }}
Expand All @@ -195,7 +195,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "11"
java-version: "17"
- name: "Build all"
run: bazelisk build --verbose_failures ...
- name: "Test all"
Expand Down Expand Up @@ -229,7 +229,7 @@ jobs:
run: python3 build_tools/repo/publish_zip.py --url https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit --group_id org.littletonrobotics.akit.conduit --artifact_id conduit-wpilibio --version ${{ steps.get_version.outputs.version-without-v }} --classifier ${{ matrix.host.classifier }} --file_path bazel-bin/conduit/wpilibio/wpilibio-${{ steps.get_version.outputs.version-without-v }}-${{ matrix.host.classifier }}.zip --username Mechanical-Advantage --access_token ${{ secrets.GITHUB_TOKEN }}

# Upload local repo
- name: 'Release: Upload local repo'
- name: "Release: Upload local repo"
uses: actions/upload-artifact@v3
if: github.event_name == 'release'
with:
Expand Down Expand Up @@ -283,4 +283,4 @@ jobs:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: maven_offline.zip
asset_name: maven_offline.zip
asset_content_type: application/zip
asset_content_type: application/zip
2 changes: 1 addition & 1 deletion build_tools/repo/vendordep/vendordep_top.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "{name}",
"version": "{version}",
"uuid": "{uuid}",
"frcYear": "2024",
"frcYear": "2025",
"mavenUrls": [],
"jsonUrl": "https://github.com/Mechanical-Advantage/AdvantageKit/releases/latest/download/AdvantageKit.json",
"javaDependencies": [{javaDependencies} ],
Expand Down
4 changes: 4 additions & 0 deletions conduit/api/src/org/littletonrobotics/conduit/ConduitApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ public boolean getBrownedOut() {
return sys.brownedOut() != 0;
}

public int getCommsDisableCount() {
return sys.commsDisableCount();
}

public boolean getRSLState() {
return sys.rslState() != 0;
}
Expand Down
1 change: 1 addition & 0 deletions conduit/conduit_schema.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct SystemData {
fpga_button:int32;
system_active:int32;
browned_out:int32;
comms_disable_count:int32;
rsl_state:int32;
system_time_valid:int32;
voltage_vin:float64;
Expand Down
28 changes: 15 additions & 13 deletions conduit/wpilibio/src/system_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,25 @@ void SystemReader::read(schema::SystemData* system_buf) {
system_buf->mutate_fpga_version(HAL_GetFPGAVersion(&status));
system_buf->mutate_fpga_revision(HAL_GetFPGARevision(&status));

char serialNum[9];
size_t serialNumLen = HAL_GetSerialNumber(serialNum, sizeof(serialNum));
system_buf->mutate_serial_number_size(serialNumLen);
std::memcpy(system_buf->mutable_serial_number()->Data(), serialNum,
system_buf->serial_number()->size());

char comments[65];
size_t commentsLen = HAL_GetComments(comments, sizeof(comments));
system_buf->mutate_comments_size(commentsLen);
std::memcpy(system_buf->mutable_comments()->Data(), comments,
system_buf->comments()->size());
WPI_String serialNum;
HAL_GetSerialNumber(&serialNum);
system_buf->mutate_serial_number_size(serialNum.len);
std::memcpy(system_buf->mutable_serial_number()->Data(), serialNum.str,
serialNum.len);

WPI_String comments;
HAL_GetComments(&comments);
system_buf->mutate_comments_size(comments.len);
std::memcpy(system_buf->mutable_comments()->Data(), comments.str,
comments.len);

system_buf->mutate_team_number(HAL_GetTeamNumber());
}

system_buf->mutate_fpga_button(HAL_GetFPGAButton(&status));
system_buf->mutate_system_active(HAL_GetSystemActive(&status));
system_buf->mutate_browned_out(HAL_GetBrownedOut(&status));
system_buf->mutate_comms_disable_count(HAL_GetCommsDisableCount(&status));
system_buf->mutate_rsl_state(HAL_GetRSLState(&status));
if (cycleCount % 50 == 0) {
// This read takes longer
Expand Down Expand Up @@ -91,8 +92,9 @@ void SystemReader::read(schema::SystemData* system_buf) {
uint32_t tx_full_count = 0;
uint32_t receive_error_count = 0;
uint32_t transmit_error_count = 0;
HAL_CAN_GetCANStatus(&percent_bus_utilization, &bus_off_count, &tx_full_count,
&receive_error_count, &transmit_error_count, &status);
HAL_CAN_GetCANStatus(&percent_bus_utilization, &bus_off_count,
&tx_full_count, &receive_error_count,
&transmit_error_count, &status);

system_buf->mutable_can_status().mutate_percent_bus_utilization(
percent_bus_utilization);
Expand Down
Loading

0 comments on commit 252cbe1

Please sign in to comment.