Quantcast
Channel: Support - Pimoroni Buccaneers
Viewing all articles
Browse latest Browse all 6857

Pan tilt hat : pan OK , tilt a bit lazzy

$
0
0

Hi,
i am using pan tilt hat + camera on a PI3A+, inside a bird cage to monitor nests.
i drive it through a wifi vnc connection on an ipad or PC.

works …almots great.
i defined 4 zones for the various nests
and use pantilt to go directly from one nest to another to view and takes pictures.
or i can move the camera step by step using arrows keys.

input is done through keyboard touches ( pygames). works great also.

a classic code allow to go slowly (so as not to frigthen birds) to a specific coordinate (X,Y) X and Y being pantilt angles.
always works great for the pan moves but not often for the tilt one ( same code …).

to have tilt actually goes the the Y coordinate i allways need to stimulate it again using up and/or arrows ( that moves 1 angle up or down).

same again , just using arrows (moves by one increment) . pan allways moves left or right just after i pressed the arrow key. tilt is very capricious. will not move for few strokes, then, at some point, with no pattern, skip to the angle…

is that tilt behavior a problem for some of you also ? what can be the problem ?

here is the code to move to a specific coodinate ( very classic)

def vers_coordonnees(zone):
global anglehor
global anglevert
# se dirige vers les nouvelles coorodonnées lentement
(hor,vert) = zone

#  vers la coordonnée horizontale
if hor < anglehor:
    while anglehor != hor :
        anglehor -=1
        mypantilt.pan(anglehor)
        sleep(0.1)
elif hor > anglehor:
     while anglehor != hor :
        anglehor +=1
        mypantilt.pan(anglehor)
        sleep(0.1)
mypantilt.servo_enable(1,False)

# vers la coordonnée verticale
 if vert < anglevert:
    while anglevert != vert :
        anglevert -=1
        mypantilt.tilt(anglevert)
        sleep(0.1)
elif vert > anglevert:
     while anglevert != vert :
        anglevert +=1
        mypantilt.tilt(anglevert)
        sleep(0.1)

any idea ?
thanks

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 6857

Trending Articles