OctoPrint Usage: How do I get OctoPi to recognize the cameras?

Other software discussion
Post Reply
Nilithium
Posts: 3
Joined: Tue Jul 28, 2020 2:25 am

OctoPrint Usage: How do I get OctoPi to recognize the cameras?

Post by Nilithium »

Hello, StereoPi forums! I've decided to side with a Jetson Nano for my autonomous robot project after enjoying teleoperation. That being said, I wish to repurpose the StereoPi to monitor my Prusa i3 MK3S MMU2S. I was able to successfully communicate with the printer over GPIO serial, and have fully established compatibility with all of the CM3+ Lite's components with one exception: the cameras. Now, it should be noted that by default, when using OctoPi on any of the more common Pi models (Pi Zero/3A-B+/4B), OctoPi will automatically find and configure any USB or Pi based cameras, at which point the camera appears under the Control tab with the live feed. This behavior is observed with my previous Pi Zero; but not only does the OctoPrint project advise NOT to use Pi Zero (against Prusa's advice), it is indeed heavily underpowered. Additionally, I would like to install another camera on the printer, one to monitor the MMU2S unit on top, and one to monitor the extruder/heatbed. I might additionally attach a high-quality USB webcam in the future for timelapses, but one thing at a time.

That being said, when connecting the cameras to the camera points on the StereoPi, MJPEG-Streamer does not initialize either camera. I can plug in a webcam using any of the USB ports, and it functions as expected (haven't tested more than one camera at a time). To be honest, I'm not quite sure where to go with this problem from here; I've confirmed that the Pi Camera is enabled in raspi-config, and OctoPi doesn't offer any settings for connected cameras unless it detects that a camera is connected; the only option offered under Camera & Timelapses is to enter a webcam address, or flip any active feeds in a certain direction.

I do suspect the solution lies under the DIY Ninjas Section. https://wiki.stereopi.com/index.php?tit ... as_Section
Perhaps I have to spin up a new instance of OctoPrint and replace or add the dt-blob.bin and dt-blob.bin files?

For the record, I've seen one or two threads about using StereoPi with OctoPrint, but the workaround solution has been to use the SLP Playground image and simply have another Pi running OctoPi receive the stream over the network. I want a fully integrated solution communicating with the CM3+ and StereoPi through the internal headers directly to the Einsy RAMBo, and using local Pi cameras to monitor the printer's vital moving components. Can any of you guys help me out with this?
Last edited by Nilithium on Mon Sep 28, 2020 10:24 pm, edited 1 time in total.

stereomaton
Posts: 184
Joined: Tue May 21, 2019 12:33 pm
Location: France

Re: OctoPrint Usage: How do I get OctoPi to recognize the cameras?

Post by stereomaton »

I did not see your message before. The dt-blob looked like a good start, did it solve your problem?
Stereophotographer and hacker
Despite my quite active participation in the forum, I am not in the StereoPi team
StereoPi Standard Edition + CM3Lite module + a few cameras

Nilithium
Posts: 3
Joined: Tue Jul 28, 2020 2:25 am

Re: OctoPrint Usage: How do I get OctoPi to recognize the cameras?

Post by Nilithium »

stereomaton wrote:
Sun Aug 23, 2020 9:01 am
I did not see your message before. The dt-blob looked like a good start, did it solve your problem?
As a matter of fact, it did! Sort of.
Inside OctoPi's SSH server and SCPing the resulting pictures/video, I can use raspistill/raspivid to take pictures through the 2nd camera. The first one fails, but that's expected as the output of the camera is currently being piped to mjpeg-streamer; OctoPi initializes the first connected Pi camera by default. There is a plugin for OctoPi called MultiCam that allows for multicamera setups, usually reaching out to a network address, but camera 1 works with a loopback address (127.0.0.1) and port number (8080 by default, I think), so the second instance should theoretically work the same way, just with a different port number.

With that said, it's unclear how OctoPi initializes MJPEG-Streamer to use the RPi camera first. Any standard documentation I can find says that you can only set the RPi fork of the software to look for an RPi camera and open a feed from it, and mentions nothing about selecting one. I'm also not sure where OctoPi grabs it's setting from for MJPEG-Streamer, or how to start a second instance that might work. If you can help with these, please let me know!

User avatar
Realizator
Site Admin
Posts: 600
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: OctoPrint Usage: How do I get OctoPi to recognize the cameras?

Post by Realizator »

Hi Nilithium,
Well, if it works with 1 camera, it is possible to force it to work with a couple.
The question is where the video subsystem initialized.
1. If they are using "raspivid", you should just add "-3d sbs" option. But I was not able to find raspivid mention at their GitHub repo.
2. If they are using V4L2, the latest version of it is based on top of RPF MMAL code, and also support stereoscopic mode out of the box
3. If they are using low-level MMAL code, stereoscopic video is possible too.

Nilithium, if you can dig this out and find a place, where they initialize the camera, I will try to suggest a way to turn 3D video on.
Eugene a.k.a. Realizator

Nilithium
Posts: 3
Joined: Tue Jul 28, 2020 2:25 am

Re: OctoPrint Usage: How do I get OctoPi to recognize the cameras?

Post by Nilithium »

Realizator wrote:
Tue Sep 29, 2020 3:21 pm
Hi Nilithium,
Well, if it works with 1 camera, it is possible to force it to work with a couple.
The question is where the video subsystem initialized.
1. If they are using "raspivid", you should just add "-3d sbs" option. But I was not able to find raspivid mention at their GitHub repo.
2. If they are using V4L2, the latest version of it is based on top of RPF MMAL code, and also support stereoscopic mode out of the box
3. If they are using low-level MMAL code, stereoscopic video is possible too.

Nilithium, if you can dig this out and find a place, where they initialize the camera, I will try to suggest a way to turn 3D video on.
Thanks for your comment!
To be honest, I'm not quite sure which one of these the solution is (if any). I do know the fork of MJPG-Streamer that OctiPi uses, however. According to the Github, it uses the input_raspicam plugin.

Link here: https://github.com/jacksonliam/mjpg-streamer/

According to https://community.octoprint.org/t/how-c ... octopi/203 , there is no option to specify an input device, or other important parameters like outbound port and IP (set to loopback, of course). Any ideas?

EDIT: I'm able to confirm the code is attempting to use input_uvc.so which calls upon V4L2 in initialization. Currently, I'm running up against some very tricky config files that refuse to use /dev/video1 currently. Also, it should be noted that I'm not doing any fancy 3D for my printer, just monitoring 2 different cameras at different spot in my printer's enclosure.

I have a little post on OctoPrint with what I've discovered so far. Does it help?
https://community.octoprint.org/t/using ... ce/24798/8

Post Reply