Skip to content

Commit

Permalink
doc/pupdevices/Motor: fix reset_angle
Browse files Browse the repository at this point in the history
The note about absolute angle support had accidentally ended up in the GyroSensor. It applies only to pupdevices.Motor.
  • Loading branch information
laurensvalk committed Mar 24, 2020
1 parent 0bee7ef commit ada5032
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
9 changes: 9 additions & 0 deletions doc/api/motors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pybricks/builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def speed(self):
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.
Expand Down
3 changes: 0 additions & 3 deletions pybricks/ev3devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@ def angle(self):
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.
"""
Expand Down
18 changes: 16 additions & 2 deletions pybricks/pupdevices.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <absangles>`
will be used if your motor supports it.
Arguments:
angle (:ref:`angle`): Value to which the angle should be reset.
"""
pass


class RemoteControl:
Expand Down

0 comments on commit ada5032

Please sign in to comment.