WPILib 2023.3.2 release

This is an update release of WPILib for the 2023 season. Notable fixes in this release:

  • Several major NetworkTables bugs
  • ADXRS450 Gyros in C++

Significant new features in this release:

  • SysId CTRE CANivore and Phoenix Pro support

Upgrading from earlier 2023 releases is easy: simply download and run the new installer and it will update your current installation. If you already have the 2023 WPILib vscode installed, it will detect it and you can simply click “next” for that installation step. After installation, vscode will prompt you when opening your robot project whether you want to upgrade it to this version. Note that using the installer is required to get the new version of desktop tools such as Shuffleboard.

The documentation for WPILib is located at https://docs.wpilib.org/ (if you have trouble accessing this location, FIRST Robotics Competition Control System — FIRST Robotics Competition documentation is an alternate location with the same content).

If you’re new to FRC, start with Getting Started.

WPILib is developed by a small team of volunteers and the FIRST community.

What’s Changed since 2023.3.1

  • [wpilib] Revert throw on nonexistent SimDevice name in SimDeviceSim by PeterJohnson
  • [cameraserver] Add GetInstance() to all functions by PeterJohnson
  • [ntcore] Handle excludeSelf on SetDefault by PeterJohnson
  • [ntcore] Output warning on property set on unpublished topic by PeterJohnson
  • [wpilib] ElevatorSim: Fix WouldHitLimit methods by hadley31
  • [wpimath] Fix DCMotor.getSpeed() by calcmogul
  • [sysid] Make Spark Max built-in encoder sampling and measurement period configurable by calcmogul
  • [sysid] Use “encoder port” instead of “built-in” for spark max built-in encoder by calcmogul

What’s Changed since 2023.2.1

WPILib

  • Load joystick values upon code initialization by ThadHouse
  • AprilTagFieldLayout: Improve API shape for loading builtin JSONs by brennenputh
  • Fix C++ ADXRS450 and Java SPI gyro defs by ThadHouse
  • Properly use control word that is in sync with DS data by ThadHouse
  • Add Timer::Restart() by srimanachanta

NetworkTables

  • Write empty persistent file if none found by PeterJohnson
  • Handle topicsonly followed by value subscribe by PeterJohnson
  • Special-case default timestamps by PeterJohnson
  • Use full handle when subscribing by PeterJohnson
  • Add client disconnect function by PeterJohnson
  • Don’t leak buffers in rare WS shutdown case by PeterJohnson
  • Change wire timeout to fixed 1 second by PeterJohnson
  • Report better connection close messages by PeterJohnson

Simulation

  • Fix MOI calculation error in SingleJointedArmSim by mcm001
  • Enable docking in the GUI by PeterJohnson
  • GUI: Fix buffer overflow in joystick axes copy by PeterJohnson
  • Check for null in getSimDeviceName JNI by PeterJohnson

Math

  • HolonomicDriveController: Add getters for the controllers by OliverW10
  • Fix Pose3d exponential and clean up Pose3d logarithm by jlmcmchl
  • Workaround intellisense Eigen issue by PeterJohnson
  • Remove extraneous assignments from DiscretizeAB() by calcmogul
  • Make PIDController::Calculate(double, double) update setpoint flag by calcmogul
  • Add nearest to Pose2d and Translation2d by rzblue
  • Discard stale pose estimates by jlmcmchl

Examples

  • Add Computer Vision Pose Estimation and Latency Compensation Example by CarloWoolsey
  • Add comment to drivedistanceoffboard example by BerkeSinanYetkin
  • Fix swapped arguments in MecanumControllerCommand example by sciencewhiz
  • Update for AprilTag field load API usage by calcmogul
  • C++ RamseteCommand: Fix units by Starlight220
  • Hatchbots: Add telemetry by Starlight220
  • Improvements to Elevator Simulation Example by michaelleong25

Command-Based Framework

  • Fix C++ Select() factory by Starlight220

DataLogTool

  • Fix crash due to MemoryBuffer by PeterJohnson
  • Add msgpack to datalog example by truher

Glass

  • Add option for debug-level NT logging by PeterJohnson
  • Limit frame rate to 120 fps by default by PeterJohnson

Shuffleboard

  • Format integer arrays correctly by fovea1959
  • Support numbers in gyro widgets by SamCarlberg
  • Add all known topics on networktables client connect by lost1227
  • Use NetworkTable disconnect instead of stop by PeterJohnson

SysId

  • Upgrade vendordeps by calcmogul
  • Add CTRE CANivore and Phoenix Pro support by TytanRock

GradleRIO

  • Rename Sim DriverStation to be clearer about its purpose by PeterJohnson

VSCode

  • Add replacements for wpi/numbers and wpi/span by sciencewhiz
  • Change WPILib on status bar to open project information by ThadHouse
  • Re-enable standalone utility notarization by sciencewhiz
  • Upgrade vscode-java extension to 1.14.0 by PeterJohnson

Docs

  • [wpimath] Fix typo in Pose3d::Exp() docs by calcmogul
  • [wpimath] Update Wikipedia links for quaternion to Euler angle conversion by calcmogul
  • [wpilibj] Fix typo in MecanumDrive docs by calcmogul
  • [commands] Fix docs inconsistency for toggleOnFalse(Command) by Nyxiad
  • [wpilib] XboxController: Fix docs discrepancy by BruceMcRooster
  • Clarify DS functions provided by FMS by sciencewhiz
14 Likes

Just installed the update. Now it builds successfully but then crashes. RioLog reports a fatal error by the Java Runtime Environment…

Can you help us troubleshoot?

Can you share the actual error youre seeing?

*** #**

*** # A fatal error has been detected by the Java Runtime Environment:**

*** #**

*** # SIGSEGV (0xb) at pc=0xa8573aec, pid=28554, tid=28557**

*** #**

*** # JRE version: OpenJDK Runtime Environment (17.0.3.7) (build 17.0.3.7-frc+0-2023-17.0.5u7-1)**

*** # Java VM: OpenJDK Client VM (17.0.3.7-frc+0-2023-17.0.5u7-1, mixed mode, emulated-client, g1 gc, linux-arm)**

*** # Problematic frame:**

*** # C [libopencv_imgproc.so.4.6+0x2b0aec]**

*** #**

*** # No core dump will be written. Core dumps have been disabled. To enable core dumping, try “ulimit -c unlimited” before starting Java again**

Could you share the crash log file? The location is further down in that log, it’ll be something like /tmp/hs_err_pid[numbers].log. You’ll have to use ftp to get it off the roborio.

Could you also share your code?

Sorry, I’m a mechanical mentor helping with programming. I have the log file location…how do I use FTP to get it off the rio?

They do not have the code stored on github this year. Is there another way for me to share it?

Here is a link to the error log. log - Google Docs

If you can’t upload to GitHub, a zip file posted to google drive or similar works.

Here is a zip of the code. https://drive.google.com/file/d/1qLtZzHmV_FEs6CneOflENXcqVNiT10An/view?usp=sharing

I also tried a to deploy a stable code that worked fine before the update. The stable code won’t deploy now either.

A question about the changes to SPI dealing with modes 0 through 3, I think from the version released in September.

The comment seems to have the description for modes 2 and 3 reversed:

/**
   * Sets the mode for the SPI device.
   *
   * <p>Mode 0 is Clock idle low, data sampled on rising edge.
   *
   * <p>Mode 1 is Clock idle low, data sampled on falling edge.
   *
   * <p>Mode 2 is Clock idle high, data sampled on falling edge.
   *
   * <p>Mode 3 is Clock idle high, data sampled on rising edge.
   *
   * @param mode The mode to set.
   */
  public final void setMode(Mode mode) {
    m_mode = mode.value & 0x3;
    SPIJNI.spiSetMode(m_port, m_mode);
  }

Modes 2 and 3 should correspond to CPOL = 1 (clock high) and the lower bit should be CPHA which is 0 for rising edge and 1 for falling edge. It looks like CPHA is reversed?

Reference 1: Introduction to SPI Interface | Analog Devices

Reference 2: SPI Tutorial – Serial Peripheral Interface Bus Protocol Basics

When the setMode() method was added, I believe these were updated to now call setMode() instead of whatever they used to do:

  /**
   * Configure the clock output line to be active low. This is sometimes called clock polarity high
   * or clock idle high.
   *
   * @deprecated Use setMode() instead.
   */
  @Deprecated(since = "2023", forRemoval = true)
  public final void setClockActiveLow() {
    m_mode |= 1;
    SPIJNI.spiSetMode(m_port, m_mode);
  }

  /**
   * Configure the clock output line to be active high. This is sometimes called clock polarity low
   * or clock idle low.
   *
   * @deprecated Use setMode() instead.
   */
  @Deprecated(since = "2023", forRemoval = true)
  public final void setClockActiveHigh() {
    m_mode &= 1;
    SPIJNI.spiSetMode(m_port, m_mode);
  }

  /**
   * Configure that the data is stable on the leading edge and the data changes on the trailing
   * edge.
   *
   * @deprecated Use setMode() instead.
   */
  @Deprecated(since = "2023", forRemoval = true)
  public final void setSampleDataOnLeadingEdge() {
    m_mode &= 2;
    SPIJNI.spiSetMode(m_port, m_mode);
  }

  /**
   * Configure that the data is stable on the trailing edge and the data changes on the leading
   * edge.
   *
   * @deprecated Use setMode() instead.
   */
  @Deprecated(since = "2023", forRemoval = true)
  public final void setSampleDataOnTrailingEdge() {
    m_mode |= 2;
    SPIJNI.spiSetMode(m_port, m_mode);
  }

I get these bit-wise operators confused, but I think setClockActiveLow() should be AND’ing it with 1, not OR’ing, because we want to clear the high bit and keep the low bit as it is?

Similarly, setClockActiveHigh() should be OR’ing with 2 to set the high bit?

I think setSampleDataOnLeadingEdge() is right because you want to clear the low bit, but setSampleDataOnTrailingEdge() should OR with 1.

The NavX library appeared to call setClockActiveLow() and setSampleDataOnTrailingEdge() at least in earlier versions, which is why I’m wondering if something changed there between 2022 and 2023.

Any reason why REV solenoids don’t simulate but CTRE ones do. I just spent 30 minutes chasing a bug that was easily fixed by switching the module in code form REV to CTRE.

The AD page referenced is actually wrong, and different from the corelis page, which matches our documentation. Mode 0 and Mode 3 are the 2 rising edge settings, and modes 1 and 2 are the falling edge settings.

The CHPA bit doesn’t actually specify rising or falling edge. It specifies leading or trailing edge. Which is why its opposite depending on what CPOL is.

Thats why the setSampleDataOnRisingEdge and setSampleDataOnFallingEdge functions were deprecated and removed a few years ago. That was actually incorrect depending on the clock polarity. The setSampleDataOnLeadingEdge and setSampleDataOnTrailing edge were added to solve that. Then this year the mode function was explicitly added because most datasheets just have the supported mode.

The NavX library should be set to mode 3, which is correct for the device.

It does look like the bit sets on the deprecated functions are incorrect though. Thats my mistake. I switched all the internal SPI uses to directly set mode, which hid the bug. Since theyre deprecated, we probably won’t fix them, as we’ll be removing them after this year, and don’t want to break code like that in an upgrade. You can manually swap the names to get the right functions.

Thank you for your reply.

Just to confirm, the latest NavX library (version 2023.0.3) has been modified to use the new setMode method, and sets it to 3? I haven’t been able to find the most recent source code for that library online.

Edit: sorry… I now see they’re calling setMode(3)

I think that’s a Kauai Labs question, not a WPILib question?
Not sure they have a CD presence lately.

1 Like

Studica bought Kauai Labs, so support is now through Studica. I have a ticket open with them, but haven’t received a reply to any questions since yesterday. I’m just trying to explore all avenues.

We have 3 NavX2’s and they all appear to display the same issue and I’ve seen it on both a Rio1 robot and a Rio2 robot. The Rio1 is just last year’s robot updated to 2023 WPILib, image, and firmwares. It was working great and we were using it for driving practice without issue right until we upgraded it.

Curiously the 2023 robot with a Rio2 was experiencing the same issue, but since removing all the motors for some build work, I can’t get it to reproduce on that robot.

I can reproduce and opened an issue here:

1 Like

Does it crash immediately after deploy, or after some time of doing nothing, or after doing something specific?

The error points to something in opencv (which didn’t change between versions). I also don’t see any vision or camera code in your project.

I did have to recreate the .wpilib and .vscode folders as they weren’t in your zip.