Camera enabled


#1

I struggled with making the camera work and after a few tweaks to the code-with-passion image I was able to achieve "camera working!". I am using a Microsoft LifeCam HD-5000

As you can see I don't have a lot of real estate on my display screen.



#2

What tweaks did you had to do? We might be able to add them right away.

Cheers Dominik/@codewithpassion


#3

The camera wasn't starting when I was running the app from the /etc/init.d/openrov script. I also kept running into problems with trying to start it via 'node server.js' as the user 'rov' so I did the following:

chown -R root:rov /opt/openrov
chmod -r 775 /opt/openrov

This allowed me to fire up the openrov app via 'node server.js' as the rov user. If I loaded the control stream via http://rov:8080 the camera would not stream but the shell window indicated the stream was starting. If I hit 'ctrl r' and refreshed the window the camera would load into the window.

Next I stopped the session and tried to start it again as the root user (since the permissions on the /opt/openrov where all root:root I assumed the service startup was also trying to fire it up as root. I wasn't able to start the app as a root user and I was receiving an error that said "hey you need to set your LD_LIBRARY_PATH". I was going to grab the path out of the rov user .bashrc but I made an assumption that the startup script was also missing the path and maybe that is why the mjpg_streamer couldn't start? Anyway, I next added the following:

echo "export LD_LIBRARY_PATH=/usr/local/lib" >> /etc/profile.d/rov.sh
echo "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/node/bin" >> /etc/profile.d/rov.sh
chmod +x /etc/profile.d/rov.sh

I could of added the LD_LIBRARY_PATH to the root .bashrc but I wanted to see if the script needed the path. I also could of added the same LD_LIBRARY_PATH to the openrov script I suppose. I was going with the plan of setting the PATH and LD_LIBRARY_PATH for everyone so that any user I created or whatever, would have the correct path.

Next I added -l to the shebang ling of /etc/init.d/openrov

#! /bin/sh -l

After that root could start up the server.js, the rov user could start up the server.js and the /etc/init.d/openrov also worked.

Now, the catch is I am still stuck with having to do a refresh after loading the app into the browser. I.E. 'ctrl r'.


#4

Hi Dan,
Thanks for your input. I’ll have a look on the latest image (currently testing) and see what I can do.
The libs that are needed by mjpg_streamer are in /usr/local/lib and AFAIK you should be able to start the process manually with sudo node server.js


#5

Hi Dan,
Just posted a new image. See here: https://github.com/codewithpassion/openrov-image

That should fix all the issues!
Except, sometimes the image is still broken on the first request. Just hit f5.
Cheers, Dominik