Native OS Serial Support

I saw the note below in the improvements made to WPILib for 2020 and I’ve been trying to figure out if this means we can use host OS serial ports in the simulator. I haven’t been able to get it working and was wondering if anyone else saw this or figured out a way to do that.

  • Use OS for serial port instead of the NI driver

I hadn’t even considered serial ports in simulation, but that seems slick!

We’re planning on using a USB serial port on the roboRIO this year. I’ll see if a student can get that same USB device & serial port running in sim tonight. If it works, I’ll shoot you info on the code.

Sorry, no, Serial ports are non-functional in simulation. That change notice was referring to the RoboRIO implementation. It would be pretty easy to get “real device” simulation support added for Linux (and maybe Mac), as that would be the same implementation as the Rio, but Windows will be a fair amount of work, so I can’t promise anything for this year.

Tartar sauce.

No problemo!

Thanks Peter! Mac support would be great for me but understood it may not happen this year.

@gerthworm, During my research I did find this project from Jaci called Cereal. It doesn’t appear to hosted on Maven anymore so I didn’t have much luck there. I also tried implementing jssc, the serial communication library Cereal uses, directly. I could get this one to build but it generates an exception when I call the openPort() method (see below).

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

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000007110b5db, pid=25372, tid=126892
JRE version: OpenJDK Runtime Environment (11.0.4+11) (build 11.0.4+11)
Java VM: OpenJDK 64-Bit Server VM (11.0.4+11, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
Problematic frame:
C [jSSC-2.8_x86_64.dll+0xb5db]

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