diff --git a/doc/api/motors.rst b/doc/api/motors.rst index 357ab4b..65da141 100644 --- a/doc/api/motors.rst +++ b/doc/api/motors.rst @@ -9,6 +9,15 @@ Motor Tips & Tricks .. *TODO* +.. _absangles: + +Absolute angles +---------------------------- + +.. todo:: + + This section will be included in a future release. + .. _stalled: Using stall detection diff --git a/pybricks/builtins.py b/pybricks/builtins.py index 2a657ca..b153cb9 100644 --- a/pybricks/builtins.py +++ b/pybricks/builtins.py @@ -192,7 +192,7 @@ class Motor(DCMotor): pass def reset_angle(self, angle): - """Resets the accumulated rotation angle of the motor. + """Sets the accumulated rotation angle of the motor to a desired value. Arguments: angle (:ref:`angle`): Value to which the angle should be reset. diff --git a/pybricks/ev3devices.py b/pybricks/ev3devices.py index f780f66..a3f7aa9 100644 --- a/pybricks/ev3devices.py +++ b/pybricks/ev3devices.py @@ -186,9 +186,6 @@ class GyroSensor: def reset_angle(self, angle): """Sets the rotation angle of the sensor to a desired value. - If you don't specify an angle, the absolute value will be used if - available. - Arguments: angle (:ref:`angle`): Value to which the angle should be reset. """ diff --git a/pybricks/pupdevices.py b/pybricks/pupdevices.py index a0cc9c7..ca1e088 100644 --- a/pybricks/pupdevices.py +++ b/pybricks/pupdevices.py @@ -3,8 +3,22 @@ """LEGO® Powered Up motor, sensors, and lights.""" -from .builtins import KeyPad, Accelerometer, ColorLight -from .builtins import Motor # noqa E402 +from .builtins import KeyPad, Accelerometer, ColorLight, Motor + + +class Motor(Motor): + """Generic class to control motors with built-in rotation sensors.""" + + def reset_angle(self, angle=None): + """Sets the accumulated rotation angle of the motor to a desired value. + + If you don't specify an angle, the :ref:`absolute angle ` + will be used if your motor supports it. + + Arguments: + angle (:ref:`angle`): Value to which the angle should be reset. + """ + pass class RemoteControl: