How to Use OpenMV in FRC for The RoboRio

Discussion related to "under the hood" OpenMV topics.
thebluedirt
Posts: 2
Joined: Sat Feb 22, 2020 9:25 pm

How to Use OpenMV in FRC for The RoboRio

Postby thebluedirt » Sat Feb 22, 2020 9:34 pm

Hi, everyone:
I'm hoping someone can help us.
We have an OpenMV H7, and we're using it to do vision processing for the FIRST robotics league. We have it connected to a USB port, and sending tracking coordinates over serial link to the to RoboRio ( the processing cpu for FIRST robotics).

Everything is working well, but we want to be able to see the framebuffer of the camera as well as get serial data. We can't seem to figure out how to do that.

We know that the OpenMV can be put in UVC mode, and then on linux /dev/video0 is available like all webcams.
In our case, though, we're using a custom detection script, running as main.py on the OpenMV. When we plug the OpenMV into our USB port, we see a virtual com port in linux, but we do not see a video device.

FRC libraries have a camera server that expects a video source, so all we need is /dev/video0.

Is there a way to get a video feed of the framebuffer, available on /dev/video0 or similar, while also still running a custom script that's sending data over the serial link?
User avatar
kwagyeman
Posts: 4271
Joined: Sun May 24, 2015 2:10 pm

Re: How to Use OpenMV in FRC for The RoboRio

Postby kwagyeman » Sat Feb 22, 2020 9:39 pm

Hi, the UVC mode feature isn't really something that we put a lot of effort into supporting. We just did it. If you want video data you should use these scrips:

https://github.com/openmv/openmv/blob/m ... yopenmv.py
https://github.com/openmv/openmv/blob/m ... enmv_fb.py
Nyamekye,
thebluedirt
Posts: 2
Joined: Sat Feb 22, 2020 9:25 pm

Re: How to Use OpenMV in FRC for The RoboRio

Postby thebluedirt » Sat Feb 22, 2020 9:48 pm

Thank you for the amazingly fast reply!

Apologies for my ignorance!
Is this code that we'd run on the host computer, to get data from the openMV? Or is this code we'd run _ON_ the openMV, so that it presents itself as a /dev/videoX device?
User avatar
kwagyeman
Posts: 4271
Joined: Sun May 24, 2015 2:10 pm

Re: How to Use OpenMV in FRC for The RoboRio

Postby kwagyeman » Sat Feb 22, 2020 11:10 pm

The camera will never appear as a devx device in linux. This code is just the python code you need to execute on a linux computer with python to speak the OpenMV Cam's debug protocol to pull data from it.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests