diff --git a/client/docs/source/other/usage.rst b/client/docs/source/other/usage.rst index 3306c2d..97f67d4 100644 --- a/client/docs/source/other/usage.rst +++ b/client/docs/source/other/usage.rst @@ -88,4 +88,79 @@ Eine Linie verfolgen follow() if __name__ == "__main__": - main() \ No newline at end of file + 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() \ No newline at end of file