From 8073926ecabc5a968da300cc94d7816eef2ea6af Mon Sep 17 00:00:00 2001 From: josep Date: Wed, 18 Dec 2024 18:34:26 +0900 Subject: [PATCH] =?UTF-8?q?motor=20set=20angle=20=EB=8F=99=EC=9E=91=20?= =?UTF-8?q?=EC=9D=B4=EC=8A=88=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modi_plus/module/output_module/motor.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modi_plus/module/output_module/motor.py b/modi_plus/module/output_module/motor.py index e680f4a..3bfcdd4 100644 --- a/modi_plus/module/output_module/motor.py +++ b/modi_plus/module/output_module/motor.py @@ -104,11 +104,17 @@ def set_angle(self, target_angle: int, target_speed: int = 70) -> None: :return: None """ + if (target_angle < 0 or target_angle > 360)\ + or (target_speed < 0 or target_speed > 100): + return + self._set_property( destination_id=self._id, property_num=Motor.PROPERTY_MOTOR_ANGLE, property_values=(("u16", target_angle), - ("u16", target_speed), ) + ("u16", target_speed), + ("u16", 0), + ("u16", 0), ) ) time.sleep(0.01)