ZED, CUDA, and ROS as an upstart/background process upon boot

So ive been trying to get my ZED to start recording camera data right upon boot up of the TK1. Im using the ROS package robot_upstart, but besides that, Im not 100% sure the root of the problem stems from the package itself, but rather the path’s that are exported for CUDA and under what user account they are exported.

Under a regular ubuntu@ubuntu user, the zed ros driver works perfectly fine, and the python script i wrote to record data to an SSD works perfectly fine as well. However, once I try to turn this into an upstart process, the size of the files my script is creating are a constant size (mostly headers), and no camera data is actually being sent.

So first i looked at the ros logs that where produced from the zed ros driver itself, and noticed that errors where being produced with “NO_GPU_COMPATIBLE”, however, the blue LED on the camera was on (but only for a small amount of time), but the zed ros driver background process was still running.

Since upstart runs the process (zed driver and my python script) as root, I figured it must have been something to do with the ZED SDK not being able to locate CUDA due to an improper path, since the .bashrc is not loaded for root (where CUDA installs the export path). So i logged in as root, killed the existing background upstart process, and tried to run the zed driver and my script manually. At first, i was getting the same error of NO_GPU_COMPATIBLE, so then i manually exported my PATH and LD_LIBRARY_PATH with the same paths that were in my (ubuntu user) .bashrc respectively, and then the driver and script worked just like it did under the regular ubuntu user.

I tried exporting the PATH’s in /etc/init.d/rc.local , but I couldnt figure out what was overwriting this path after rebooting and typing echo $PATH, cuda_6.5 was no longer a part of the path.

If anyone has had experience running an instance of CUDA under root, I would greatly appreciate the help!

Be sure that any user needing GPU access has been added to group “video”. E.G.:

sudo usermod -a -G video <username>