From 350b90d967d69f76e86f449761c054aa25422e2b Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Tue, 28 Apr 2020 14:01:28 +0200 Subject: [PATCH] doc/parameters: document stop types in table Make more explicit how the stop types gradually add more resistance to motion. --- doc/api/parameters.rst | 25 +++++++++++++++++++++++++ pybricks/parameters.py | 14 -------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/doc/api/parameters.rst b/doc/api/parameters.rst index aecb12d..a161747 100644 --- a/doc/api/parameters.rst +++ b/doc/api/parameters.rst @@ -59,6 +59,31 @@ .. autoclass:: pybricks.parameters.Stop :no-members: + The following table show how each stop type adds an extra level of + resistance to motion. In these examples, ``m`` is a + :class:`Motor ` and + and ``d`` is a :class:`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)`` | + +--------+------------+--------+-------------+---------------+-----------------------------------------+ + .. autoclass:: pybricks.parameters.Color :no-members: diff --git a/pybricks/parameters.py b/pybricks/parameters.py index 148aa66..35fb737 100644 --- a/pybricks/parameters.py +++ b/pybricks/parameters.py @@ -85,20 +85,6 @@ class Stop(_PybricksEnum): Keep controlling the motor to hold it at the commanded angle. This is only available on motors with encoders. - - The stop type defines the resistance to motion after coming to a - standstill: - - +-----------+-------------+------------------------------------------+ - |Parameter | Resistance | Physical meaning | - +===========+=============+==========================================+ - |Stop.COAST | low | Friction | - +-----------+-------------+------------------------------------------+ - |Stop.BRAKE | medium | Friction + Torque opposite to motion | - +-----------+-------------+------------------------------------------+ - |Stop.HOLD | high | Friction + Torque to hold commanded angle| - +-----------+-------------+------------------------------------------+ - """ COAST = 0