Files
pybricks-api/doc/main/parameters/stop.rst
T
Laurens Valk 238204d280 doc/main: Rename from doc/api.
The doc/api is a legacy name, which is confusing in the current use, since all build targets are now APIs.

Today we have:

doc/common: Common configuration and settings between all targets.

doc/main: Main Pybricks documentation at docs.pybricks.com.

doc/ide: Documentation shipped with the Pybricks Code IDE.
2021-07-14 11:39:20 +02:00

41 lines
2.5 KiB
ReStructuredText

Stop
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. class:: Stop
Action after the motor stops.
.. autoattribute:: pybricks.parameters.Stop.COAST
:annotation:
.. autoattribute:: pybricks.parameters.Stop.BRAKE
:annotation:
.. 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
: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.
+--------+------------+--------+-------------+---------------+-----------------------------------------+
| | Type | | Friction | | Back | | Speed | | Angle kept | | Examples |
| | | | EMF | | kept at 0 | | at target | |
+========+============+========+=============+===============+=========================================+
| Coast | + | | | | | ``m.stop()`` |
| | | | | | | ``m.run_target(500, 90, Stop.COAST)`` |
+--------+------------+--------+-------------+---------------+-----------------------------------------+
| Brake | + | + | | | | ``m.brake()`` |
| | | | | | | ``m.run_target(500, 90, Stop.BRAKE)`` |
+--------+------------+--------+-------------+---------------+-----------------------------------------+
| | + | + | + | | | ``m.run(0)`` |
| | | | | | | ``d.drive(0, 0)`` |
+--------+------------+--------+-------------+---------------+-----------------------------------------+
| Hold | + | + | + | + | | ``m.hold()`` |
| | | | | | | ``m.run_target(500, 90, Stop.HOLD)`` |
| | | | | | | ``d.straight(0)`` |
| | | | | | | ``d.straight(100)`` |
+--------+------------+--------+-------------+---------------+-----------------------------------------+