diff --git a/doc/api/ev3devices.rst b/doc/api/ev3devices.rst index 189d290..04654e4 100644 --- a/doc/api/ev3devices.rst +++ b/doc/api/ev3devices.rst @@ -18,10 +18,16 @@ Motor .. automethod:: pybricks.ev3devices.Motor.reset_angle - .. rubric:: Action + .. rubric:: Stopping .. automethod:: pybricks.ev3devices.Motor.stop + .. automethod:: pybricks.ev3devices.Motor.brake + + .. automethod:: pybricks.ev3devices.Motor.hold + + .. rubric:: Action + .. automethod:: pybricks.ev3devices.Motor.run .. automethod:: pybricks.ev3devices.Motor.run_time diff --git a/doc/api/pupdevices.rst b/doc/api/pupdevices.rst index 111a63a..a1fe9f0 100644 --- a/doc/api/pupdevices.rst +++ b/doc/api/pupdevices.rst @@ -17,6 +17,9 @@ Motors without Rotation Sensors .. automethod:: pybricks.builtins.DCMotor.stop :noindex: + .. automethod:: pybricks.builtins.DCMotor.brake + :noindex: + Motors with Rotation Sensors ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -32,10 +35,16 @@ Motors with Rotation Sensors .. automethod:: pybricks.pupdevices.Motor.reset_angle - .. rubric:: Action + .. rubric:: Stopping .. automethod:: pybricks.pupdevices.Motor.stop + .. automethod:: pybricks.pupdevices.Motor.brake + + .. automethod:: pybricks.pupdevices.Motor.hold + + .. rubric:: Action + .. automethod:: pybricks.pupdevices.Motor.run .. automethod:: pybricks.pupdevices.Motor.run_time diff --git a/pybricks/builtins.py b/pybricks/builtins.py index 693e3cc..e25e776 100644 --- a/pybricks/builtins.py +++ b/pybricks/builtins.py @@ -30,12 +30,17 @@ class DCMotor: """ pass - def stop(self, stop_type=Stop.COAST): - """Stop the motor. + def stop(self): + """Stop the motor and let it spin freely. - Arguments: - stop_type (Stop): Whether to coast or brake the motor. - """ + The motor gradually stops due to friction.""" + pass + + def brake(self): + """Passively brake the motor. + + The motor stops due to friction, plus the voltage that + is generated while the motor is still moving.""" pass @@ -194,12 +199,8 @@ class Motor(DCMotor): """ pass - def stop(self, stop_type=Stop.COAST): - """Stop the motor. - - Arguments: - stop_type (Stop): Whether to coast, brake, or hold. - """ + def hold(self): + """Stop the motor and actively hold it at its current angle.""" pass def run(self, speed): diff --git a/pybricks/robotics.py b/pybricks/robotics.py index 86bc9b5..7d61de2 100644 --- a/pybricks/robotics.py +++ b/pybricks/robotics.py @@ -3,7 +3,6 @@ """Robotics module for the Pybricks API.""" -from .parameters import Stop from .builtins import Control @@ -46,12 +45,8 @@ class DriveBase: """ pass - def stop(self, stop_type=Stop.COAST): - """Stop the robot. - - Arguments: - stop_type (Stop): Whether to coast, brake, or hold. - """ + def stop(self): + """Stop the robot by coasting the motors.""" pass def distance(self):