WPI Lib on Raspberry PI (as main processor)

Hey guys.

The robotics competition I’m participating in just got very similar to FRC but on a much smaller scale. The robot’s controller will be the vmx-pi and the motors are controlled by another board using CAN bus.

My main concern is the programming that suddenly changed from LabVIEW and now must be done through the WPI Lib. Since the controllers will take too long to arrive here in Brazil, I need to get started with WPI Lib as fast and cheap as possible. The best solution I could think of was to use simple DC motor drivers controlled by PWM signal (no need for CAN) and connect the encoders and every other sensor on a single board.

Would the Raspberry Pi 4B be appropriate for this situation?

Is it possible to use VS Code to deploy WPI Lib code directly onto the rPI (as the main and only processor) and make the robot drive around autonomously?

I understand that these may be silly questions, but I’m completely new to this.

Someone more familiar with the WPILib licensing can chime in, but If I understand correctly, the license is specifically for FRC and external uses may fall under different restrictions.

Edit: ignore that, I was getting thrown off by this statement:

No

You can review our license here: allwpilib/LICENSE.md at master · wpilibsuite/allwpilib · GitHub

1 Like

When you are using the VMXpi board, the raspberry pi is your primary processor. You should be able to set up and deploy to it, using the same process as you would with the VMX already attached.

The only issue I would foresee there is that the VMX deployment pipeline with wpilib assumes the VMX HAL can be used, so you would have to figure out how to map WPIlib code directly onto pi output channel, then reverse that change once your vmx came in.

@slibert has been super helpful getting me started, he might have good advice for programming the Pi before the VMX arrives.

1 Like

Since the controllers will take too long to arrive here in Brazil, I need to get started with WPI Lib as fast and cheap as possible. The best solution I could think of was to use simple DC motor drivers controlled by PWM signal (no need for CAN) and connect the encoders and every other sensor on a single board.

Would the Raspberry Pi 4B be appropriate for this situation?

[slibert: Quick answer: Raspberry Pi 4B will need additional circuitry to safely generate PWM signals to be used by external Motor Controllers.

Details:

Raspberry Pi 4B can do a fine job of generating very accurate PWM on all of it’s GPIO pins, if DMA to the GPIO pins, driven by one of the high-speed onboard clocks.

However, Raspberry Pi 4B GPIO pins are 3.3V only, so this would only work if your motor controller accepted a 3.3V PWM input signal.

Additionally, the Raspberry Pi 4B GPIO pins drive only a limited amount of current (16mA maximum, and a total of 50mA for all GPIOs).

Raspberry Pi 4B does not include much circuitry at all to protect the raspberry pi 4B pins from over-current or over-voltage.

VMX-pi solves these problems by adding the circuitry to manage this - a 3.3->5V voltage translator with it’s own power supply, as well as additional protection circuitry to clamp input voltages.

Is it possible to use VS Code to deploy WPI Lib code directly onto the rPI (as the main and only processor) and make the robot drive around autonomously?

[slibert: Yes, VSCode can be used to deploy directly to the rPI even if VMX-pi is not present.

However to actually ~run~ the WPI Lib code, the VMX-pi must be present. The VMX-pi HAL will fail to initialize unless a VMX-pi is detected. So without the VMX-pi board, you won’t get very far.]

3 Likes

Thank you @slibert for the complete explanation. Also, thanks @everyone for the fast replies.

About the extra circuitry, you made me realize that not only the motor drivers could cause issues but mainly the encoders and other sensors would need level shifters as the raspberry pi GPIO pins are not 5V tolerant.

In the end, I would have to design something very similar to the vmx-pi itself and would certainly end up making some mistakes on the way, so it’s wiser to just wait.

Any suggestions on how to get started with WPI Lib in the meantime?
I have started reading the docs and already installed FRC VS Code. Is there a way to somehow learn/practice/simulate the code without any hardware?

1 Like

WPI Library has simulation support, allowing you to write and run robot applications on Windows that use simulated hardware.

https://www.google.com/url?sa=t&source=web&rct=j&url=https://docs.wpilib.org/en/stable/docs/software/wpilib-tools/robot-simulation/introduction.html&ved=2ahUKEwia66yBmb7rAhXRl54KHdh0AYkQFjAAegQIAhAC&usg=AOvVaw1HPJlj-cs9GM-QKcTNpoE8&cshid=1598627965811

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.