Servo
ServoHAL            (HAL)
        
Hardware interface to control the servos for the turrets
Attributes:
| Name | Type | Description | 
|---|---|---|
pin | 
number of the GPIO pin used to control the turret  | 
__init__(self, pin)
special
Initialize servo
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
pin | 
int | 
Pin to which the signal wire of the servo is connected (12, 13, 18, 19 for hardware PWM)  | 
required | 
Source code in hardware/servo.py
def __init__(self, pin: int):
    """
        Initialize servo
        Arguments:
            pin: Pin to which the signal wire of the servo is connected (12, 13, 18, 19 for hardware PWM)
    """
    self.pin = pin
    self.pwm = Servo(pin, initial_value=0, min_pulse_width=0.615 / 1000, max_pulse_width=2.495 / 1000)
    logging.debug(f"Init turret at Pin {pin}")
close(self)
Release servo
Source code in hardware/servo.py
def close(self):
    """
        Release servo
    """
    self.pwm.value = None
    logging.debug(f"Turret interface closed")
setPosition(self, pos)
Set the position of the servo
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
pos | 
int | 
Servoposition between -90 and 90  | 
required | 
Source code in hardware/servo.py
def setPosition(self, pos: int):
    """
        Set the position of the servo
        Arguments:
            pos: Servoposition between -90 and 90
    """
    self.pwm.value = pos / 90
    #logging.info(f"Turret moved to pos {self.pwm.value}")
ServoInvertedHAL            (ServoHAL)
        
Hardware interface to control inverted servos for the turrets
Attributes:
| Name | Type | Description | 
|---|---|---|
pin | 
number of the GPIO pin used to control the turret  | 
setPosition(self, pos)
Trigger Turret with specific force
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
force | 
Turretposition between -90 and 90  | 
required | 
Source code in hardware/servo.py
def setPosition(self, pos: int):
    """
        Trigger Turret with specific force
        Arguments:
            force: Turretposition between -90 and 90
    """
    self.pwm.value = -1 * pos / 90