mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 17:46:19 +00:00
pybricks.pupdevices.Motor: Document control here.
Based on user feedback, we learned that the control attribute is used more frequently than anticipated. Therefore it makes sense to document it here, just like we do with instances of pybricks.common classes in hubs. This makes it a bit easier to find and see how it is used, along with some of the existing examples.
This commit is contained in:
@@ -190,10 +190,8 @@ class Control:
|
||||
pass
|
||||
|
||||
def load(self):
|
||||
"""Gets the load acting on the ``Motor`` or ``DriveBase``.
|
||||
|
||||
This value is determined from the feedback torque that is
|
||||
needed to track the speed or position command given by the user.
|
||||
"""Estimates the load based on the torque required to maintain the
|
||||
specified speed or angle.
|
||||
|
||||
When coasting, braking, or controlling the duty cycle manually, the
|
||||
load cannot be estimated in this way. Then this method returns zero.
|
||||
|
||||
@@ -26,12 +26,19 @@ class DriveBase:
|
||||
distance_control = _Control()
|
||||
"""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."""
|
||||
See the :ref:`motor control <settings>` attribute for an overview of
|
||||
available methods. The ``distance_control`` attribute has the same
|
||||
functionality, but the settings apply to every millimeter driven by the
|
||||
drive base, instead of degrees turned by one motor."""
|
||||
|
||||
heading_control = _Control()
|
||||
"""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."""
|
||||
See the :ref:`motor control <settings>` attribute for an overview of
|
||||
available methods. The ``heading_control`` attribute has the same
|
||||
functionality, but the settings apply to every degree of rotation of the
|
||||
whole drive base (viewed from the top) instead of degrees turned by one
|
||||
motor."""
|
||||
|
||||
def __init__(self, left_motor, right_motor, wheel_diameter, axle_track):
|
||||
"""DriveBase(left_motor, right_motor, wheel_diameter, axle_track)
|
||||
|
||||
Reference in New Issue
Block a user