pybricks.parameters.Stop: Document NONE.

Fixes https://github.com/pybricks/pybricks-api/issues/104
This commit is contained in:
Laurens Valk
2022-11-28 17:10:53 +01:00
parent 1d5956a58a
commit 1ae0a9005f
4 changed files with 24 additions and 8 deletions
+4
View File
@@ -4,9 +4,13 @@
## Unreleased
### Added
- Documented ``Stop.NONE`` and ``Stop.COAST_SMART``.
### Changed
- Changed `PrimeHub.display.image()` to `PrimeHub.display.icon()` and renamed
its kwarg from `image` to `icon`.
- Improved presentation and docstrings of the ``ubuiltins`` module.
## 3.2.0b5 - 2022-11-11
+5 -2
View File
@@ -19,8 +19,11 @@ Stop
.. autoattribute:: pybricks.parameters.Stop.HOLD
:annotation:
The following table shows how each stop type adds an extra level of
resistance to motion. In these examples, ``m`` is a
.. autoattribute:: pybricks.parameters.Stop.NONE
:annotation:
The following table shows how each of the basic stop types add an extra
level of resistance to motion. In these examples, ``m`` is a
:class:`Motor <pybricks.pupdevices.Motor>` and
and ``d`` is a :class:`DriveBase <pybricks.robotics.DriveBase>`. The
examples also show how running at zero speed compares to these stop types.
+1 -1
View File
@@ -102,7 +102,7 @@ ENUMS = [
),
pytest.param("Port", ["A", "B", "C", "D", "E", "F", "S1", "S2", "S3", "S4"]),
pytest.param("Side", ["BACK", "BOTTOM", "FRONT", "LEFT", "RIGHT", "TOP"]),
pytest.param("Stop", ["BRAKE", "COAST", "HOLD"]),
pytest.param("Stop", ["BRAKE", "COAST", "COAST_SMART", "HOLD", "NONE"]),
]
+14 -5
View File
@@ -152,23 +152,32 @@ class Port(_PybricksEnum):
class Stop(_PybricksEnum):
"""Action after the motor stops."""
"""Action after the motor stops or reaches its target."""
COAST: Stop = 0
"""Let the motor move freely."""
COAST_SMART: Stop = 4
"""Let the motor move freely. For the next relative angle maneuver,
"""
Let the motor move freely. For the next relative angle maneuver,
take the last target angle (instead of the current angle) as the new
starting point. This reduces cumulative errors. This will apply only if the
current angle is less than twice the configured position tolerance."""
current angle is less than twice the configured position tolerance.
"""
BRAKE: Stop = 1
"""Passively resist small external forces."""
HOLD: Stop = 2
"""Keep controlling the motor to hold it at the commanded angle. This is
only available on motors with encoders."""
"""Keep controlling the motor to hold it at the commanded angle."""
NONE: Stop = 3
"""
Do not decelerate when approaching the target position. This can be used
to concatenate multiple motor or drive base maneuvers without stopping. If
no further commands are given, the motor will proceed to run indefinitely
at the given speed.
"""
class Direction(_PybricksEnum):