Romi Vision

This is a java vision target detection program for the Romi / wpilibpi.

The base is the java multi-camera-server. The Grip thread in there are adapted from what we used for Steamworks where it ran on the Roborio.

It will show both the camera feed and a target video on Shuffleboard and provides a network table with the targeting information. Blue line is the target center, green the image center and red outlines the target.

Replace the Grip pipeline with your own. This is done with a small 8" x 8" retroreflective target and a green led vision ring with a 9 volt battery round a pi camera,

Grip 1.5.2 needs this java pipeline import corrected to
import edu.wpi.first.vision.VisionPipeline;

The pipeline uses Convex Hulls as the final stage and that Output needs to be made public in the pipeline for it to run. If you don’t want to use Convex Hulls the code in Main around lines 400 needs to be changed to what is used.

Do a build in VS Code. Choose Uploaded Java Jar on the Romi web page Application tab, select

RomiTargetVision-all.jar from the build/libs folder and upload it.

6 Likes

We bought the Pololu Romi Robot Kit for FIRST. I’d like to know a recommended camera and how you mount this to the kit? My background is software, so I’m learning. Is the standard Raspberry Pi Camera Module appropriate for this?
Thanks

I may not be the best one to make a recommendation, as I am neck deep in figuring this out myself.

We are using USB cameras successfully on the Romi, as well as 5MP Raspberry Pi (ribbon cable) cameras. We haven’t tried using a “noir” RPi camera yet, but I am interested to compare the results against a daylight camera. We’ve used Microsoft LifeCam, a few Logitech, and some other off-brand cameras. Cheap is better I think - you don’t need high resolution images, and you probably don’t want a camera that will auto-focus.

I have 3D-printed cases for the RPi camera, but in a pinch we have also just used double-stick tape to adhere the camera board to one of the Romi motor gearboxes. You may need to modify the mounting bracket for your average webcam to be able to bolt it to the chassis. You want to choose a mounting location and hardware that will minimize vibration. Routing the RPi ribbon cable can be tricky.

I’ll also mention that it can be very confusing figuring out the correct way to address the cameras when using the Romi vs. a Roborio. A USB camera connected to the Pi on the Romi will not be visible to the robot code (running on the Drive Station) as a USB camera. Instead, we’ve used the AxisCamera class and connected via IP address to the camera server.

I used this case https://www.amazon.com/gp/product/B00IJZK66G/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

and this camera https://www.amazon.com/gp/product/B07RXKZ1KN/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1 and fastened it to the front of the robot with zip ties. The camera ribbon cable was carefully folded and run between the raspberry pi and the lower board.

1 Like

The MS Lifecam - can be had for cheap if you don’t mind buying used/off eBay. It works on the RoboRIO and on the PI (using the WPILIBPI firmware). I usually buy couple to have on hand so we can experiment with them.

Team 294 made a 3D printed mount for the RPi camera to go on the Romi. It needs a slightly longer RPi camera cable I think.

3 Likes

I designed one in OpenSCAD that can hold a NeoPixel LED ring and uses LEGO Technic pins or axles for mounting.

EDIT: I forgot to attach the STL file. Enjoy!

CameraBracket_LEGO_v2.stl.zip (117.6 KB)

Double sided tape and some lego :slight_smile:

1 Like