Is there a way to send HID commands to a device attached to the USB port on the RoboRio?

Hi, I have a device I would like to connect to the RoboRio to enable and disable USB cameras (it is a YepKit YKUSH). It can be sent a 6 byte string to turn on/off the power to the USB ports on the hub, this way only one camera will be active at once and minimise challenges with Rio memory and performance. The Vendor ID and Product ID’s are known, we just need to send 6 bytes to the device and receive a 6 byte response (can be thrown away). Any ideas folks? I have seen that the Serial Port system can be used with the USB, however it looks like it is looking for a “real” serial port to be there (ie a USB --> RS232 adapter)…

I am new to this and we may not need this, however I am interested in getting this setup anyway.

Thanks for your help.

I don’t know about your question specifically, but can’t you use this instead? https://docs.wpilib.org/en/latest/docs/software/vision-processing/introduction/using-multiple-cameras.html

Thanks Fletch, however I was told that the two servers starting up really reduced the video quality last year. I am trying to sort out a way for this to be overcome…

First, the link I posted has a section on how to define multiple video sources for a single CameraServer instance and toggle between them. I’m not sure you can even have multiple CameraServer instances.

In either case, I doubt that having multiple feeds on the Rio directly affected your video quality. If anything, it overused CPU, which caused the framerate to drop (resolution is a configured property and won’t change). It also could have been the bandwidth limit on the field (make sure to do some testing with your radio configured with the “BW Limit” checkbox enabled.

If CPU was your issue, I suspect you were doing at least one of the following:

  1. doing onboard processing of the image (not simply feeding it back to the DS)
  2. incorrectly loading multiple camera sources
  3. using poorly tuned camera properties (compression, resolution, etc)

If bandwidth was your problem, I would suspect you may have done one or more of these:

  1. Too high resolution/not enough compression/too high framerate (640x480 @ 30fps will not work with the bandwidth restrictions starting last season, especially with multiple camera feeds)
  2. multiple cameras in parallel (likely combined with 1 above)

If you have the DS Log files from last year, you should be able to at least confirm whether it’s a CPU or Bandwidth problem. If the Roborio CPU line is above 80%, you’re probably doing something wrong. If you have high latency (more than 10-20ms), or high packet loss (really anything more than intermittent 1-2), that could also be a factor, and is likely indicative of poor radio placement.

Bandwidth usage is a factor of data going over the network, so having multiple camera streams defined in code, but only displaying one at a time on the dashboard will only use one camera stream worth of data.

1 Like

Thanks a lot for the detailed information Fletch - I will go back to the team this weekend and share this with them. Apologies, however I am not working on this full time, I just was told the issue and their understanding of the cause… Appreciate the time it took to give this feedback, good luck in your regionals!!

1 Like

If you’re willing to accept a fully-alternate solution, consider purchasing a raspberry PI, loading on the FRC Vision software, and connecting both cameras and the robot’s ethernet network. The FRC vision software has the ability to switch between two camera streams based on a network tables variable, and only broadcast one back over the network to the driver station. This should mitigate both bandwidth and RIO processor load concerns?

1 Like

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