From 5e4529219e0e7df728ed117e89929ad8ba14f1fe Mon Sep 17 00:00:00 2001 From: Jacob Gloudemans Date: Sat, 27 Apr 2019 20:49:04 -0500 Subject: [PATCH] Changed scaling for servo duty cycle --- robot_motor_control/src/camera_motor_control.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/robot_motor_control/src/camera_motor_control.py b/robot_motor_control/src/camera_motor_control.py index ac8f81e..11c0450 100755 --- a/robot_motor_control/src/camera_motor_control.py +++ b/robot_motor_control/src/camera_motor_control.py @@ -21,8 +21,8 @@ def __init__(self, pinNumber): def setCameraAngle(self, theta): - # Convert from range -90 to 90 to range 0 to 100 - duty_cycle = (theta.data + 90) / 1.8 + # Convert from range -90 to 90 to range 2.22 to 10.0 (this is the good range for the servo) + duty_cycle = ((theta.data + 90) / 180.0) * (7.88) + 2.22 # Send new duty cycle to servo self.p.ChangeDutyCycle(duty_cycle)