diff --git a/compLib/Encoder.py b/compLib/Encoder.py index eddc77f..ae9c1a7 100644 --- a/compLib/Encoder.py +++ b/compLib/Encoder.py @@ -57,7 +57,12 @@ class Encoder(object): raise IndexError("Invalid encoder port specified!") encoder_start_values[port] = Encoder.read_raw(port) - -for i in range(1, MOTOR_COUNT + 1): - encoder_start_values[i] = Encoder.read_raw(i) \ No newline at end of file + @staticmethod + def clear_all(): + """Reset all encoder positions to 0 + """ + + for i in range(1, MOTOR_COUNT + 1): + encoder_start_values[i] = Encoder.read_raw(i) + \ No newline at end of file diff --git a/compLib/__init__.py b/compLib/__init__.py index fa48d2a..e67ec4b 100644 --- a/compLib/__init__.py +++ b/compLib/__init__.py @@ -3,6 +3,7 @@ __version__ = "0.1.5-1" import compLib.LogstashLogging import compLib.Spi import compLib.Reset +import compLib.Encoder import logging import apt @@ -19,4 +20,5 @@ except Exception as e: compLib.Reset.Reset.reset_bot() compLib.Spi.Spi.health_check() -compLib.Spi.Spi.start_health_check_loop() \ No newline at end of file +compLib.Spi.Spi.start_health_check_loop() +compLib.Encoder.Encoder.clear_all() \ No newline at end of file