pybricks 4.1.0b2__tar.gz → 4.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pybricks-4.1.0b2 → pybricks-4.1.1}/PKG-INFO +1 -1
- {pybricks-4.1.0b2 → pybricks-4.1.1}/pyproject.toml +1 -1
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/pybricks/iodevices.py +107 -3
- {pybricks-4.1.0b2 → pybricks-4.1.1}/AUTHORS.md +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/LICENSE +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/README.rst +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/micropython/__init__.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/micropython/py.typed +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/pybricks/__init__.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/pybricks/_common.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/pybricks/ev3devices.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/pybricks/hubs.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/pybricks/messaging.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/pybricks/nxtdevices.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/pybricks/parameters.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/pybricks/pupdevices.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/pybricks/py.typed +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/pybricks/robotics.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/pybricks/tools.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/uerrno/__init__.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/uerrno/py.typed +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/uio/__init__.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/uio/py.typed +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/ujson/__init__.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/umath/__init__.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/umath/py.typed +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/urandom/__init__.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/urandom/py.typed +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/uselect/__init__.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/uselect/py.typed +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/ustruct/__init__.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/usys/__init__.py +0 -0
- {pybricks-4.1.0b2 → pybricks-4.1.1}/src/usys/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pybricks"
|
|
3
|
-
version = "4.1.
|
|
3
|
+
version = "4.1.1"
|
|
4
4
|
description = "Documentation and user-API stubs for Pybricks MicroPython"
|
|
5
5
|
authors = ["The Pybricks Authors <team@pybricks.com>"]
|
|
6
6
|
maintainers = ["Laurens Valk <laurens@pybricks.com>", "David Lechner <david@pybricks.com>" ]
|
|
@@ -574,7 +574,7 @@ class XboxController:
|
|
|
574
574
|
"""
|
|
575
575
|
|
|
576
576
|
def joystick_left(self) -> tuple[int, int]:
|
|
577
|
-
"""joystick_left() -> tuple
|
|
577
|
+
"""joystick_left() -> tuple[int, int]: %
|
|
578
578
|
|
|
579
579
|
Gets the left joystick position as percentages between -100%
|
|
580
580
|
and 100%. The center position is (0, 0). A square deadzone is applied:
|
|
@@ -588,7 +588,7 @@ class XboxController:
|
|
|
588
588
|
"""
|
|
589
589
|
|
|
590
590
|
def joystick_right(self) -> tuple[int, int]:
|
|
591
|
-
"""joystick_right() -> tuple
|
|
591
|
+
"""joystick_right() -> tuple[int, int]: %
|
|
592
592
|
|
|
593
593
|
Gets the right joystick position as percentages between -100%
|
|
594
594
|
and 100%. The center position is (0, 0). A square deadzone is applied:
|
|
@@ -602,7 +602,7 @@ class XboxController:
|
|
|
602
602
|
"""
|
|
603
603
|
|
|
604
604
|
def triggers(self) -> tuple[int, int]:
|
|
605
|
-
"""triggers() -> tuple
|
|
605
|
+
"""triggers() -> tuple[int, int]: %
|
|
606
606
|
|
|
607
607
|
Gets the left and right trigger positions as percentages between 0%
|
|
608
608
|
and 100%.
|
|
@@ -683,6 +683,110 @@ class XboxController:
|
|
|
683
683
|
"""
|
|
684
684
|
|
|
685
685
|
|
|
686
|
+
class PlayStationController:
|
|
687
|
+
"""Use a Sony® PlayStation® controller as a sensor in your projects to
|
|
688
|
+
control them remotely.
|
|
689
|
+
|
|
690
|
+
This has been tested on the DUALSHOCK®4 wireless controller for
|
|
691
|
+
PlayStation®4 and the DualSense™ wireless controller for PlayStation®5, but
|
|
692
|
+
similar gamepads may also work.
|
|
693
|
+
|
|
694
|
+
Pair the controller in the hub menu first. When your program
|
|
695
|
+
runs, it uses the controller that is currently connected.
|
|
696
|
+
|
|
697
|
+
For tips on connectivity and pairing, see
|
|
698
|
+
:ref:`below <playstation-controller-pairing>`.
|
|
699
|
+
|
|
700
|
+
.. versionadded:: 4.1
|
|
701
|
+
"""
|
|
702
|
+
|
|
703
|
+
buttons = _common.Keypad([])
|
|
704
|
+
|
|
705
|
+
def __init__(self, joystick_deadzone: int = 10):
|
|
706
|
+
"""__init__(joystick_deadzone=10)
|
|
707
|
+
|
|
708
|
+
Arguments:
|
|
709
|
+
joystick_deadzone (Number, %): Joystick deadzone (0 to 100). Values
|
|
710
|
+
below this threshold in both axes will be reported as 0 to
|
|
711
|
+
prevent stick drift.
|
|
712
|
+
|
|
713
|
+
Raises:
|
|
714
|
+
OSError: If the controller is not connected.
|
|
715
|
+
"""
|
|
716
|
+
|
|
717
|
+
def name(self) -> str | None:
|
|
718
|
+
"""name() -> str | None
|
|
719
|
+
|
|
720
|
+
Gets the Bluetooth name of the connected controller.
|
|
721
|
+
|
|
722
|
+
Returns:
|
|
723
|
+
Bluetooth name of the controller, or ``None`` if it is not known.
|
|
724
|
+
|
|
725
|
+
Raises:
|
|
726
|
+
OSError: If the controller is not connected.
|
|
727
|
+
"""
|
|
728
|
+
|
|
729
|
+
def joystick_left(self) -> tuple[int, int]:
|
|
730
|
+
"""joystick_left() -> tuple[int, int]: %
|
|
731
|
+
|
|
732
|
+
Gets the left joystick position as percentages between -100%
|
|
733
|
+
and 100%. The center position is (0, 0). A square deadzone is applied:
|
|
734
|
+
if both axes are within the deadzone, both are reported as 0.
|
|
735
|
+
|
|
736
|
+
Returns:
|
|
737
|
+
Tuple of X (horizontal) and Y (vertical) position.
|
|
738
|
+
|
|
739
|
+
Raises:
|
|
740
|
+
OSError: If the controller is not connected.
|
|
741
|
+
"""
|
|
742
|
+
|
|
743
|
+
def joystick_right(self) -> tuple[int, int]:
|
|
744
|
+
"""joystick_right() -> tuple[int, int]: %
|
|
745
|
+
|
|
746
|
+
Gets the right joystick position as percentages between -100%
|
|
747
|
+
and 100%. The center position is (0, 0). A square deadzone is applied:
|
|
748
|
+
if both axes are within the deadzone, both are reported as 0.
|
|
749
|
+
|
|
750
|
+
Returns:
|
|
751
|
+
Tuple of X (horizontal) and Y (vertical) position.
|
|
752
|
+
|
|
753
|
+
Raises:
|
|
754
|
+
OSError: If the controller is not connected.
|
|
755
|
+
"""
|
|
756
|
+
|
|
757
|
+
def triggers(self) -> tuple[int, int]:
|
|
758
|
+
"""triggers() -> tuple[int, int]: %
|
|
759
|
+
|
|
760
|
+
Gets the left (L2) and right (R2) trigger positions as percentages
|
|
761
|
+
between 0% and 100%.
|
|
762
|
+
|
|
763
|
+
Returns:
|
|
764
|
+
Tuple of left and right trigger positions.
|
|
765
|
+
|
|
766
|
+
Raises:
|
|
767
|
+
OSError: If the controller is not connected.
|
|
768
|
+
"""
|
|
769
|
+
|
|
770
|
+
def dpad(self) -> int:
|
|
771
|
+
"""dpad() -> int
|
|
772
|
+
|
|
773
|
+
Gets the direction-pad value. ``1`` is up, ``2`` is up-right, ``3``
|
|
774
|
+
is right, ``4`` is down-right, ``5`` is down, ``6`` is down-left,
|
|
775
|
+
``7`` is left, ``8`` is up-left, and ``0`` is not pressed.
|
|
776
|
+
|
|
777
|
+
This is essentially the same as reading the state of the
|
|
778
|
+
``Button.UP``, ``Button.RIGHT``, ``Button.DOWN``, and ``Button.LEFT``
|
|
779
|
+
buttons, but this method conveniently returns a number that indicates
|
|
780
|
+
a direction.
|
|
781
|
+
|
|
782
|
+
Returns:
|
|
783
|
+
Direction-pad position, indicating a direction.
|
|
784
|
+
|
|
785
|
+
Raises:
|
|
786
|
+
OSError: If the controller is not connected.
|
|
787
|
+
"""
|
|
788
|
+
|
|
789
|
+
|
|
686
790
|
# Hide type-only names from jedi completions in the module namespace.
|
|
687
791
|
if TYPE_CHECKING:
|
|
688
792
|
del MaybeAwaitable
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|