<< return to Pixycam.com

running Python Pan Tilt without sudo on R_PI

Hey guys,

I have been at this for about 2 days and feel like I have tried everything in my knowledge to get the pan_tilt.py running without using:
$sudo python pan_tilt.py

If I run the script without sudo it fails on the pixy_init() Error: USB Error: Target not found.

I have noticed that I also cannot run the get_blocks.py working without using the sudo access as well.

I thought this would be similar to setting read write permissions like you do with pi’s serial /dev/ttyAMA0, but I noticed when the Pixy is plugin and I grep for ttyUSB similar to when I have another device plug to the PI, it returns nothing.

Side question: how does the script interface over USB if /dev/ttyUSB0/1 returns no device found when pixy is plug in?

The reason for this is, Im calling a python script that uses pixy inside another program, Mavproxy.py while it is running. (loading the pixy script as module). To my knowledge there is no easy way to load the pixy python script prior to Mavproxy.py running.

I though I could run $sudo mavproxy.py and then load the pixy script but that does not work due to the signal import, which give me an error stating that signal.signal(signal.SIGINT, handle_SIGNINT) must be ran in the main thread. grrr

Im open to any and all suggestion on this one.

If this work, i will have a nice module that allows Pixy to interface through MAVLINK to any vehicle running APM autopilot :slight_smile:

I was able to find a work around: https://groups.google.com/forum/#!topic/git-python/LBKivwC8xug

try:

    signal.signal(signal.SIGINT, thread_interrupt_handler)

except ValueError:

    # happens if we don't try it from the main thread

    print>>  sys.stderr, "Failed to setup thread-interrupt handler. This is usually not critical"

# END exception handling

If anyone has a better idea to go about this please let me know.

Hello James,
Just curious, which distribution are you running?

You may need to set the permissions through udev. See section 2.2.3 here:
http://cmucam.org/projects/cmucam5/wiki/Installing_PixyMon_on_Linux

Edward