Skip to content

Commit

Permalink
Changed scaling for servo duty cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Gloudemans committed Apr 28, 2019
1 parent 01488e6 commit 5e45292
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions robot_motor_control/src/camera_motor_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5e45292

Please sign in to comment.