Module ServoMotor :: Class ServoMotor
[hide private]
[frames] | no frames]

Class ServoMotor

source code

Class that represents a servo motor.

Instance Methods [hide private]
 
__init__(self, id, home, inc)
Creates a servo motor instance and sets it at home position.
source code
 
_setup(self, robot) source code
 
setPos(self, position)
Sets the relative position of the servo motor.
source code
 
setPosAbs(self, position)
Sets the absolute position of the servo motor.
source code
 
_checkRobot(self) source code
Method Details [hide private]

__init__(self, id, home, inc)
(Constructor)

source code 

Creates a servo motor instance and sets it at home position. For most servos: home = 300, inc = 2. Id 0: S12 header, 1: S13 header, 2: S14 header, 3: S15 header.

Parameters:
  • id - the id of the motor (0..3)
  • home - the PWM duty cycle for the home position (0..4095)
  • inc - the increment factor (inc_duty/inc_position)

setPos(self, position)

source code 

Sets the relative position of the servo motor.

Parameters:
  • position - the position with respect to home and using the inc_duty/inc_position factor For most servo motors in range -200 .. 200

setPosAbs(self, position)

source code 

Sets the absolute position of the servo motor.

Parameters:
  • position - the position in arbitrary units in range 0..4095 (determines PWM duty cycle) For most servo motors in range 100..500