Connecting a controller directly to RIO USB

Anyone know how to get the outputs from a controller that is directly connected to the RIO’s USB port. We are trying to build a stationary demo and instead of connecting wirelessly via a laptop and driver station, we just want the RIO to run, automatically go into teleOPS and use a connect controller to control some motors.

You won’t be able to do that using FRC firmwares (in any language). There are too many safeguards built in to allow a robot to go into teleop mode (or any active mode) without communication from a driver station.

There is, however, nothing that I’m aware of saying that you can’t build a place to put a laptop running your driver’s station on your stationary demo, tether the laptop, and use a controller from some short range. This being a non-competition usage, you could probably even get away with using a wireless controller.
Food for thought.

Eh, that’s still the same thing as just having the laptop on the outside of the demo and wired or wirelessly connected to the rio. I think sthump was trying to find a way to bypass the driver station software.

Everything’s possible with the magic of software… Highly not recommended though. Though if there’s nobody ready to hit the e-stop faster than the main breaker, there’s not much point in having the driver station.

As for the joystick, you won’t be able to use the WPILib Joystick API, but you can use other things. Here’s a gist with some Python example code for reading from the /dev/input/js0 file, and there’s a link in there for API docs so you can use any language.

This sounds like an ideal use case for a HERO board.

+1. Or an arduino if you don’t need CAN.

Part of the demo is showing that it works with standard FRC legal electronics. So we kinda need to use the RIO.

We can circumvent all of the Driver Station safe guards by re-writing the RIO code. That’s not hard.

We are also working in Labview.

Just did a quick google search on Linux Drivers and Labview and found this:

I’m going to test it to see if that works inside a RIO.

Thanks all.

Interesting requirement…

In theory, you can hack the WPILib safety stuff out and do this… not sure I’d advise it but it’s viable.

As a sample point, we controlled a robot in college similarly, although the xbox controller was hooked to a PC which then talked to the RIO. Not exactly what you’re looking for, but hopefully a starting example.

FYI, I had literally no idea how to do labview when I wrote this. I still have no idea, but be warned this code is nasty.

The safeguards are not written in the LabVIEW libraries, but are instead directly built into the image both in the FPGA and NetComm. In order to work around them, you will need to figure out how to create your own image, which will then not be compatible with the LabVIEW libraries for FRC. The safety code is specifically written in a non public set of libraries in order to make sure it is very difficult to work around.

Honestly, a standard driver station plus radio setup seems like less work and much more likely to not screw up a roboRIO. If you can’t use your own controller (arduino or HERO) I would stick with the standard setup. Plus, if you’re trying to demo only with FRC legal hardware, shouldn’t you be using the legal FRC control system?

If you think you’re capable of bypassing the safeguards on the RIO, good luck (and please write a whitepaper on your methods). I think the better option would be a CTRE Hero while demonstrating that it doesn’t matter if its a Hero or a roboRIO-- both output CAN signals to motor controllers.

You don’t even need the HERO anymore. Just use an rPi:

Maybe use an “aftermarket” driver station software that doesn’t require a full Windows laptop?

Examples: (I have no direct connection to these or experience using them)

I think there are some other ones out there. These are open source so you could customize to your needs as well.

Not sure about this idea, but it seems that “in theory” you could actually run the Linux version of this “onboard” the RIO as a separate process?

+1. Especially since the demo is stationary, what is the limitation that requires you to not have a laptop tethered to the roborio, and just using a wireless xbox (or similar) controller.

I could have sworn we ran some motor controller examples directly into the RIO without any driver station attached. I guess I could be wrong. It may have been that we had to launch the driver station to get it to connect and work. In which case, everyone is probably right that this is not worth the trouble of hacking out the safety configurations.

FYI, if you really do want to run the roboRIO without a driver station, as mentioned previously, you’ll need to effectively roll your own system from scratch, bypassing much of the FRC architecture. Specifically, you’ll need to develop your own FPGA configuration, using the LabVIEW FPGA module. I’ve never tinkered with the FPGA on a roboRIO, but since it’s basically a repackaged myRIO, the myRIO examples would probably be a good starting point.

Another, admittedly hacky, alternative would be to run the DS on the RIO. Back in high school, my team made a tracked wheelchair using FRC hardware and software (this was during the age of the FRC cRIO). To let the cRIO run standalone, we were given an embeddable version of the driver station: basically a LabVIEW VI that, when run in the RIO code, would send constant “enable” commands to localhost. It should be fairly easy to code an equivalent module in the language of your preference, once you know what an “enable” command looks like. Several of the control protocols have been documented, although since I don’t see any recent (>2016) packet structures, you might have to blaze your own trail with Wireshark and experimentation.

Granted, if your goal is just to create a stationary demo, using a normal laptop running the driver station is your best bet. But I consider playing with FPGA code and network packet bitfields to be its own reward :wink:

So does anyone know if CAN will work without a driver station? It looks like the RIO kills all PWM commands when there is no driver station connected. But is the same true with CAN?

I know we can do other things like Analog output and Encoders without the need for a driver station. I’m wondering if CAN motor controllers do not have the same safety functions.

Yes, CAN motors are killed as well if a Driver Station is not connected and enabled.

New development, so we aren’t going to remove any safe guards on the RoboRIO. The original intent of this project was to avoid using a laptop for running this demo.

We need the driver station, that’s a given. We found a small windows 10 tablet that can run the driver station. Unfortunately, we are still in the same boat as the tablet does not have a USB port and thus we can not connect a joystick up.

So, the question still stands, has anyone ever tried to connect a joystick up to the RIO USB port and read joystick data from it. The WIP libraries are only meant for joysticks connected to the Driver Station USB port. The VI. I found in labview that was for reading joysticks only works on a windows machine because of drivers.

Anyone know how to connect a joystick up to the linux side of the RIO? Are there driver out there? Any idea how to install those drivers?