Add more flesh to the motor file
This commit is contained in:
@@ -9,9 +9,6 @@ the motor on the Traxxas Slash using a Raspberry Pi
|
|||||||
3B+.
|
3B+.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
"""
|
|
||||||
class MotorController:
|
class MotorController:
|
||||||
def __init__(self, pin_number, frequency, duty_cycle=0):
|
def __init__(self, pin_number, frequency, duty_cycle=0):
|
||||||
self._duty_cycle = duty_cycle
|
self._duty_cycle = duty_cycle
|
||||||
@@ -35,7 +32,7 @@ class MotorController:
|
|||||||
if value > 0 and value < 100:
|
if value > 0 and value < 100:
|
||||||
self._duty_cycle = value
|
self._duty_cycle = value
|
||||||
# Change the current duty cycle of the GPIO.
|
# Change the current duty cycle of the GPIO.
|
||||||
self.control.changeDutyCycle
|
self._control_pin.changeDutyCycle
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
if self._running:
|
if self._running:
|
||||||
@@ -47,9 +44,29 @@ class MotorController:
|
|||||||
self._control_pin.stop()
|
self._control_pin.stop()
|
||||||
|
|
||||||
def arm(self):
|
def arm(self):
|
||||||
|
# Set pulse width 0
|
||||||
|
|
||||||
|
|
||||||
|
# Wait 1s
|
||||||
|
|
||||||
|
# Set pulse width to maximum
|
||||||
|
|
||||||
|
# Wait 1s
|
||||||
|
|
||||||
|
# set pulse width minimum
|
||||||
|
|
||||||
|
# Wait 1s
|
||||||
|
|
||||||
|
# Set pulse width to idle
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
def setThrottle(self, throttle: float):
|
||||||
|
pass
|
||||||
|
|
||||||
class MotorDetails:
|
class MotorDetails:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def minDutyCycle(self):
|
def minDutyCycle(self):
|
||||||
@@ -71,8 +88,12 @@ class MotorDetails:
|
|||||||
def idle(self):
|
def idle(self):
|
||||||
return self._idle
|
return self._idle
|
||||||
|
|
||||||
|
@idle.setter
|
||||||
|
def idle(self, value):
|
||||||
|
self._idle = value
|
||||||
|
|
||||||
|
class Connection:
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
max_reverse = 1000
|
|
||||||
idle = 1500
|
|
||||||
max_forward = 2000
|
|
||||||
Reference in New Issue
Block a user