Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3556

General discussion • Help to fix jittering/glitching on servo motor on raspberry pi 5

$
0
0
Hello, I am currently trying to make a robotic arm using four servo motors. currently I am trying to test the hand part of the arm and saw that the servo motor keeps glitching and doesn't stay in the position I want it to be in. I looked everywhere to try and fix the jittering but I can't figure out how. Here is the code, and any help is much appreciated, THANKS!

from gpiozero import AngularServo, DistanceSensor, PWMLED
from time import sleep


btm_rt = AngularServo(18, min_angle=-90, max_angle=90)
btm_arm = AngularServo(23, min_angle=-90, max_angle=90)
top_arm = AngularServo(24, min_angle=-90, max_angle=90)
hand = AngularServo(25, min_angle=-90, max_angle=90, frame_width = .1)
ultrasonic = DistanceSensor(echo=17, trigger=4)
led = PWMLED(12)


while True:
if (ultrasonic.distance < .15):
hand.angle = 90
else:
hand.angle = 0

Statistics: Posted by monatopotato — Thu Jun 13, 2024 3:58 am



Viewing all articles
Browse latest Browse all 3556

Trending Articles