api/robotics: add DriveBase state getters

This commit is contained in:
Laurens Valk
2020-01-02 16:51:50 +01:00
parent 3d9a6f11cc
commit 09d453480b
2 changed files with 34 additions and 6 deletions
+14 -6
View File
@@ -8,12 +8,6 @@
.. autoclass:: pybricks.robotics.DriveBase
:no-members:
.. rubric:: Manual drive control
.. automethod:: pybricks.robotics.DriveBase.start
.. automethod:: pybricks.robotics.DriveBase.stop
.. rubric:: Automatic drive control
.. automethod:: pybricks.robotics.DriveBase.straight
@@ -23,3 +17,17 @@
.. automethod:: pybricks.robotics.DriveBase.arc
.. automethod:: pybricks.robotics.DriveBase.set_drive_settings
.. rubric:: Manual drive control
.. automethod:: pybricks.robotics.DriveBase.start
.. automethod:: pybricks.robotics.DriveBase.stop
.. rubric:: Measuring
.. automethod:: pybricks.robotics.DriveBase.distance
.. automethod:: pybricks.robotics.DriveBase.angle
.. automethod:: pybricks.robotics.DriveBase.reset
+20
View File
@@ -42,6 +42,26 @@ class DriveBase():
"""
pass
def distance(self):
"""Get the estimated accumulated driven distance.
Returns:
:ref:`distance`: Driven distance since last reset.
"""
pass
def angle(self):
"""Get the estimated accumulated rotation angle of the drivebase.
Returns:
:ref:`angle`: Accumulated angle since last reset.
"""
pass
def reset(self):
"""Reset the accumulated driven distance and angle to 0."""
pass
def set_drive_settings(self, drive_speed, drive_acceleration, turn_rate,
turn_acceleration, stop_type):
"""Configure the behavior of the :meth:`.straight`, :meth:`.turn`,