Skip to content

Commit

Permalink
pybricks._common.Motor: Document profile.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurensvalk committed Mar 20, 2023
1 parent e4650cb commit c415296
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions jedi/tests/test_get_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def _get_constructor_signature(module: str, type: str) -> SignatureHelp:
"positive_direction: Direction=Direction.CLOCKWISE",
"gears: Optional[Union[Collection[int], Collection[Collection[int]]]]=None",
"reset_angle: bool=True",
"profile: Number=None",
]
],
),
Expand Down
9 changes: 7 additions & 2 deletions src/pybricks/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,9 @@ def __init__(
positive_direction: Direction = Direction.CLOCKWISE,
gears: Optional[Union[Collection[int], Collection[Collection[int]]]] = None,
reset_angle: bool = True,
profile: Number = None,
):
"""__init__(port, positive_direction=Direction.CLOCKWISE, gears=None, reset_angle=True)
"""__init__(port, positive_direction=Direction.CLOCKWISE, gears=None, reset_angle=True, profile=None)
Arguments:
port (Port): Port to which the motor is connected.
Expand All @@ -386,12 +387,16 @@ def __init__(
When you specify a gear train, all motor commands and settings
are automatically adjusted to account for the resulting gear
ratio. The motor direction remains unchanged by this.
reset_angle(bool):
reset_angle (bool):
Choose ``True`` to reset the rotation sensor value to the
absolute marker angle (between -180 and 179).
Choose ``False`` to keep the
current value, so your program knows where it left off last
time.
profile (Number, deg): Precision profile. A lower value
means more precise movement; a larger value means
smoother movement. If no value is given, a suitable profile for
this motor type will be selected automatically.
"""

def angle(self) -> int:
Expand Down
9 changes: 7 additions & 2 deletions src/pybricks/pupdevices.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ def __init__(
positive_direction: Direction = Direction.CLOCKWISE,
gears: Optional[Union[Collection[int], Collection[Collection[int]]]] = None,
reset_angle: bool = True,
profile: Number = None,
):
"""__init__(port, positive_direction=Direction.CLOCKWISE, gears=None, reset_angle=True)
"""__init__(port, positive_direction=Direction.CLOCKWISE, gears=None, reset_angle=True, profile=None)
Arguments:
port (Port): Port to which the motor is connected.
Expand All @@ -56,12 +57,16 @@ def __init__(
When you specify a gear train, all motor commands and settings
are automatically adjusted to account for the resulting gear
ratio. The motor direction remains unchanged by this.
reset_angle(bool):
reset_angle (bool):
Choose ``True`` to reset the rotation sensor value to the
absolute marker angle (between -180 and 179).
Choose ``False`` to keep the
current value, so your program knows where it left off last
time.
profile (Number, deg): Precision profile. A lower value
means more precise movement; a larger value means
smoother movement. If no value is given, a suitable profile for
this motor type will be selected automatically.
"""

def reset_angle(self, angle: Optional[Number] = None) -> None:
Expand Down

0 comments on commit c415296

Please sign in to comment.