| @@ -124,7 +124,7 @@ class Ros2Context: | |||||
| ``` | ``` | ||||
| """ | """ | ||||
| def __init__(self, ros_paths: typing.List[str]=None) -> None: | |||||
| def __init__(self, ros_paths: list[str]=None) -> None: | |||||
| """ROS2 Context holding all messages definition for receiving and sending messages to ROS2. | """ROS2 Context holding all messages definition for receiving and sending messages to ROS2. | ||||
| By default, Ros2Context will use env `AMENT_PREFIX_PATH` to search for message definition. | By default, Ros2Context will use env `AMENT_PREFIX_PATH` to search for message definition. | ||||
| @@ -20,4 +20,5 @@ features = ["pyo3/extension-module"] | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP" | |||||
| ] | ] | ||||
| @@ -16,4 +16,5 @@ features = ["python", "pyo3/extension-module"] | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP" | |||||
| ] | ] | ||||
| @@ -17,5 +17,6 @@ __node-name__ = "__node_name__.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", | |||||
| "D", # pydocstyle | |||||
| "UP" | |||||
| ] | ] | ||||
| @@ -44,7 +44,7 @@ class Operator: | |||||
| frame = np.zeros((CAMERA_HEIGHT, CAMERA_WIDTH, 3), dtype=np.uint8) | frame = np.zeros((CAMERA_HEIGHT, CAMERA_WIDTH, 3), dtype=np.uint8) | ||||
| cv2.putText( | cv2.putText( | ||||
| frame, | frame, | ||||
| "No Webcam was found at index %d" % (CAMERA_INDEX), | |||||
| f"No Webcam was found at index {CAMERA_INDEX}", | |||||
| (30, 30), | (30, 30), | ||||
| font, | font, | ||||
| 0.75, | 0.75, | ||||
| @@ -22,4 +22,5 @@ dora-argotranslate = "dora_argotranslate.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -21,7 +21,6 @@ dependencies = [ | |||||
| "mlx-whisper >= 0.4.1; sys_platform == 'darwin'", | "mlx-whisper >= 0.4.1; sys_platform == 'darwin'", | ||||
| ] | ] | ||||
| [dependency-groups] | [dependency-groups] | ||||
| dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | ||||
| @@ -31,4 +30,5 @@ dora-distil-whisper = "dora_distil_whisper.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -21,4 +21,5 @@ dora-echo = "dora_echo.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP" | |||||
| ] | ] | ||||
| @@ -34,4 +34,5 @@ dora-internvl = "dora_internvl.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -18,4 +18,5 @@ dora-ios-lidar = "dora_ios_lidar.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -27,4 +27,5 @@ dora-keyboard = "dora_keyboard.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -19,4 +19,5 @@ features = ["python", "pyo3/extension-module"] | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -18,4 +18,5 @@ dora-kokoro-tts = "dora_kokoro_tts.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -1,3 +1,5 @@ | |||||
| """TODO: Add docstring.""" | |||||
| import os | import os | ||||
| # Define the path to the README file relative to the package directory | # Define the path to the README file relative to the package directory | ||||
| @@ -5,7 +7,7 @@ readme_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "README.m | |||||
| # Read the content of the README file | # Read the content of the README file | ||||
| try: | try: | ||||
| with open(readme_path, "r", encoding="utf-8") as f: | |||||
| with open(readme_path, encoding="utf-8") as f: | |||||
| __doc__ = f.read() | __doc__ = f.read() | ||||
| except FileNotFoundError: | except FileNotFoundError: | ||||
| __doc__ = "README file not found." | __doc__ = "README file not found." | ||||
| @@ -1,3 +1,5 @@ | |||||
| """TODO: Add docstring.""" | |||||
| from .main import main | from .main import main | ||||
| @@ -1,3 +1,5 @@ | |||||
| """TODO: Add docstring.""" | |||||
| import os | import os | ||||
| import pyarrow as pa | import pyarrow as pa | ||||
| from dora import Node | from dora import Node | ||||
| @@ -59,6 +61,7 @@ ACTIVATION_WORDS = os.getenv("ACTIVATION_WORDS", "what how who where you").split | |||||
| def main(): | def main(): | ||||
| """TODO: Add docstring.""" | |||||
| # Initialize model | # Initialize model | ||||
| model = get_model() | model = get_model() | ||||
| node = Node() | node = Node() | ||||
| @@ -39,3 +39,9 @@ dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | |||||
| [project.scripts] | [project.scripts] | ||||
| dora-llama-cpp-python = "dora_llama_cpp_python.main:main" | dora-llama-cpp-python = "dora_llama_cpp_python.main:main" | ||||
| [tool.ruff.lint] | |||||
| extend-select = [ | |||||
| "D", # pydocstyle | |||||
| "UP" | |||||
| ] | |||||
| @@ -1,7 +1,10 @@ | |||||
| """TODO: Add docstring.""" | |||||
| import pytest | import pytest | ||||
| def test_import_main(): | def test_import_main(): | ||||
| """TODO: Add docstring.""" | |||||
| from dora_llama_cpp_python.main import main | from dora_llama_cpp_python.main import main | ||||
| # Check that everything is working, and catch dora Runtime Exception as we're not running in a dora dataflow. | # Check that everything is working, and catch dora Runtime Exception as we're not running in a dora dataflow. | ||||
| @@ -43,4 +43,5 @@ extend.exclude = "dora_magma/Magma" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -27,4 +27,5 @@ dora-microphone = "dora_microphone.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -18,4 +18,5 @@ features = ["python", "pyo3/extension-module"] | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -28,5 +28,8 @@ dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | |||||
| dora-openai-server = "dora_openai_server.main:main" | dora-openai-server = "dora_openai_server.main:main" | ||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = ["I","D"] | |||||
| extend-select = [ | |||||
| "D", # pydocstyle | |||||
| "UP" | |||||
| ] | |||||
| @@ -31,4 +31,5 @@ dora-opus = "dora_opus.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -31,4 +31,5 @@ dora-outtetts = "dora_outtetts.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -33,4 +33,5 @@ dora-parler = "dora_parler.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -1,3 +1,5 @@ | |||||
| """TODO: Add docstring.""" | |||||
| import os | import os | ||||
| # Define the path to the README file relative to the package directory | # Define the path to the README file relative to the package directory | ||||
| @@ -1,3 +1,5 @@ | |||||
| """TODO: Add docstring.""" | |||||
| from .main import main | from .main import main | ||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||
| @@ -1,3 +1,5 @@ | |||||
| """TODO: Add docstring.""" | |||||
| import pyarrow as pa | import pyarrow as pa | ||||
| import torch | import torch | ||||
| from accelerate import infer_auto_device_map | from accelerate import infer_auto_device_map | ||||
| @@ -56,6 +58,7 @@ prompt_suffix = "<|end|>" | |||||
| def main(): | def main(): | ||||
| """TODO: Add docstring.""" | |||||
| node = Node() | node = Node() | ||||
| for event in node: | for event in node: | ||||
| @@ -30,3 +30,9 @@ dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | |||||
| [project.scripts] | [project.scripts] | ||||
| dora-phi4 = "dora_phi4.main:main" | dora-phi4 = "dora_phi4.main:main" | ||||
| [tool.ruff.lint] | |||||
| extend-select = [ | |||||
| "D", # pydocstyle | |||||
| "UP" | |||||
| ] | |||||
| @@ -1,7 +1,10 @@ | |||||
| """TODO: Add docstring.""" | |||||
| import pytest | import pytest | ||||
| def test_import_main(): | def test_import_main(): | ||||
| """TODO: Add docstring.""" | |||||
| from dora_phi4.main import main | from dora_phi4.main import main | ||||
| # Check that everything is working, and catch dora Runtime Exception as we're not running in a dora dataflow. | # Check that everything is working, and catch dora Runtime Exception as we're not running in a dora dataflow. | ||||
| @@ -18,4 +18,5 @@ dora-piper = "dora_piper.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -23,4 +23,5 @@ dora-pyaudio = "dora_pyaudio.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -12,7 +12,6 @@ requires-python = ">=3.8" | |||||
| dependencies = ["dora-rs >= 0.3.9", "numpy < 2.0.0", "opencv-python >= 4.1.1"] | dependencies = ["dora-rs >= 0.3.9", "numpy < 2.0.0", "opencv-python >= 4.1.1"] | ||||
| [dependency-groups] | [dependency-groups] | ||||
| dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | ||||
| @@ -22,4 +21,5 @@ dora-pyorbbecksdk = "dora_pyorbbecksdk.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -24,4 +24,5 @@ dora-pyrealsense = "dora_pyrealsense.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -45,4 +45,5 @@ dora-qwen = "dora_qwen.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -35,7 +35,6 @@ dependencies = [ | |||||
| # [tool.uv] | # [tool.uv] | ||||
| # no-build-isolation-package = ['flash-attn'] | # no-build-isolation-package = ['flash-attn'] | ||||
| [dependency-groups] | [dependency-groups] | ||||
| dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | ||||
| @@ -52,4 +51,5 @@ build-backend = "setuptools.build_meta" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -26,7 +26,6 @@ dependencies = [ | |||||
| # flash_attn = "^2.6.1" # Install using: pip install -U flash-attn --no-build-isolation | # flash_attn = "^2.6.1" # Install using: pip install -U flash-attn --no-build-isolation | ||||
| [dependency-groups] | [dependency-groups] | ||||
| dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | ||||
| @@ -39,4 +38,5 @@ dora-qwenvl = "dora_qwenvl.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -29,18 +29,15 @@ dependencies = [ | |||||
| # flash_attn = "^2.6.1" # Install using: pip install -U flash-attn --no-build-isolation | # flash_attn = "^2.6.1" # Install using: pip install -U flash-attn --no-build-isolation | ||||
| [tool.black] | [tool.black] | ||||
| extend-exclude = 'dora_rdt_1b/RoboticsDiffusionTransformer' | extend-exclude = 'dora_rdt_1b/RoboticsDiffusionTransformer' | ||||
| [dependency-groups] | [dependency-groups] | ||||
| dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | ||||
| [project.scripts] | [project.scripts] | ||||
| dora-rdt-1b = "dora_rdt_1b.main:main" | dora-rdt-1b = "dora_rdt_1b.main:main" | ||||
| [tool.ruff] | [tool.ruff] | ||||
| exclude = ["dora_rdt_1b/RoboticsDiffusionTransformer"] | exclude = ["dora_rdt_1b/RoboticsDiffusionTransformer"] | ||||
| @@ -51,4 +48,5 @@ build-backend = "poetry.core.masonry.api" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -1,3 +1,4 @@ | |||||
| """TODO: Add docstring.""" | |||||
| import os | import os | ||||
| import time | import time | ||||
| @@ -8,6 +9,7 @@ from reachy_sdk.trajectory import goto | |||||
| def r_arm_inverse_kinematics(reachy, pose, action) -> list: | def r_arm_inverse_kinematics(reachy, pose, action) -> list: | ||||
| """TODO: Add docstring.""" | |||||
| A = np.array( | A = np.array( | ||||
| [ | [ | ||||
| [0, 0, -1, pose[0] + action[0]], | [0, 0, -1, pose[0] + action[0]], | ||||
| @@ -20,6 +22,7 @@ def r_arm_inverse_kinematics(reachy, pose, action) -> list: | |||||
| def happy_antennas(reachy): | def happy_antennas(reachy): | ||||
| """TODO: Add docstring.""" | |||||
| reachy.head.l_antenna.speed_limit = 480.0 | reachy.head.l_antenna.speed_limit = 480.0 | ||||
| reachy.head.r_antenna.speed_limit = 480.0 | reachy.head.r_antenna.speed_limit = 480.0 | ||||
| @@ -39,6 +42,7 @@ def happy_antennas(reachy): | |||||
| def sad_antennas(reachy): | def sad_antennas(reachy): | ||||
| """TODO: Add docstring.""" | |||||
| reachy.head.l_antenna.speed_limit = 360.0 | reachy.head.l_antenna.speed_limit = 360.0 | ||||
| reachy.head.r_antenna.speed_limit = 360.0 | reachy.head.r_antenna.speed_limit = 360.0 | ||||
| @@ -47,6 +51,7 @@ def sad_antennas(reachy): | |||||
| def main(): | def main(): | ||||
| """TODO: Add docstring.""" | |||||
| node = Node() | node = Node() | ||||
| ROBOT_IP = os.getenv("ROBOT_IP", "10.42.0.24") | ROBOT_IP = os.getenv("ROBOT_IP", "10.42.0.24") | ||||
| @@ -1,3 +1,5 @@ | |||||
| """TODO: Add docstring.""" | |||||
| from reachy_sdk import ReachySDK | from reachy_sdk import ReachySDK | ||||
| import os | import os | ||||
| from dora import Node | from dora import Node | ||||
| @@ -5,7 +7,7 @@ import pyarrow as pa | |||||
| def main(): | def main(): | ||||
| """TODO: Add docstring.""" | |||||
| node = Node() | node = Node() | ||||
| ROBOT_IP = os.getenv("ROBOT_IP", "10.42.0.24") | ROBOT_IP = os.getenv("ROBOT_IP", "10.42.0.24") | ||||
| @@ -26,3 +26,9 @@ dora-reachy1-vision = "dora_reachy1_vision.main:main" | |||||
| [build-system] | [build-system] | ||||
| requires = ["poetry-core>=1.8.0"] | requires = ["poetry-core>=1.8.0"] | ||||
| build-backend = "poetry.core.masonry.api" | build-backend = "poetry.core.masonry.api" | ||||
| [tool.ruff.lint] | |||||
| extend-select = [ | |||||
| "D", # pydocstyle | |||||
| "UP" | |||||
| ] | |||||
| @@ -1,7 +1,10 @@ | |||||
| """TODO: Add docstring.""" | |||||
| # import pytest | # import pytest | ||||
| def test_pass(): | def test_pass(): | ||||
| """TODO: Add docstring.""" | |||||
| pass | pass | ||||
| @@ -1,7 +1,10 @@ | |||||
| """TODO: Add docstring.""" | |||||
| import pytest | import pytest | ||||
| def test_import_main(): | def test_import_main(): | ||||
| """TODO: Add docstring.""" | |||||
| from dora_reachy1_vision.main import main | from dora_reachy1_vision.main import main | ||||
| # Check that everything is working, and catch dora Runtime Exception as we're not running in a dora dataflow. | # Check that everything is working, and catch dora Runtime Exception as we're not running in a dora dataflow. | ||||
| @@ -24,8 +24,8 @@ dora-reachy2-right-arm = "dora_reachy2.right_arm:main" | |||||
| dora-reachy2-mobile-base = "dora_reachy2.mobile_base:main" | dora-reachy2-mobile-base = "dora_reachy2.mobile_base:main" | ||||
| dora-reachy2-head = "dora_reachy2.head:main" | dora-reachy2-head = "dora_reachy2.head:main" | ||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -22,4 +22,5 @@ features = ["python", "pyo3/extension-module"] | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -23,4 +23,5 @@ dora-sam2 = "dora_sam2.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -9,7 +9,6 @@ requires-python = ">=3.8" | |||||
| dependencies = ["dora-rs >= 0.3.9"] | dependencies = ["dora-rs >= 0.3.9"] | ||||
| [dependency-groups] | [dependency-groups] | ||||
| dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | ||||
| @@ -19,4 +18,5 @@ dora-ugv = "dora_ugv.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -9,7 +9,6 @@ requires-python = ">=3.8" | |||||
| dependencies = ["dora-rs >= 0.3.9", "numpy < 2.0.0", "silero-vad >= 5.1"] | dependencies = ["dora-rs >= 0.3.9", "numpy < 2.0.0", "silero-vad >= 5.1"] | ||||
| [dependency-groups] | [dependency-groups] | ||||
| dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | dev = ["pytest >=8.1.1", "ruff >=0.9.1"] | ||||
| @@ -19,4 +18,5 @@ dora-vad = "dora_vad.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -21,4 +21,5 @@ dora-yolo = "dora_yolo.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -0,0 +1 @@ | |||||
| """TODO: Add docstring.""" | |||||
| @@ -1,3 +1,5 @@ | |||||
| """TODO: Add docstring.""" | |||||
| import enum | import enum | ||||
| import pyarrow as pa | import pyarrow as pa | ||||
| @@ -22,8 +24,7 @@ def wrap_joints_and_values( | |||||
| joints: Union[list[str], pa.Array], | joints: Union[list[str], pa.Array], | ||||
| values: Union[int, list[int], pa.Array], | values: Union[int, list[int], pa.Array], | ||||
| ) -> pa.StructArray: | ) -> pa.StructArray: | ||||
| """ | |||||
| Wraps joints and their corresponding values into a structured array. | |||||
| """Wrap joints and their corresponding values into a structured array. | |||||
| :param joints: A list, numpy array, or pyarrow array of joint names. | :param joints: A list, numpy array, or pyarrow array of joint names. | ||||
| :type joints: Union[list[str], np.array, pa.Array] | :type joints: Union[list[str], np.array, pa.Array] | ||||
| @@ -39,7 +40,7 @@ def wrap_joints_and_values( | |||||
| :raises ValueError: If lengths of joints and values do not match. | :raises ValueError: If lengths of joints and values do not match. | ||||
| Example: | Example: | ||||
| -------- | |||||
| ------- | |||||
| joints = ["shoulder_pan", "shoulder_lift", "elbow_flex"] | joints = ["shoulder_pan", "shoulder_lift", "elbow_flex"] | ||||
| values = [100, 200, 300] | values = [100, 200, 300] | ||||
| struct_array = wrap_joints_and_values(joints, values) | struct_array = wrap_joints_and_values(joints, values) | ||||
| @@ -52,8 +53,8 @@ def wrap_joints_and_values( | |||||
| struct_array = wrap_joints_and_values(joints, value) | struct_array = wrap_joints_and_values(joints, value) | ||||
| This example broadcasts the single integer value to all joints and wraps them into a structured array. | This example broadcasts the single integer value to all joints and wraps them into a structured array. | ||||
| """ | |||||
| """ | |||||
| if isinstance(values, int): | if isinstance(values, int): | ||||
| values = [values] * len(joints) | values = [values] * len(joints) | ||||
| @@ -74,11 +75,15 @@ def wrap_joints_and_values( | |||||
| class TorqueMode(enum.Enum): | class TorqueMode(enum.Enum): | ||||
| """TODO: Add docstring.""" | |||||
| ENABLED = pa.scalar(1, pa.uint32()) | ENABLED = pa.scalar(1, pa.uint32()) | ||||
| DISABLED = pa.scalar(0, pa.uint32()) | DISABLED = pa.scalar(0, pa.uint32()) | ||||
| class OperatingMode(enum.Enum): | class OperatingMode(enum.Enum): | ||||
| """TODO: Add docstring.""" | |||||
| VELOCITY = pa.scalar(1, pa.uint32()) | VELOCITY = pa.scalar(1, pa.uint32()) | ||||
| POSITION = pa.scalar(3, pa.uint32()) | POSITION = pa.scalar(3, pa.uint32()) | ||||
| EXTENDED_POSITION = pa.scalar(4, pa.uint32()) | EXTENDED_POSITION = pa.scalar(4, pa.uint32()) | ||||
| @@ -152,8 +157,10 @@ MODEL_CONTROL_TABLE = { | |||||
| class DynamixelBus: | class DynamixelBus: | ||||
| """TODO: Add docstring.""" | |||||
| def __init__(self, port: str, description: dict[str, (int, str)]): | def __init__(self, port: str, description: dict[str, (int, str)]): | ||||
| """TODO: Add docstring.""" | |||||
| self.port = port | self.port = port | ||||
| self.descriptions = description | self.descriptions = description | ||||
| self.motor_ctrl = {} | self.motor_ctrl = {} | ||||
| @@ -184,9 +191,11 @@ class DynamixelBus: | |||||
| self.group_writers = {} | self.group_writers = {} | ||||
| def close(self): | def close(self): | ||||
| """TODO: Add docstring.""" | |||||
| self.port_handler.closePort() | self.port_handler.closePort() | ||||
| def write(self, data_name: str, data: pa.StructArray): | def write(self, data_name: str, data: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| motor_ids = [ | motor_ids = [ | ||||
| self.motor_ctrl[motor_name.as_py()]["id"] | self.motor_ctrl[motor_name.as_py()]["id"] | ||||
| for motor_name in data.field("joints") | for motor_name in data.field("joints") | ||||
| @@ -255,6 +264,7 @@ class DynamixelBus: | |||||
| ) | ) | ||||
| def read(self, data_name: str, motor_names: pa.Array) -> pa.StructArray: | def read(self, data_name: str, motor_names: pa.Array) -> pa.StructArray: | ||||
| """TODO: Add docstring.""" | |||||
| motor_ids = [ | motor_ids = [ | ||||
| self.motor_ctrl[motor_name.as_py()]["id"] for motor_name in motor_names | self.motor_ctrl[motor_name.as_py()]["id"] for motor_name in motor_names | ||||
| ] | ] | ||||
| @@ -298,31 +308,41 @@ class DynamixelBus: | |||||
| return wrap_joints_and_values(motor_names, values) | return wrap_joints_and_values(motor_names, values) | ||||
| def write_torque_enable(self, torque_mode: pa.StructArray): | def write_torque_enable(self, torque_mode: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| self.write("Torque_Enable", torque_mode) | self.write("Torque_Enable", torque_mode) | ||||
| def write_operating_mode(self, operating_mode: pa.StructArray): | def write_operating_mode(self, operating_mode: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| self.write("Operating_Mode", operating_mode) | self.write("Operating_Mode", operating_mode) | ||||
| def read_position(self, motor_names: pa.Array) -> pa.StructArray: | def read_position(self, motor_names: pa.Array) -> pa.StructArray: | ||||
| """TODO: Add docstring.""" | |||||
| return self.read("Present_Position", motor_names) | return self.read("Present_Position", motor_names) | ||||
| def read_velocity(self, motor_names: pa.Array) -> pa.StructArray: | def read_velocity(self, motor_names: pa.Array) -> pa.StructArray: | ||||
| """TODO: Add docstring.""" | |||||
| return self.read("Present_Velocity", motor_names) | return self.read("Present_Velocity", motor_names) | ||||
| def read_current(self, motor_names: pa.Array) -> pa.StructArray: | def read_current(self, motor_names: pa.Array) -> pa.StructArray: | ||||
| """TODO: Add docstring.""" | |||||
| return self.read("Present_Current", motor_names) | return self.read("Present_Current", motor_names) | ||||
| def write_goal_position(self, goal_position: pa.StructArray): | def write_goal_position(self, goal_position: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| self.write("Goal_Position", goal_position) | self.write("Goal_Position", goal_position) | ||||
| def write_goal_current(self, goal_current: pa.StructArray): | def write_goal_current(self, goal_current: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| self.write("Goal_Current", goal_current) | self.write("Goal_Current", goal_current) | ||||
| def write_position_p_gain(self, position_p_gain: pa.StructArray): | def write_position_p_gain(self, position_p_gain: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| self.write("Position_P_Gain", position_p_gain) | self.write("Position_P_Gain", position_p_gain) | ||||
| def write_position_i_gain(self, position_i_gain: pa.StructArray): | def write_position_i_gain(self, position_i_gain: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| self.write("Position_I_Gain", position_i_gain) | self.write("Position_I_Gain", position_i_gain) | ||||
| def write_position_d_gain(self, position_d_gain: pa.StructArray): | def write_position_d_gain(self, position_d_gain: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| self.write("Position_D_Gain", position_d_gain) | self.write("Position_D_Gain", position_d_gain) | ||||
| @@ -1,6 +1,6 @@ | |||||
| """ | |||||
| Dynamixel Client: This node is used to represent a chain of dynamixel motors. It can be used to read positions, | |||||
| velocities, currents, and set goal positions and currents. | |||||
| """Dynamixel Client: This node is used to represent a chain of dynamixel motors. | |||||
| It can be used to read positions, velocities, currents, and set goal positions and currents. | |||||
| """ | """ | ||||
| import os | import os | ||||
| @@ -16,8 +16,10 @@ from .bus import DynamixelBus, TorqueMode, wrap_joints_and_values | |||||
| class Client: | class Client: | ||||
| """TODO: Add docstring.""" | |||||
| def __init__(self, config: dict[str, any]): | def __init__(self, config: dict[str, any]): | ||||
| """TODO: Add docstring.""" | |||||
| self.config = config | self.config = config | ||||
| description = {} | description = {} | ||||
| @@ -45,6 +47,7 @@ class Client: | |||||
| self.node = Node(config["name"]) | self.node = Node(config["name"]) | ||||
| def run(self): | def run(self): | ||||
| """TODO: Add docstring.""" | |||||
| for event in self.node: | for event in self.node: | ||||
| event_type = event["type"] | event_type = event["type"] | ||||
| @@ -68,6 +71,7 @@ class Client: | |||||
| raise ValueError("An error occurred in the dataflow: " + event["error"]) | raise ValueError("An error occurred in the dataflow: " + event["error"]) | ||||
| def close(self): | def close(self): | ||||
| """TODO: Add docstring.""" | |||||
| self.bus.write_torque_enable( | self.bus.write_torque_enable( | ||||
| wrap_joints_and_values( | wrap_joints_and_values( | ||||
| self.config["joints"], | self.config["joints"], | ||||
| @@ -76,6 +80,7 @@ class Client: | |||||
| ) | ) | ||||
| def pull_position(self, node, metadata): | def pull_position(self, node, metadata): | ||||
| """TODO: Add docstring.""" | |||||
| try: | try: | ||||
| node.send_output( | node.send_output( | ||||
| "position", | "position", | ||||
| @@ -87,6 +92,7 @@ class Client: | |||||
| print("Error reading position:", e) | print("Error reading position:", e) | ||||
| def pull_velocity(self, node, metadata): | def pull_velocity(self, node, metadata): | ||||
| """TODO: Add docstring.""" | |||||
| try: | try: | ||||
| node.send_output( | node.send_output( | ||||
| "velocity", | "velocity", | ||||
| @@ -97,6 +103,7 @@ class Client: | |||||
| print("Error reading velocity:", e) | print("Error reading velocity:", e) | ||||
| def pull_current(self, node, metadata): | def pull_current(self, node, metadata): | ||||
| """TODO: Add docstring.""" | |||||
| try: | try: | ||||
| node.send_output( | node.send_output( | ||||
| "current", | "current", | ||||
| @@ -107,12 +114,14 @@ class Client: | |||||
| print("Error reading current:", e) | print("Error reading current:", e) | ||||
| def write_goal_position(self, goal_position: pa.StructArray): | def write_goal_position(self, goal_position: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| try: | try: | ||||
| self.bus.write_goal_position(goal_position) | self.bus.write_goal_position(goal_position) | ||||
| except ConnectionError as e: | except ConnectionError as e: | ||||
| print("Error writing goal position:", e) | print("Error writing goal position:", e) | ||||
| def write_goal_current(self, goal_current: pa.StructArray): | def write_goal_current(self, goal_current: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| try: | try: | ||||
| self.bus.write_goal_current(goal_current) | self.bus.write_goal_current(goal_current) | ||||
| except ConnectionError as e: | except ConnectionError as e: | ||||
| @@ -120,7 +129,7 @@ class Client: | |||||
| def main(): | def main(): | ||||
| # Handle dynamic nodes, ask for the name of the node in the dataflow | |||||
| """Handle dynamic nodes, ask for the name of the node in the dataflow.""" | |||||
| parser = argparse.ArgumentParser( | parser = argparse.ArgumentParser( | ||||
| description="Dynamixel Client: This node is used to represent a chain of dynamixel motors. It can be used to " | description="Dynamixel Client: This node is used to represent a chain of dynamixel motors. It can be used to " | ||||
| "read positions, velocities, currents, and set goal positions and currents." | "read positions, velocities, currents, and set goal positions and currents." | ||||
| @@ -21,3 +21,9 @@ dynamixel-client = "dynamixel_client.main:main" | |||||
| [build-system] | [build-system] | ||||
| requires = ["poetry-core>=1.8.0"] | requires = ["poetry-core>=1.8.0"] | ||||
| build-backend = "poetry.core.masonry.api" | build-backend = "poetry.core.masonry.api" | ||||
| [tool.ruff.lint] | |||||
| extend-select = [ | |||||
| "D", # pydocstyle | |||||
| "UP" | |||||
| ] | |||||
| @@ -1,7 +1,9 @@ | |||||
| """TODO: Add docstring.""" | |||||
| # import pytest | # import pytest | ||||
| def test_pass(): | def test_pass(): | ||||
| """TODO: Add docstring.""" | |||||
| pass | pass | ||||
| @@ -0,0 +1 @@ | |||||
| """TODO: Add docstring.""" | |||||
| @@ -1,3 +1,4 @@ | |||||
| """TODO: Add docstring.""" | |||||
| import enum | import enum | ||||
| from typing import Union | from typing import Union | ||||
| @@ -24,6 +25,7 @@ def wrap_joints_and_values( | |||||
| joints: Union[list[str], pa.Array], | joints: Union[list[str], pa.Array], | ||||
| values: Union[list[int], pa.Array], | values: Union[list[int], pa.Array], | ||||
| ) -> pa.StructArray: | ) -> pa.StructArray: | ||||
| """TODO: Add docstring.""" | |||||
| return pa.StructArray.from_arrays( | return pa.StructArray.from_arrays( | ||||
| arrays=[joints, values], | arrays=[joints, values], | ||||
| names=["joints", "values"], | names=["joints", "values"], | ||||
| @@ -31,11 +33,15 @@ def wrap_joints_and_values( | |||||
| class TorqueMode(enum.Enum): | class TorqueMode(enum.Enum): | ||||
| """TODO: Add docstring.""" | |||||
| ENABLED = pa.scalar(1, pa.uint32()) | ENABLED = pa.scalar(1, pa.uint32()) | ||||
| DISABLED = pa.scalar(0, pa.uint32()) | DISABLED = pa.scalar(0, pa.uint32()) | ||||
| class OperatingMode(enum.Enum): | class OperatingMode(enum.Enum): | ||||
| """TODO: Add docstring.""" | |||||
| ONE_TURN = pa.scalar(0, pa.uint32()) | ONE_TURN = pa.scalar(0, pa.uint32()) | ||||
| @@ -93,15 +99,16 @@ MODEL_CONTROL_TABLE = { | |||||
| class FeetechBus: | class FeetechBus: | ||||
| """TODO: Add docstring.""" | |||||
| def __init__(self, port: str, description: dict[str, (np.uint8, str)]): | def __init__(self, port: str, description: dict[str, (np.uint8, str)]): | ||||
| """ | |||||
| Args: | |||||
| port: the serial port to connect to the Feetech bus | |||||
| description: a dictionary containing the description of the motors connected to the bus. The keys are the | |||||
| motor names and the values are tuples containing the motor id and the motor model. | |||||
| """ | |||||
| """Args:-. | |||||
| port: the serial port to connect to the Feetech bus | |||||
| description: a dictionary containing the description of the motors connected to the bus. The keys are the | |||||
| motor names and the values are tuples containing the motor id and the motor model. | |||||
| """ | |||||
| self.port = port | self.port = port | ||||
| self.descriptions = description | self.descriptions = description | ||||
| self.motor_ctrl = {} | self.motor_ctrl = {} | ||||
| @@ -132,9 +139,11 @@ class FeetechBus: | |||||
| self.group_writers = {} | self.group_writers = {} | ||||
| def close(self): | def close(self): | ||||
| """TODO: Add docstring.""" | |||||
| self.port_handler.closePort() | self.port_handler.closePort() | ||||
| def write(self, data_name: str, data: pa.StructArray): | def write(self, data_name: str, data: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| motor_ids = [ | motor_ids = [ | ||||
| self.motor_ctrl[motor_name.as_py()]["id"] | self.motor_ctrl[motor_name.as_py()]["id"] | ||||
| for motor_name in data.field("joints") | for motor_name in data.field("joints") | ||||
| @@ -201,6 +210,7 @@ class FeetechBus: | |||||
| ) | ) | ||||
| def read(self, data_name: str, motor_names: pa.Array) -> pa.StructArray: | def read(self, data_name: str, motor_names: pa.Array) -> pa.StructArray: | ||||
| """TODO: Add docstring.""" | |||||
| motor_ids = [ | motor_ids = [ | ||||
| self.motor_ctrl[motor_name.as_py()]["id"] for motor_name in motor_names | self.motor_ctrl[motor_name.as_py()]["id"] for motor_name in motor_names | ||||
| ] | ] | ||||
| @@ -251,25 +261,33 @@ class FeetechBus: | |||||
| return wrap_joints_and_values(motor_names, values) | return wrap_joints_and_values(motor_names, values) | ||||
| def write_torque_enable(self, torque_mode: pa.StructArray): | def write_torque_enable(self, torque_mode: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| self.write("Torque_Enable", torque_mode) | self.write("Torque_Enable", torque_mode) | ||||
| def write_operating_mode(self, operating_mode: pa.StructArray): | def write_operating_mode(self, operating_mode: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| self.write("Mode", operating_mode) | self.write("Mode", operating_mode) | ||||
| def read_position(self, motor_names: pa.Array) -> pa.StructArray: | def read_position(self, motor_names: pa.Array) -> pa.StructArray: | ||||
| """TODO: Add docstring.""" | |||||
| return self.read("Present_Position", motor_names) | return self.read("Present_Position", motor_names) | ||||
| def read_velocity(self, motor_names: pa.Array) -> pa.StructArray: | def read_velocity(self, motor_names: pa.Array) -> pa.StructArray: | ||||
| """TODO: Add docstring.""" | |||||
| return self.read("Present_Velocity", motor_names) | return self.read("Present_Velocity", motor_names) | ||||
| def read_current(self, motor_names: pa.Array) -> pa.StructArray: | def read_current(self, motor_names: pa.Array) -> pa.StructArray: | ||||
| """TODO: Add docstring.""" | |||||
| return self.read("Present_Current", motor_names) | return self.read("Present_Current", motor_names) | ||||
| def write_goal_position(self, goal_position: pa.StructArray): | def write_goal_position(self, goal_position: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| self.write("Goal_Position", goal_position) | self.write("Goal_Position", goal_position) | ||||
| def write_max_angle_limit(self, max_angle_limit: pa.StructArray): | def write_max_angle_limit(self, max_angle_limit: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| self.write("Max_Angle_Limit", max_angle_limit) | self.write("Max_Angle_Limit", max_angle_limit) | ||||
| def write_min_angle_limit(self, min_angle_limit: pa.StructArray): | def write_min_angle_limit(self, min_angle_limit: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| self.write("Min_Angle_Limit", min_angle_limit) | self.write("Min_Angle_Limit", min_angle_limit) | ||||
| @@ -1,7 +1,4 @@ | |||||
| """ | |||||
| Feetech Client: This node is used to represent a chain of feetech motors. It can be used to read positions, | |||||
| velocities, currents, and set goal positions and currents. | |||||
| """ | |||||
| """Feetech Client: This node is used to represent a chain of feetech motors. It can be used to read positions, velocities, currents, and set goal positions and currents.""" | |||||
| import os | import os | ||||
| import argparse | import argparse | ||||
| @@ -15,8 +12,10 @@ from .bus import FeetechBus, TorqueMode, wrap_joints_and_values | |||||
| class Client: | class Client: | ||||
| """TODO: Add docstring.""" | |||||
| def __init__(self, config: dict[str, any]): | def __init__(self, config: dict[str, any]): | ||||
| """TODO: Add docstring.""" | |||||
| self.config = config | self.config = config | ||||
| description = {} | description = {} | ||||
| @@ -34,6 +33,7 @@ class Client: | |||||
| self.node = Node(config["name"]) | self.node = Node(config["name"]) | ||||
| def run(self): | def run(self): | ||||
| """TODO: Add docstring.""" | |||||
| for event in self.node: | for event in self.node: | ||||
| event_type = event["type"] | event_type = event["type"] | ||||
| @@ -55,6 +55,7 @@ class Client: | |||||
| raise ValueError("An error occurred in the dataflow: " + event["error"]) | raise ValueError("An error occurred in the dataflow: " + event["error"]) | ||||
| def close(self): | def close(self): | ||||
| """TODO: Add docstring.""" | |||||
| self.bus.write_torque_enable( | self.bus.write_torque_enable( | ||||
| wrap_joints_and_values( | wrap_joints_and_values( | ||||
| self.config["joints"], | self.config["joints"], | ||||
| @@ -63,6 +64,7 @@ class Client: | |||||
| ) | ) | ||||
| def pull_position(self, node, metadata): | def pull_position(self, node, metadata): | ||||
| """TODO: Add docstring.""" | |||||
| try: | try: | ||||
| node.send_output( | node.send_output( | ||||
| "position", | "position", | ||||
| @@ -74,6 +76,7 @@ class Client: | |||||
| print("Error reading position:", e) | print("Error reading position:", e) | ||||
| def pull_velocity(self, node, metadata): | def pull_velocity(self, node, metadata): | ||||
| """TODO: Add docstring.""" | |||||
| try: | try: | ||||
| node.send_output( | node.send_output( | ||||
| "velocity", | "velocity", | ||||
| @@ -84,6 +87,7 @@ class Client: | |||||
| print("Error reading velocity:", e) | print("Error reading velocity:", e) | ||||
| def pull_current(self, node, metadata): | def pull_current(self, node, metadata): | ||||
| """TODO: Add docstring.""" | |||||
| try: | try: | ||||
| node.send_output( | node.send_output( | ||||
| "current", | "current", | ||||
| @@ -94,6 +98,7 @@ class Client: | |||||
| print("Error reading current:", e) | print("Error reading current:", e) | ||||
| def write_goal_position(self, goal_position: pa.StructArray): | def write_goal_position(self, goal_position: pa.StructArray): | ||||
| """TODO: Add docstring.""" | |||||
| try: | try: | ||||
| self.bus.write_goal_position(goal_position) | self.bus.write_goal_position(goal_position) | ||||
| except ConnectionError as e: | except ConnectionError as e: | ||||
| @@ -101,7 +106,7 @@ class Client: | |||||
| def main(): | def main(): | ||||
| # Handle dynamic nodes, ask for the name of the node in the dataflow | |||||
| """Handle dynamic nodes, ask for the name of the node in the dataflow.""" | |||||
| parser = argparse.ArgumentParser( | parser = argparse.ArgumentParser( | ||||
| description="Feetech Client: This node is used to represent a chain of feetech motors. " | description="Feetech Client: This node is used to represent a chain of feetech motors. " | ||||
| "It can be used to read " | "It can be used to read " | ||||
| @@ -7,7 +7,6 @@ license = { text = "MIT" } | |||||
| readme = "README.md" | readme = "README.md" | ||||
| requires-python = ">=3.9" | requires-python = ">=3.9" | ||||
| dependencies = [ | dependencies = [ | ||||
| "dora-rs == 0.3.5", | "dora-rs == 0.3.5", | ||||
| "numpy <= 2.0.0", | "numpy <= 2.0.0", | ||||
| @@ -23,3 +22,9 @@ feetech-client = "feetech_client.main:main" | |||||
| [build-system] | [build-system] | ||||
| requires = ["poetry-core>=1.8.0"] | requires = ["poetry-core>=1.8.0"] | ||||
| build-backend = "poetry.core.masonry.api" | build-backend = "poetry.core.masonry.api" | ||||
| [tool.ruff.lint] | |||||
| extend-select = [ | |||||
| "D", # pydocstyle | |||||
| "UP" | |||||
| ] | |||||
| @@ -1,7 +1,9 @@ | |||||
| """TODO: Add docstring.""" | |||||
| # import pytest | # import pytest | ||||
| def test_pass(): | def test_pass(): | ||||
| """TODO: Add docstring.""" | |||||
| pass | pass | ||||
| @@ -1,3 +1,4 @@ | |||||
| """TODO: Add docstring.""" | |||||
| import lebai_sdk | import lebai_sdk | ||||
| import numpy as np | import numpy as np | ||||
| from dora import Node | from dora import Node | ||||
| @@ -9,7 +10,7 @@ import time | |||||
| def load_json_file(file_path): | def load_json_file(file_path): | ||||
| """Load JSON file and return the dictionary.""" | """Load JSON file and return the dictionary.""" | ||||
| if os.path.exists(file_path): | if os.path.exists(file_path): | ||||
| with open(file_path, "r") as file: | |||||
| with open(file_path) as file: | |||||
| data = json.load(file) | data = json.load(file) | ||||
| else: | else: | ||||
| # Return an empty dictionary if file does not exist | # Return an empty dictionary if file does not exist | ||||
| @@ -32,6 +33,7 @@ ROBOT_IP = os.getenv( | |||||
| def main(): | def main(): | ||||
| """TODO: Add docstring.""" | |||||
| # Load the JSON file | # Load the JSON file | ||||
| pose_library = load_json_file(SAVED_POSE_PATH) | pose_library = load_json_file(SAVED_POSE_PATH) | ||||
| lebai = lebai_sdk.connect(ROBOT_IP, False) # 创建实例 | lebai = lebai_sdk.connect(ROBOT_IP, False) # 创建实例 | ||||
| @@ -21,3 +21,9 @@ lebai-client = "lebai_client.main:main" | |||||
| [build-system] | [build-system] | ||||
| requires = ["poetry-core>=1.8.0"] | requires = ["poetry-core>=1.8.0"] | ||||
| build-backend = "poetry.core.masonry.api" | build-backend = "poetry.core.masonry.api" | ||||
| [tool.ruff.lint] | |||||
| extend-select = [ | |||||
| "D", # pydocstyle | |||||
| "UP" | |||||
| ] | |||||
| @@ -1,3 +1,4 @@ | |||||
| """TODO: Add docstring.""" | |||||
| import lebai_sdk | import lebai_sdk | ||||
| @@ -5,6 +6,7 @@ lebai_sdk.init() | |||||
| def main(): | def main(): | ||||
| """TODO: Add docstring.""" | |||||
| # print(lebai_sdk.discover_devices(2)) #发现同一局域网内的机器人 | # print(lebai_sdk.discover_devices(2)) #发现同一局域网内的机器人 | ||||
| robot_ip = "10.20.17.1" # 设定机器人ip地址,需要根据机器人实际ip地址修改 | robot_ip = "10.20.17.1" # 设定机器人ip地址,需要根据机器人实际ip地址修改 | ||||
| @@ -1,7 +1,9 @@ | |||||
| """TODO: Add docstring.""" | |||||
| # import pytest | # import pytest | ||||
| def test_pass(): | def test_pass(): | ||||
| """TODO: Add docstring.""" | |||||
| pass | pass | ||||
| @@ -0,0 +1 @@ | |||||
| """TODO: Add docstring.""" | |||||
| @@ -1,6 +1,4 @@ | |||||
| """ | |||||
| This Dora node is a minimalistic interface that shows two images and text in a Pygame window. | |||||
| """ | |||||
| """Following Dora node is a minimalistic interface that shows two images and text in a Pygame window.""" | |||||
| import os | import os | ||||
| import argparse | import argparse | ||||
| @@ -13,7 +11,7 @@ from dora import Node | |||||
| def main(): | def main(): | ||||
| # Handle dynamic nodes, ask for the name of the node in the dataflow | |||||
| """Handle dynamic nodes, ask for the name of the node in the dataflow.""" | |||||
| parser = argparse.ArgumentParser( | parser = argparse.ArgumentParser( | ||||
| description="LeRobot Record: This node is used to record episodes of a robot interacting with the environment." | description="LeRobot Record: This node is used to record episodes of a robot interacting with the environment." | ||||
| ) | ) | ||||
| @@ -23,3 +23,9 @@ lerobot-dashboard = "lerobot_dashboard.main:main" | |||||
| [build-system] | [build-system] | ||||
| requires = ["poetry-core>=1.8.0"] | requires = ["poetry-core>=1.8.0"] | ||||
| build-backend = "poetry.core.masonry.api" | build-backend = "poetry.core.masonry.api" | ||||
| [tool.ruff.lint] | |||||
| extend-select = [ | |||||
| "D", # pydocstyle | |||||
| "UP" | |||||
| ] | |||||
| @@ -1,7 +1,9 @@ | |||||
| """TODO: Add docstring.""" | |||||
| # import pytest | # import pytest | ||||
| def test_pass(): | def test_pass(): | ||||
| """TODO: Add docstring.""" | |||||
| pass | pass | ||||
| @@ -7,7 +7,6 @@ authors = [ | |||||
| ] | ] | ||||
| description = "Dora Node for VLM" | description = "Dora Node for VLM" | ||||
| requires-python = ">=3.8" | requires-python = ">=3.8" | ||||
| dependencies = [ | dependencies = [ | ||||
| @@ -25,4 +24,5 @@ llama-factory-recorder = "llama_factory_recorder.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -0,0 +1 @@ | |||||
| """TODO: Add docstring.""" | |||||
| @@ -1,7 +1,4 @@ | |||||
| """ | |||||
| Mujoco Client: This node is used to represent simulated robot, it can be used to read virtual positions, | |||||
| or can be controlled | |||||
| """ | |||||
| """Mujoco Client: This node is used to represent simulated robot, it can be used to read virtual positions, or can be controlled.""" | |||||
| import os | import os | ||||
| import argparse | import argparse | ||||
| @@ -17,8 +14,10 @@ import mujoco.viewer | |||||
| class Client: | class Client: | ||||
| """TODO: Add docstring.""" | |||||
| def __init__(self, config: dict[str, any]): | def __init__(self, config: dict[str, any]): | ||||
| """TODO: Add docstring.""" | |||||
| self.config = config | self.config = config | ||||
| self.m = mujoco.MjModel.from_xml_path(filename=config["scene"]) | self.m = mujoco.MjModel.from_xml_path(filename=config["scene"]) | ||||
| @@ -27,6 +26,7 @@ class Client: | |||||
| self.node = Node(config["name"]) | self.node = Node(config["name"]) | ||||
| def run(self): | def run(self): | ||||
| """TODO: Add docstring.""" | |||||
| with mujoco.viewer.launch_passive(self.m, self.data) as viewer: | with mujoco.viewer.launch_passive(self.m, self.data) as viewer: | ||||
| for event in self.node: | for event in self.node: | ||||
| event_type = event["type"] | event_type = event["type"] | ||||
| @@ -72,15 +72,19 @@ class Client: | |||||
| self.node.send_output("end", pa.array([])) | self.node.send_output("end", pa.array([])) | ||||
| def pull_position(self, node, metadata): | def pull_position(self, node, metadata): | ||||
| """TODO: Add docstring.""" | |||||
| pass | pass | ||||
| def pull_velocity(self, node, metadata): | def pull_velocity(self, node, metadata): | ||||
| """TODO: Add docstring.""" | |||||
| pass | pass | ||||
| def pull_current(self, node, metadata): | def pull_current(self, node, metadata): | ||||
| """TODO: Add docstring.""" | |||||
| pass | pass | ||||
| def write_goal_position(self, goal_position_with_joints): | def write_goal_position(self, goal_position_with_joints): | ||||
| """TODO: Add docstring.""" | |||||
| joints = goal_position_with_joints.field("joints") | joints = goal_position_with_joints.field("joints") | ||||
| goal_position = goal_position_with_joints.field("values") | goal_position = goal_position_with_joints.field("values") | ||||
| @@ -89,7 +93,7 @@ class Client: | |||||
| def main(): | def main(): | ||||
| # Handle dynamic nodes, ask for the name of the node in the dataflow | |||||
| """Handle dynamic nodes, ask for the name of the node in the dataflow.""" | |||||
| parser = argparse.ArgumentParser( | parser = argparse.ArgumentParser( | ||||
| description="MujoCo Client: This node is used to represent a MuJoCo simulation. It can be used instead of a " | description="MujoCo Client: This node is used to represent a MuJoCo simulation. It can be used instead of a " | ||||
| "follower arm to test the dataflow." | "follower arm to test the dataflow." | ||||
| @@ -22,3 +22,9 @@ mujoco-client = "mujoco_client.main:main" | |||||
| [build-system] | [build-system] | ||||
| requires = ["poetry-core>=1.8.0"] | requires = ["poetry-core>=1.8.0"] | ||||
| build-backend = "poetry.core.masonry.api" | build-backend = "poetry.core.masonry.api" | ||||
| [tool.ruff.lint] | |||||
| extend-select = [ | |||||
| "D", # pydocstyle | |||||
| "UP" | |||||
| ] | |||||
| @@ -1,7 +1,9 @@ | |||||
| """TODO: Add docstring.""" | |||||
| # import pytest | # import pytest | ||||
| def test_pass(): | def test_pass(): | ||||
| """TODO: Add docstring.""" | |||||
| pass | pass | ||||
| @@ -7,7 +7,6 @@ authors = [ | |||||
| ] | ] | ||||
| description = "Dora Node for plotting text and bbox on image with OpenCV" | description = "Dora Node for plotting text and bbox on image with OpenCV" | ||||
| requires-python = ">=3.8" | requires-python = ">=3.8" | ||||
| dependencies = ["dora-rs >= 0.3.9", "numpy < 2.0.0", "opencv-python >= 4.1.1"] | dependencies = ["dora-rs >= 0.3.9", "numpy < 2.0.0", "opencv-python >= 4.1.1"] | ||||
| @@ -21,4 +20,5 @@ opencv-plot = "opencv_plot.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -21,4 +21,5 @@ opencv-video-capture = "opencv_video_capture.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -22,4 +22,5 @@ pyarrow-assert = "pyarrow_assert.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -9,7 +9,6 @@ description = "Dora pyarrow Sender" | |||||
| license = { text = "MIT" } | license = { text = "MIT" } | ||||
| readme = "README.md" | readme = "README.md" | ||||
| requires-python = ">=3.8" | requires-python = ">=3.8" | ||||
| dependencies = ["dora-rs >= 0.3.9", "numpy < 2.0.0", "pyarrow >= 5.0.0"] | dependencies = ["dora-rs >= 0.3.9", "numpy < 2.0.0", "pyarrow >= 5.0.0"] | ||||
| @@ -23,4 +22,5 @@ pyarrow-sender = "pyarrow_sender.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -21,3 +21,9 @@ replay-client = "replay_client.main:main" | |||||
| [build-system] | [build-system] | ||||
| requires = ["poetry-core>=1.8.0"] | requires = ["poetry-core>=1.8.0"] | ||||
| build-backend = "poetry.core.masonry.api" | build-backend = "poetry.core.masonry.api" | ||||
| [tool.ruff.lint] | |||||
| extend-select = [ | |||||
| "D", # pydocstyle | |||||
| "UP" | |||||
| ] | |||||
| @@ -0,0 +1 @@ | |||||
| """TODO: Add docstring.""" | |||||
| @@ -1,5 +1,5 @@ | |||||
| """ | |||||
| Replay Client: This node is used to represent a leader robot and send a sequence of goals to the dataflow, | |||||
| """Replay Client: This node is used to represent a leader robot and send a sequence of goals to the dataflow,. | |||||
| reading a dataset of actions and joints from a specific episode. | reading a dataset of actions and joints from a specific episode. | ||||
| """ | """ | ||||
| @@ -13,6 +13,7 @@ from dora import Node | |||||
| def joints_values_to_arrow(joints, values): | def joints_values_to_arrow(joints, values): | ||||
| """TODO: Add docstring.""" | |||||
| return pa.StructArray.from_arrays( | return pa.StructArray.from_arrays( | ||||
| arrays=[joints, values], | arrays=[joints, values], | ||||
| names=["joints", "values"], | names=["joints", "values"], | ||||
| @@ -23,8 +24,10 @@ def joints_values_to_arrow(joints, values): | |||||
| class Client: | class Client: | ||||
| """TODO: Add docstring.""" | |||||
| def __init__(self, config: dict[str, any]): | def __init__(self, config: dict[str, any]): | ||||
| """TODO: Add docstring.""" | |||||
| self.config = config | self.config = config | ||||
| self.node = Node(config["name"]) | self.node = Node(config["name"]) | ||||
| @@ -39,6 +42,7 @@ class Client: | |||||
| self.frame = 0 | self.frame = 0 | ||||
| def run(self): | def run(self): | ||||
| """TODO: Add docstring.""" | |||||
| for event in self.node: | for event in self.node: | ||||
| event_type = event["type"] | event_type = event["type"] | ||||
| @@ -57,6 +61,7 @@ class Client: | |||||
| self.node.send_output("end", pa.array([])) | self.node.send_output("end", pa.array([])) | ||||
| def pull_position(self, node, metadata) -> bool: | def pull_position(self, node, metadata) -> bool: | ||||
| """TODO: Add docstring.""" | |||||
| if self.frame >= len(self.action): | if self.frame >= len(self.action): | ||||
| return True | return True | ||||
| @@ -71,7 +76,7 @@ class Client: | |||||
| def main(): | def main(): | ||||
| # Handle dynamic nodes, ask for the name of the node in the dataflow | |||||
| """Handle dynamic nodes, ask for the name of the node in the dataflow.""" | |||||
| parser = argparse.ArgumentParser( | parser = argparse.ArgumentParser( | ||||
| description="Replay Client: This node is used to replay a sequence of goals for a followee robot." | description="Replay Client: This node is used to replay a sequence of goals for a followee robot." | ||||
| ) | ) | ||||
| @@ -1,7 +1,9 @@ | |||||
| """TODO: Add docstring.""" | |||||
| # import pytest | # import pytest | ||||
| def test_pass(): | def test_pass(): | ||||
| """TODO: Add docstring.""" | |||||
| pass | pass | ||||
| @@ -9,7 +9,6 @@ description = "Dora terminal input" | |||||
| license = { text = "MIT" } | license = { text = "MIT" } | ||||
| readme = "README.md" | readme = "README.md" | ||||
| requires-python = ">=3.8" | requires-python = ">=3.8" | ||||
| dependencies = ["dora-rs >= 0.3.9", "numpy < 2.0.0", "pyarrow >= 5.0.0"] | dependencies = ["dora-rs >= 0.3.9", "numpy < 2.0.0", "pyarrow >= 5.0.0"] | ||||
| @@ -23,4 +22,5 @@ terminal-input = "terminal_input.main:main" | |||||
| [tool.ruff.lint] | [tool.ruff.lint] | ||||
| extend-select = [ | extend-select = [ | ||||
| "D", # pydocstyle | "D", # pydocstyle | ||||
| "UP", | |||||
| ] | ] | ||||
| @@ -23,3 +23,9 @@ video-encoder = "video_encoder.main:main" | |||||
| [build-system] | [build-system] | ||||
| requires = ["poetry-core>=1.8.0"] | requires = ["poetry-core>=1.8.0"] | ||||
| build-backend = "poetry.core.masonry.api" | build-backend = "poetry.core.masonry.api" | ||||
| [tool.ruff.lint] | |||||
| extend-select = [ | |||||
| "D", # pydocstyle | |||||
| "UP" | |||||
| ] | |||||
| @@ -1,7 +1,9 @@ | |||||
| """TODO: Add docstring.""" | |||||
| # import pytest | # import pytest | ||||
| def test_pass(): | def test_pass(): | ||||
| """TODO: Add docstring.""" | |||||
| pass | pass | ||||
| @@ -0,0 +1 @@ | |||||
| """TODO: Doc String.""" | |||||
| @@ -1,3 +1,4 @@ | |||||
| """TODO : Doc String.""" | |||||
| import os | import os | ||||
| from pathlib import Path | from pathlib import Path | ||||
| @@ -12,7 +13,7 @@ from ffmpeg import FFmpeg | |||||
| def main(): | def main(): | ||||
| # Handle dynamic nodes, ask for the name of the node in the dataflow | |||||
| """Handle dynamic nodes, ask for the name of the node in the dataflow.""" | |||||
| parser = argparse.ArgumentParser( | parser = argparse.ArgumentParser( | ||||
| description="Video Encoder: This node is used to record episodes of a robot interacting with the environment." | description="Video Encoder: This node is used to record episodes of a robot interacting with the environment." | ||||
| ) | ) | ||||