api/robotics: DriveBase: rename settings args

Make it explicit that these arguments affect only the settings for the corresponding methods.

Also rephrase a few docstrings to make them easier to read or fix typos.
This commit is contained in:
Laurens Valk
2020-02-17 13:43:48 +01:00
parent 5231c48eda
commit 9db7e95959
2 changed files with 23 additions and 24 deletions
+4 -8
View File
@@ -19,6 +19,7 @@
.. automethod:: pybricks.robotics.DriveBase.turn
.. automethod:: pybricks.robotics.DriveBase.settings
.. rubric:: Drive forever
@@ -42,16 +43,11 @@
.. automethod:: pybricks.robotics.DriveBase.reset
.. rubric:: Settings
.. automethod:: pybricks.robotics.DriveBase.settings
.. rubric:: Advanced Settings
The :meth:`.settings` method can be used to adjust the most commonly used
settings. It interacts with both of the attributes below to set the
desired speed and acceleration values. You can also adjust the control
settings manually using these attributes.
The :meth:`.settings` method is used to adjust commonly used settings like
the default speed and acceleration for straight maneuvers and turns.
Use the following attributes to adjust more advanced control setttings.
.. autoattribute:: pybricks.robotics.DriveBase.distance_control
:annotation:
+19 -16
View File
@@ -9,15 +9,14 @@ class DriveBase():
wheel or caster."""
distance_control = Control()
"""PID control is used to track the desired speed and travel the control
required distance You can change the behavior through this attribute.
"""The traveled distance and drive speed are controlled by a PID
controller. You can use this attribute to change its settings.
See :ref:`control` for an overview of available methods."""
heading_control = Control()
"""PID control is used to synchronize the wheel speed,
track the turn rate, and reach the turn angle. You can change the control
behavior through this attribute. See :ref:`control` for an overview of
available methods."""
"""The robot turn angle and turn rate are controlled by a PID
controller. You can use this attribute to change its settings.
See :ref:`control` for an overview of available methods."""
def __init__(self, left_motor, right_motor, wheel_diameter, axle_track):
"""DriveBase(left_motor, right_motor, wheel_diameter, axle_track)
@@ -70,7 +69,7 @@ class DriveBase():
pass
def state(self):
"""Get the instantaneous physical state.
"""Get the state of the robot.
This returns the current :meth:`.distance`, the drive speed, the
:meth:`.angle`, and the turn rate.
@@ -84,20 +83,24 @@ class DriveBase():
"""Reset the estimated driven distance and angle to 0."""
pass
def settings(self, drive_speed, drive_acceleration, turn_rate,
def settings(self, straight_speed, straight_acceleration, turn_rate,
turn_acceleration):
"""Configure the acceleration and maximum speed used
by :meth:`.straight`, :meth:`.turn`, and :meth:`.drive`.
"""Configure the speed and acceleration used
by :meth:`.straight` and :meth:`.turn`.
If you give no arguments, this returns the current values as a tuple.
Arguments:
drive_speed (:ref:`linspeed`): Drive speed of the robot.
drive_acceleration (:ref:`linacceleration`): Linear acceleration
of the robot.
turn_rate (:ref:`speed`): Turn rate of the robot.
turn_acceleration (:ref:`acceleration`): Angular acceleration of
the robot.
straight_speed (:ref:`linspeed`): Speed of the robot during
:meth:`.straight`.
straight_acceleration (:ref:`linacceleration`): Acceleration and
deceleration of the robot at the start and end
of :meth:`.straight`.
turn_rate (:ref:`speed`): Turn rate of the robot
during :meth:`.turn`.
turn_acceleration (:ref:`acceleration`): Angular acceleration and
deceleration of the robot at the start and end
of :meth:`.turn`.
"""
pass