So our team is using a D-Link IP camera (DCS-933L) because of the nice integrated IR LEDs which give us really nice contours in our GRIP pipeline. We have it wired up to a network switch which runs off of the second ethernet port on the OM5P radio (other port on the radio goes directly to RIO). The switch is also wired up to a Rasberry Pi 3. We are using the code in the response to this question to process the MJPG stream on the Pi in order to put frames through the GRIP pipeline. At this point we have successfully ran the camera and processed the frames in the GRIP pipeline using Python, but have not yet uploaded the contour data to Network Tables for the RIO.
Now that I have explained the setup… on to the questions!
What would be the easiest way to get the video feed to show up in the driver station? I see an option in the Java Smart Dashboard for an MJPG streamer but have no idea how to give it an IP to access.
Is the way we are capturing the MJPG stream considered an “acceptable technique?” Is there an easier/more streamlined way to do it?
How would we go about accessing the X/Y data for the contours? Does it have something to do with the byte array output from convex_hulls_output? (The last item in our GRIP pipeline)
We haven’t set up Network Tables yet, but would the switch change anything with how we would go about using them?
Thanks in advance. Our programming team consists of 3-4 programmers used to web development and this is our first year, so the help is… well needed.
For the first question - on the top of the smartdashboard window (I believe it is under view, hit editable), now when you add an mjpeg stream you can right click on it and edit, then there is a box to input the url.
Where are you running GRIP on? The pi or driver’s station?
This provides an option for using an http camera. I am also a beginner with all this though, so I have no idea how one might integrate it with GRIP. However, there is an option to have GRIP generate code which you can use in those screensteps.
1 - On Axis IP cameras, I will go to their config website (just enter the ip address of the camera into a web browser). Then, I can right-click and hit “Copy image address” - this will copy the mjpg stream address into my clipboard, and you can paste it into smart dashboard, or a web browser to test. I am not sure if an equivilant method exists for the D-Link, though.
ooh, thanks, this is super helpful. I’ll try this out
We are running GRIP on the driver station, and exporting the code to run on the Pi.
I saw this but am not sure about compatibility. It says you can add in your own vision code but mentions that it is in Java. Would we have to reinstall a different version of OpenCV?
Yeah I would go with that instead of trying to translate the project I linked into Python. I’m having troubles with network tables also (not entirely sure what should be client mode or not/what ips I should set or not). But I believe that the code you put on the robot needs to set network tables as client mode and set the ip to the ip your radio uses (10.TE.AM.2) then on the pi you just get table I think?
The python code you linked to for reading the HTTP stream will work, but is highly inefficient (though, chances are the inefficiency doesn’t matter so much).
Obviously if you have something that works, then go with that, but in the future I’d highly recommend using cscore. It has builtin support for cameras and all that streaming stuff, and can stream your modified images to smartdashboard.
Have you enabled the raspberry pi camera? Are you using the camera that came with the pi?..i cant tell if you are referring to a usb cam on the pi or the picam itself
Got it working… just had to rebuild OpenCV for Python 3+. Sort of annoying cscore is incompatible with 2.x builds, but w/e. Sorry for the lack of context
We’re using an IP camera, but I just couldn’t get the cscore module to install correctly. Our OpenCV install was for Python 2.7.9 but cscore is only compatible with 3+. It’s fixed now
Maintaining Python 2.x/3.x compatibility is fairly annoying, particularly when it comes to maintaining C extensions. I’ll add something to setup.py to cause it to fail immediately on Python 2, instead of letting you think it works.
Glad to hear you got it installed! Suggestions on improving the install instructions are welcomed.
Actually that’s a lie… still not seeing the module. I was too certain that Python 3 was the issue I was having. I have no idea why Python3 isn’t seeing cscore