created first draft of wheel class
This commit is contained in:
parent
5b787bc400
commit
2fdb165f6d
1 changed files with 16 additions and 5 deletions
21
src/wheel.py
21
src/wheel.py
|
@ -5,13 +5,24 @@ class Wheel:
|
||||||
def __init__(self, port):
|
def __init__(self, port):
|
||||||
self._motor = ev3.LargeMotor(port)
|
self._motor = ev3.LargeMotor(port)
|
||||||
self._motor.stop_action = 'brake'
|
self._motor.stop_action = 'brake'
|
||||||
self._speed = 50
|
self._speed = 20
|
||||||
|
self._motor.duty_cycle_sp = self._speed
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pass
|
self._motor.run_direct()
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
pass
|
self._motor.stop()
|
||||||
|
|
||||||
def speed_set(self):
|
def speed_set(self, newspeed):
|
||||||
pass
|
self._speed = newspeed
|
||||||
|
self._motor.duty_cycle_sp = self._speed
|
||||||
|
|
||||||
|
def speed_mod(self, modifier):
|
||||||
|
self._speed = self._speed + modifier
|
||||||
|
self._motor.duty_cycle_sp = self._speed
|
||||||
|
|
||||||
|
def getmovement(self):
|
||||||
|
self.position = self._motor.position
|
||||||
|
self._motor.position.reset()
|
||||||
|
return self.position
|
||||||
|
|
Loading…
Reference in a new issue