r1-python-sdk 0.2.0__py3-none-any.whl

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.
@@ -0,0 +1,22 @@
1
+ """Python SDK for the Richtech R1 robotic arm.
2
+
3
+ from r1_python_sdk import R1API, R1State
4
+ arm = R1API(port="COM5")
5
+ code = arm.motion_enable(True)
6
+ code, angles = arm.get_servo_angle()
7
+ """
8
+
9
+ from .api import R1API, JointState
10
+ from .code import ArmMode, ArmState, R1Error, R1State, R1Warn
11
+ from .config import R1Config
12
+ from .protocol import BoardEvent, BoardStatus, BoardVersion, GripperStatus
13
+ from .utils import find_bottom_board_ports
14
+ from .version import __version__
15
+
16
+ __all__ = [
17
+ "R1API", "JointState", "R1Config",
18
+ "R1State", "ArmState", "ArmMode", "R1Error", "R1Warn",
19
+ "BoardStatus", "BoardEvent", "BoardVersion", "GripperStatus",
20
+ "find_bottom_board_ports",
21
+ "__version__",
22
+ ]
r1_python_sdk/api.py ADDED
@@ -0,0 +1,40 @@
1
+ """R1API: the public facade that combines the feature mixins into one class.
2
+
3
+ Typical use::
4
+
5
+ from r1_python_sdk import R1API
6
+
7
+ with R1API(port="COM5") as arm: # omit port to auto-detect the bottom board's CDC port
8
+ arm.motion_enable(True)
9
+ arm.set_servo_angle([0, -30, 60, 0, 30, 0], speed=30, wait=True)
10
+ arm.close_gripper(wait=True)
11
+ code, q = arm.get_servo_angle()
12
+
13
+ All set APIs return a code, all get APIs return (code, value); codes are in r1_python_sdk.code.R1State.
14
+ Angles are degrees by default (is_radian=False).
15
+
16
+ API groups (one file each, all subclasses of Base; R1API combines them via multiple inheritance):
17
+ base.py connection, enable / mode / state / errors, E-stop, callbacks, start_control_loop
18
+ servo.py set_servo_angle / set_servo_angle_j / vc_set_joint_velocity / get_* / set_joint_zero / registers
19
+ gripper.py set_gripper_position / open / close / get_* / set_gripper_init
20
+ board.py get_board_state / get_end_button_state / get_trajectory_info (read-only; teach / replay are driven by the end-effector buttons)
21
+ kinematics.py Cartesian: get_position / straight-line set_position / FK / IK / TCP offset (numpy kin/ package)
22
+ """
23
+
24
+ from __future__ import annotations
25
+
26
+ from .base import JointState
27
+ from .board import Board
28
+ from .gripper import Gripper
29
+ from .kinematics import Kinematics
30
+ from .servo import Servo
31
+
32
+ __all__ = ["R1API", "JointState"]
33
+
34
+
35
+ class R1API(Servo, Gripper, Board, Kinematics):
36
+ """Richtech R1 robotic arm."""
37
+
38
+ def __repr__(self) -> str:
39
+ return (f"R1API(port={self._port!r}, connected={self.connected}, "
40
+ f"enabled={self._enabled}, mode={self._mode}, state={self.state})")