Add qa program
This commit is contained in:
parent
1ee4a1e1ef
commit
bd0f14a83b
1 changed files with 76 additions and 1 deletions
|
@ -88,4 +88,79 @@ Eine Linie verfolgen
|
||||||
follow()
|
follow()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
Funktionalität des Roboters überprüfen
|
||||||
|
**************************************
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
import time
|
||||||
|
from compLib.Motor import Motor
|
||||||
|
from compLib.Encoder import Encoder
|
||||||
|
from compLib.IRSensor import IRSensor
|
||||||
|
|
||||||
|
|
||||||
|
def testIR():
|
||||||
|
print("Enabling Infrared Sensor")
|
||||||
|
IRSensor.enable()
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
print("Writing sensor values...")
|
||||||
|
for i in range(0, 50):
|
||||||
|
print(IRSensor.read_all())
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
print("Disabling Infrared Sensor")
|
||||||
|
IRSensor.disable()
|
||||||
|
|
||||||
|
def testEncoders():
|
||||||
|
Motor.multiple_pulse_width((0, 50), (3, -50))
|
||||||
|
|
||||||
|
print("Writing encoder positions...")
|
||||||
|
for i in range(0, 50):
|
||||||
|
print(Encoder.read_all_positions())
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
time.sleep(2)
|
||||||
|
print("Writing encoder velocities...")
|
||||||
|
for i in range(0, 50):
|
||||||
|
print(Encoder.read_all_velocities())
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
Motor.multiple_pulse_width((0, 0), (3, 0))
|
||||||
|
|
||||||
|
|
||||||
|
def testMotors():
|
||||||
|
print("Setting pulse_with")
|
||||||
|
Motor.multiple_pulse_width((0, 50), (3, -50))
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
print("Setting power")
|
||||||
|
Motor.multiple_power((0, 50), (3, -50))
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
print("Setting pulse_with")
|
||||||
|
Motor.multiple_speed((0, 5), (3, -5))
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
for i in range(0, 100):
|
||||||
|
Motor.multiple_power((0, i), (3, -i))
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
print("Make sure robot is turned on it's back!")
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
print()
|
||||||
|
print("----------------- Testing Infrared Sensor -----------------")
|
||||||
|
testIR()
|
||||||
|
|
||||||
|
print()
|
||||||
|
print("----------------- Testing Encoder -----------------")
|
||||||
|
testEncoders()
|
||||||
|
|
||||||
|
print()
|
||||||
|
print("----------------- Testing Motors -----------------")
|
||||||
|
testMotors()
|
Reference in a new issue