Skip to content

Commit

Permalink
pybricks.robotics.DriveBase: Document use of gyro.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurensvalk committed Apr 7, 2023
1 parent 6b3808f commit dadaab6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions jedi/tests/test_get_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def _get_constructor_signature(module: str, type: str) -> SignatureHelp:
"wheel_diameter: Number",
"axle_track: Number",
"positive_direction: Direction=Direction.CLOCKWISE",
"use_gyro: bool=False",
]
],
),
Expand Down
9 changes: 8 additions & 1 deletion src/pybricks/robotics.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ def __init__(
wheel_diameter: Number,
axle_track: Number,
positive_direction: Direction = Direction.CLOCKWISE,
use_gyro: bool = False,
):
"""DriveBase(left_motor, right_motor, wheel_diameter, axle_track, positive_direction=Direction.CLOCKWISE)
"""DriveBase(left_motor, right_motor, wheel_diameter, axle_track, positive_direction=Direction.CLOCKWISE, use_gyro=False)
Arguments:
left_motor (Motor):
Expand All @@ -73,6 +74,12 @@ def __init__(
positive_direction (Direction): Which direction the drive base
should turn when you give a positive turn rate or turn
angle, viewed from the top.
use_gyro (bool): Choose ``True`` to use the internal gyrosope for
more accurate turns. This can only be used when
the ``positive_direction`` is set to counterclockwise. This is
only supported on hubs with an inertial measurement unit (IMU).
If you choose ``False`` (the default), turns are measured
using the wheel angles.
"""

def drive(self, speed: Number, turn_rate: Number) -> None:
Expand Down

0 comments on commit dadaab6

Please sign in to comment.