From 60f252c37a7664f27e0f64a561d7ab72462f3c39 Mon Sep 17 00:00:00 2001 From: Konstantin Lampalzer Date: Sun, 5 Sep 2021 16:45:30 +0100 Subject: [PATCH] Fixed sign for motor power --- compLib/Motor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compLib/Motor.py b/compLib/Motor.py index 4968581..858041d 100644 --- a/compLib/Motor.py +++ b/compLib/Motor.py @@ -80,7 +80,12 @@ class Motor(object): :param percent: Percentage of max speed. between -100 and 100 :raises: IndexError """ - Motor.power_raw(port, Motor.__linearizePower(MOTOR_CURVE, percent)) + if percent > 0: + Motor.power_raw(port, Motor.__linearizePower(MOTOR_CURVE, percent)) + elif percent < 0: + Motor.power_raw(port, -Motor.__linearizePower(MOTOR_CURVE, -percent)) + else: + Motor.power_raw(port, 0) @staticmethod def all_off():