Skip to content

Commit

Permalink
pybricks.robotics.DriveBase: Add brake.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurensvalk committed Oct 26, 2023
1 parent 3335042 commit d935841
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/main/robotics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

.. automethod:: pybricks.robotics.DriveBase.stop

.. automethod:: pybricks.robotics.DriveBase.brake

.. rubric:: Measuring

.. automethod:: pybricks.robotics.DriveBase.distance
Expand Down
1 change: 1 addition & 0 deletions jedi/tests/test_get_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,7 @@ def _get_method_signature(module: str, type: str, method: str) -> SignatureHelp:
[(["speed: Number", "turn_rate: Number"], "None")],
),
pytest.param("pybricks.robotics", "DriveBase", "stop", [([], "None")]),
pytest.param("pybricks.robotics", "DriveBase", "brake", [([], "None")]),
pytest.param("pybricks.robotics", "DriveBase", "distance", [([], "int")]),
pytest.param("pybricks.robotics", "DriveBase", "angle", [([], "int")]),
pytest.param(
Expand Down
6 changes: 6 additions & 0 deletions src/pybricks/robotics.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ def stop(self) -> None:
Stops the robot by letting the motors spin freely."""

def brake(self) -> None:
"""brake()
Stops the robot by passively braking the motors.
"""

def distance(self) -> int:
"""distance() -> int: mm
Expand Down

0 comments on commit d935841

Please sign in to comment.