Recommended firmware version for the XRP robot for using both the XRP Code Editor and WPILib

I have been using the following two firmware versions (firmware.uf2 and RPI_PICO_W-20230426-v1.20.0.uf2) for the XRP Code Editor (https://xrpcode.wpi.edu/) (blockly and micro python).

When I upgrade the firmware to versions 0.5.1, 0.50 or 0.40, I am not able to connect to the XRP robot via the micro USB. The XRP robot provides an SSID of XRP-xxxx-xxxx.

May I ask, is anyone else experiencing this issue? I look forward to any recommendations on how to resolve this issue. Thank you.

Hi there!

Unfortunately, XRPCode doesnā€™t work when the WPILib firmware is flashed to the control board. These are 2 separate use cases:

  1. Flash MicroPython onto the XRP, and interact with it via XRPCode
  2. Flash the WPILib firmware onto the XRP, and interact with it via WPILib

Itā€™s currently not possible to mix the firmware and editor, they have to match each other.

Hope this helps!

Good morning Dryw. A special thank you to you and David for hosting the informative ā€œGet started with robotics and the Experiential Robotics Platform (XRP)ā€ webinar yesterday.

Shortly, I will be training 7 students (grades 5 to 12) on how to build, program and test 2 XRP robots. In the later part of the program, I will be switching between the XRP Code Editor (beginner) and the WPILib (intermediate / advance) activities.

When you have a moment, could you please recommend the firmware file (*.uf2) that comes with a brand new XRP robot? At times, we may need to factory reset the XRP robot.

Also, I would like to train the students on how to use a game controller to operate the XRP robot using WPILib (java or python). May I ask, are there step by step instructions available including, recommended firmware on control board, recommended version of the WPILib tool, build.gradle, supported game controllers, etc.)? Thank you.

1 Like

Thank you for your guidance. The XRP robot is a clever way to introduce robotics to students. Great job to you and your team.

Thank you, glad you could attend the webinar!

If you want to completely reset the control board, this is what Iā€™d suggest:

  1. Erase the entire flash memory
  2. Flash MicroPython
    • Download the latest version of MicroPython for the Pico W here and put it onto the control board (see RPiā€™s instructions). This is not the same exact uf2 that the XRP ships with (thatā€™s an outdated version), but Iā€™d really recommend just getting the latest version from RPi (this is what XRPCode does anyways, so it saves a step).
  3. (Optional) Make the LED blink
    • This is only needed if you want a true ā€œnew out of boxā€ state for the control board. If so, create a main.py file that just blinks the LED indefinitely.

This repository includes recommended steps for getting the XRP working with WPILib. As of right now, v0.5.1 is the latest WPILib firmware for the XRP, and is intended to be used with WPILib 2024 Alpha 1, available here.

There is an example WPILib project available here to help you get started; it has a correctly configured build.gradle, though youā€™ll need to change the IP address in line 64 of build.gradle to 192.168.42.1.

As for supported controllers, I believe basically any USB controller should work in WPILib. You can even use your keyboard if needed.

Hope this helps!

Edit:

Use the new 2024 Beta 1 release of WPILib, it has an example project for the XRP. More info here:

Happy Friday Dryw.

As always, thank you this wonderful guidance. This weekend, I will build the WPILib environment and test a USB joystick. Thereafter, I will revert back to the XRP Code Editor.

Have an incredible weekend.

Steven

1 Like

Thank you for the detailed instructions. And thank you for the webinar which I also attended.

I have a follow-on question.
Is it possible to have multiple versions of WPIlib on my laptop?
For example, we are using the 2023 version of WPILib for our ā€œrealā€ FRC robot. But I also want to use the same laptop to do training with the XRP which is using the 2024 alpha.
Can that be done? And if so, how do I ensure Iā€™m pointing to the correct version within my VS Code projects?

Thanks

Happy to help!

Yes, I believe you can have multiple versions of WPILib installed on the same computer, I actually have both 2023 and 2024 Alpha 1 on my computer:

image

I think you just need to make sure when you install WPILib on your computer, have it download a new copy of VS Code instead of making it use an already installed version. Iā€™m actually not very experienced with WPILib, so if you run into trouble with your WPILib installation, I wonā€™t be able to help much there unfortunately.

I thought the webinar was very helpful - Iā€™ve ordered my XRP kit from DigiKey - but while waiting for it to arrive, Iā€™d be interested in trying out XRPCode with a bare Pico-W (which was mentioned as a viable approach during the webinar).

Would those instructions suffice for getting started with XRPCode and a Pico-W? Or would I be ahead of the game with a new Pico-W and not need to handle the first few steps?

Yes, you can also use a bare Pico W with XRPCode if you want. If itā€™s brand new, thereā€™s no need to nuke the flash, just install MicroPython then connect with XRPCode.

The reset of the control board worked well. Thank you.

I installed the latest WPILib firmware (v0.5.1) on the XRP robot. The XRP robot has enabled its access point: XRP-xxxx-xxxx.

On a Windows 10 computer, I installed the WPILib 2024.0.0 Alpha 1 Release, installed Visual Studio - Community 2022 with the Desktop Development with C++ and restarted my computer. I launched the WPILib application, opened and built the ā€œxrp-2024-alpha-example-mainā€ example, connected to the XRP robotā€™s SSID network, changed the mode to teleoperated in the simulator and the USB joystick (playstation) is working properly.

On a Windows 11 computer, I followed the same steps and I am receiving the following ā€œcscorejni.dll: Canā€™t find dependent librariesā€ error message when it tries to open the simulator:

PS C:\xrp-2024-alpha-example-main> ${env:HALSIM_EXTENSIONS}=ā€˜C:\xrp-2024-alpha-example-main\build\jni\release\halsim_gui.dll;C:\xrp-2024-alpha-example-main\build\jni\release\halsim_xrp.dll;ā€™; ${env:PATH}='C:\xrp-2024-alpha-example-main\build\jni\release;C:\WINDOWS\system32'; ${env:HALSIMXRP_HOST}=ā€˜192.168.42.1ā€™; & ā€˜C:\Users\Public\wpilib\2024\jdk\bin\java.exeā€™ ā€˜-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:51453ā€™ ā€˜@C:\Users\sfong\AppData\Local\Temp\cp_7wazojfk4h2vn6fnzwza9tqk7.argfileā€™ ā€˜frc.robot.Mainā€™
HAL Extensions: Attempting to load: halsim_gui
Simulator GUI Initializing.
Simulator GUI Initialized!
HAL Extensions: Successfully loaded extension
HAL Extensions: Attempting to load: halsim_xrp
HALSim XRP Extension Initializing
HALSimXRP Initialized
HALSim XRP Extention Initialized
HAL Extensions: Successfully loaded extension
java.io.IOException: cscorejni could not be loaded from path or an embedded resource.
attempted to load for platform /windows/x86-64/
Last Load Error:
C:\xrp-2024-alpha-example-main\build\jni\release\cscorejni.dll: Canā€™t find dependent libraries
A common cause of this error is missing the C++ runtime.
Download the latest at Latest supported Visual C++ Redistributable downloads | Microsoft Learn

    at edu.wpi.first.util.RuntimeLoader.loadLibrary(RuntimeLoader.java:93)
    at edu.wpi.first.cscore.CameraServerJNI.<clinit>(CameraServerJNI.java:37)
    at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:423)
    at frc.robot.Main.main(Main.java:23)

Thereafter, I downloaded and installed the latest C++ runtime from Latest supported Visual C++ Redistributable downloads | Microsoft Learn website. Currently, I have Microsoft Visual C++ 2015-2022 Redistributable (x64 and x86) - 14.36.32532 version installed. Unfortunately, I receive the same error message.

I look forward to your guidance on how to resolve the ā€œcscorejni.dll: Canā€™t find dependent librariesā€ issue.

PS: On the Windows 10 computer, driving the XRP robot with a joystick is quite amazing. My students will love it.

Steven

1 Like

I have not tried this with XRP specifically, but there is a known isue in WPILib that sounds similar to what you are referring to. See here: Known Issues ā€” FIRST Robotics Competition documentation

The fix is to install the Windows Feature media pack: https://www.microsoft.com/en-us/software-download/mediafeaturepack

John, thank you for your guidance.

My computer has the Windows 11 Home operating system with the following version - 10.0.22621 Build 22621.

The following link provides Media Feature Pack guidance for both Windows 10 and 11:

  • On Windows 11 N: Select the Start button, then select Settings > Apps > Optional features. Select View features next to Add an optional feature, and then select the Media Feature Pack in the list of available optional features.

After following the instructions stated above, the ā€œMedia Feature Packā€ is not listed in the available optional features. Also, I have confirmed that both ā€œMedia Featuresā€ and ā€œWindows Media Playerā€ features are turned on.

I tried running the ā€œxrp-2024-alpha-example-mainā€ example in the WPILib 2024.0.0 Alpha 1 Release and I receive the same ā€œcscorejni.dll: Canā€™t find dependent librariesā€ error message. The simulator does not open.

Please let me know if you require any additional information (logs, installed software, etc.). I am determined to get this to work properly.

Note: After running (F5) the ā€œxrp-2024-alpha-example-mainā€ example in the WPILib 2024.0.0 Alpha 1 Release on my Windows 10 computer (the computer that I could use a joystick to control the XRP robot successfully), the following message appeared during the build process: Resolved files of: nativeRelease > UnzipTranform wpimath-cpp-2024.0.0-alpha-1-149.gfaa1e66-windowsx86-63.zip. A number of other alpha-1 files were downloading as well. Now, I am receiving the same ā€œcscorejni.dll: Canā€™t find dependent librariesā€ error message when building this project.

No action required (FYI).

I am new to the WPILib environment. I asked ChatGPT for more information on the cscorejni.dll. It provided the following information. Now, I understand the recommendation for updating the Media Feature pack.

cscorejni.dll is a dynamic-link library (DLL) file that is typically associated with the CameraServer library in the context of the FIRST Robotics Competition (FRC) and the WPILib (WPI Robotics Library) used by FRC teams. This library is used for camera-related functions and image processing in robotics applications. Its main purpose is to provide the infrastructure for capturing and processing images from cameras used in FRC robots.

Here are some of the main functions and features of cscorejni.dll:

  1. Camera Streaming: It facilitates camera streaming, allowing you to capture video feeds from cameras attached to the robot. These camera feeds can be used for various purposes, such as driving assistance, object detection, and vision tracking.
  2. Image Processing: cscorejni.dll can perform basic image processing tasks on the camera feed, such as filtering, thresholding, and contour detection. This is essential for tasks like identifying game elements or targets.
  3. NetworkTables Integration: It integrates with NetworkTables, a key-value pair system used in FRC, to publish camera information and data. This allows for easy communication and sharing of camera data with other robot components.
  4. Cross-Platform Support: It is designed to work across different platforms, making it compatible with various operating systems, including Windows, Linux, and macOS. This cross-platform support is essential for teams using different development environments.
  5. Integration with WPILib: It is part of the WPILib suite, which is a comprehensive set of libraries and tools for developing FRC robot code. WPILib provides support for sensors, motor control, and robot communication, and cscorejni.dll is a critical part of the camera and vision processing support within WPILib.

In summary, cscorejni.dll plays a vital role in FRC robotics by enabling camera-based vision systems, image processing, and communication with other robot components. It is an important component for teams that want to implement camera vision systems and utilize camera feeds for various robot functionalities, including autonomous driving, target tracking, and more.

I am having this same issue with latest build.

I have a WIn10 with the alpha build and xrp-alpha code. It has worked but tonight after building it has crashed when opening the simulator with the csorejni.dll error.

PS C:\Users\Panther Robotics\Documents\GitHub\xrp-2024-alpha-example>  c:; cd 'c:\Users\Panther Robotics\Documents\GitHub\xrp-2024-alpha-example'; ${env:HALSIM_EXTENSIONS}='C:\Users\Panther Robotics\Documents\GitHub\xrp-2024-alpha-example\build\jni\release\halsim_gui.dll;C:\Users\Panther Robotics\Documents\GitHub\xrp-2024-alpha-example\build\jni\release\halsim_xrp.dll;'; ${env:PATH}='C:\Users\Panther Robotics\Documents\GitHub\xrp-2024-alpha-example\build\jni\release;C:\Windows\system32\'; ${env:HALSIMXRP_HOST}='192.168.42.1'; & 'C:\Users\Public\wpilib\2024\jdk\bin\java.exe' '-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:64824' '@C:\Users\PANTHE~1\AppData\Local\Temp\cp_avcvgtmq424qa50ewyssbgsz1.argfile' 'frc.robot.Main' 
HAL Extensions: Attempting to load: halsim_gui
Simulator GUI Initializing.
Simulator GUI Initialized!
HAL Extensions: Successfully loaded extension
HAL Extensions: Attempting to load: halsim_xrp
HALSim XRP Extension Initializing
HALSimXRP Initialized
HALSim XRP Extention Initialized
HAL Extensions: Successfully loaded extension
java.io.IOException: cscorejni could not be loaded from path or an embedded resource.
        attempted to load for platform /windows/x86-64/
Last Load Error:
C:\Users\Panther Robotics\Documents\GitHub\xrp-2024-alpha-example\build\jni\release\cscorejni.dll: Can't find dependent libraries
A common cause of this error is missing the C++ runtime.
Download the latest at https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

        at edu.wpi.first.util.RuntimeLoader.loadLibrary(RuntimeLoader.java:93)
        at edu.wpi.first.cscore.CameraServerJNI.<clinit>(CameraServerJNI.java:37)
        at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:423)
        at frc.robot.Main.main(Main.java:23)

There will be a beta release of WPILib happening in the next day or two which will fix the build issues (and also remove the need to modify the build.gradle file). This will require v0.5.1 (and up) of the XRP-WPILib firmware.

1 Like

ZeeQueue, thank you for this wonderful news. We look forward to the new beta release of WPILib. Cheers.

Hi folks, the beta version of WPILib is now available (with support for the XRP running the firmware on GitHub - wpilibsuite/xrp-wpilib-firmware)

You can download the latest beta installer here: Release WPILib 2024.1.1 Beta 1 Release Ā· wpilibsuite/allwpilib Ā· GitHub

Additionally, docs on how to use the XRP with WPILib are now available here: Getting Started with XRP ā€” FIRST Robotics Competition documentation

2 Likes

ZeeQueue, great news. A special thank you to you and your team.

I have retrieved the 2024 beta WPILib (~1.8 GB). Tomorrow, I will be documenting and testing it for teleoperated mode (with a USB joystick).

Have a restful and relaxing weekend.

Steven

Thanks. I just tried importing the 2024 alpha example Iā€™ve been using. Well, it wiped out the vendordep. So I copied it manually over, but it didnā€™t have a frcYear field, so I added that. It seemed to pick up everything after that.

However, the pathplannerlib vendordep is throwing lots of errors. I had gotten it to work earlier on alpha build, although I am trying to figure out the necessary values and units still. If anyone get feedforward constants (ks, kv, ka) for the xrp Iā€™d be interested. It isnā€™t yet able to run a sysid, and Iā€™m not sure what direction that project is totally going in quite yet (moving towards not having a logging function ā€“ and implementing in your own projects). Lots to still do, but will have to figure out how the 2024 pathplanner changes are affecting it.

edit: Wanted to clarify that the errors I think are lots of underlying library changes and not related to bad units/values. Two separate issues.