dexcontrol 0.2.1__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.

Potentially problematic release.


This version of dexcontrol might be problematic. Click here for more details.

Files changed (72) hide show
  1. dexcontrol/__init__.py +45 -0
  2. dexcontrol/apps/dualsense_teleop_base.py +371 -0
  3. dexcontrol/config/__init__.py +14 -0
  4. dexcontrol/config/core/__init__.py +22 -0
  5. dexcontrol/config/core/arm.py +32 -0
  6. dexcontrol/config/core/chassis.py +22 -0
  7. dexcontrol/config/core/hand.py +42 -0
  8. dexcontrol/config/core/head.py +33 -0
  9. dexcontrol/config/core/misc.py +37 -0
  10. dexcontrol/config/core/torso.py +36 -0
  11. dexcontrol/config/sensors/__init__.py +4 -0
  12. dexcontrol/config/sensors/cameras/__init__.py +7 -0
  13. dexcontrol/config/sensors/cameras/gemini_camera.py +16 -0
  14. dexcontrol/config/sensors/cameras/rgb_camera.py +15 -0
  15. dexcontrol/config/sensors/imu/__init__.py +6 -0
  16. dexcontrol/config/sensors/imu/gemini_imu.py +15 -0
  17. dexcontrol/config/sensors/imu/nine_axis_imu.py +15 -0
  18. dexcontrol/config/sensors/lidar/__init__.py +6 -0
  19. dexcontrol/config/sensors/lidar/rplidar.py +15 -0
  20. dexcontrol/config/sensors/ultrasonic/__init__.py +6 -0
  21. dexcontrol/config/sensors/ultrasonic/ultrasonic.py +15 -0
  22. dexcontrol/config/sensors/vega_sensors.py +65 -0
  23. dexcontrol/config/vega.py +203 -0
  24. dexcontrol/core/__init__.py +0 -0
  25. dexcontrol/core/arm.py +324 -0
  26. dexcontrol/core/chassis.py +628 -0
  27. dexcontrol/core/component.py +834 -0
  28. dexcontrol/core/hand.py +170 -0
  29. dexcontrol/core/head.py +232 -0
  30. dexcontrol/core/misc.py +514 -0
  31. dexcontrol/core/torso.py +198 -0
  32. dexcontrol/proto/dexcontrol_msg_pb2.py +69 -0
  33. dexcontrol/proto/dexcontrol_msg_pb2.pyi +168 -0
  34. dexcontrol/proto/dexcontrol_query_pb2.py +73 -0
  35. dexcontrol/proto/dexcontrol_query_pb2.pyi +134 -0
  36. dexcontrol/robot.py +1091 -0
  37. dexcontrol/sensors/__init__.py +40 -0
  38. dexcontrol/sensors/camera/__init__.py +18 -0
  39. dexcontrol/sensors/camera/gemini_camera.py +139 -0
  40. dexcontrol/sensors/camera/rgb_camera.py +98 -0
  41. dexcontrol/sensors/imu/__init__.py +22 -0
  42. dexcontrol/sensors/imu/gemini_imu.py +139 -0
  43. dexcontrol/sensors/imu/nine_axis_imu.py +149 -0
  44. dexcontrol/sensors/lidar/__init__.py +3 -0
  45. dexcontrol/sensors/lidar/rplidar.py +164 -0
  46. dexcontrol/sensors/manager.py +185 -0
  47. dexcontrol/sensors/ultrasonic.py +110 -0
  48. dexcontrol/utils/__init__.py +15 -0
  49. dexcontrol/utils/constants.py +12 -0
  50. dexcontrol/utils/io_utils.py +26 -0
  51. dexcontrol/utils/motion_utils.py +194 -0
  52. dexcontrol/utils/os_utils.py +39 -0
  53. dexcontrol/utils/pb_utils.py +103 -0
  54. dexcontrol/utils/rate_limiter.py +167 -0
  55. dexcontrol/utils/reset_orbbec_camera_usb.py +98 -0
  56. dexcontrol/utils/subscribers/__init__.py +44 -0
  57. dexcontrol/utils/subscribers/base.py +260 -0
  58. dexcontrol/utils/subscribers/camera.py +328 -0
  59. dexcontrol/utils/subscribers/decoders.py +83 -0
  60. dexcontrol/utils/subscribers/generic.py +105 -0
  61. dexcontrol/utils/subscribers/imu.py +170 -0
  62. dexcontrol/utils/subscribers/lidar.py +195 -0
  63. dexcontrol/utils/subscribers/protobuf.py +106 -0
  64. dexcontrol/utils/timer.py +136 -0
  65. dexcontrol/utils/trajectory_utils.py +40 -0
  66. dexcontrol/utils/viz_utils.py +86 -0
  67. dexcontrol-0.2.1.dist-info/METADATA +369 -0
  68. dexcontrol-0.2.1.dist-info/RECORD +72 -0
  69. dexcontrol-0.2.1.dist-info/WHEEL +5 -0
  70. dexcontrol-0.2.1.dist-info/licenses/LICENSE +188 -0
  71. dexcontrol-0.2.1.dist-info/licenses/NOTICE +13 -0
  72. dexcontrol-0.2.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,16 @@
1
+ # Copyright (c) 2025 Dexmate CORPORATION & AFFILIATES. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 with Commons Clause License
4
+ # Condition v1.0 [see LICENSE for details].
5
+
6
+ from dataclasses import dataclass
7
+
8
+
9
+ @dataclass
10
+ class GeminiCameraConfig:
11
+ _target_: str = "dexcontrol.sensors.camera.gemini_camera.GeminiCameraSensor"
12
+ rgb_topic: str = "camera/gemini/rgb"
13
+ depth_topic: str = "camera/gemini/depth"
14
+ name: str = "gemini_camera"
15
+ enable_fps_tracking: bool = False
16
+ fps_log_interval: int = 30
@@ -0,0 +1,15 @@
1
+ # Copyright (c) 2025 Dexmate CORPORATION & AFFILIATES. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 with Commons Clause License
4
+ # Condition v1.0 [see LICENSE for details].
5
+
6
+ from dataclasses import dataclass
7
+
8
+
9
+ @dataclass
10
+ class RGBCameraConfig:
11
+ _target_: str = "dexcontrol.sensors.camera.rgb_camera.RGBCameraSensor"
12
+ topic: str = "/camera/rgb"
13
+ name: str = "rgb_camera"
14
+ enable_fps_tracking: bool = False
15
+ fps_log_interval: int = 30
@@ -0,0 +1,6 @@
1
+ # Copyright (c) 2025 Dexmate CORPORATION & AFFILIATES. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 with Commons Clause License
4
+ # Condition v1.0 [see LICENSE for details].
5
+ from .gemini_imu import GeminiIMUConfig
6
+ from .nine_axis_imu import NineAxisIMUConfig
@@ -0,0 +1,15 @@
1
+ # Copyright (c) 2025 Dexmate CORPORATION & AFFILIATES. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 with Commons Clause License
4
+ # Condition v1.0 [see LICENSE for details].
5
+
6
+ from dataclasses import dataclass
7
+
8
+
9
+ @dataclass
10
+ class GeminiIMUConfig:
11
+ _target_: str = "dexcontrol.sensors.imu.gemini_imu.GeminiIMUSensor"
12
+ topic: str = "/imu/gemini"
13
+ name: str = "gemini_imu"
14
+ enable_fps_tracking: bool = False
15
+ fps_log_interval: int = 30
@@ -0,0 +1,15 @@
1
+ # Copyright (c) 2025 Dexmate CORPORATION & AFFILIATES. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 with Commons Clause License
4
+ # Condition v1.0 [see LICENSE for details].
5
+
6
+ from dataclasses import dataclass
7
+
8
+
9
+ @dataclass
10
+ class NineAxisIMUConfig:
11
+ _target_: str = "dexcontrol.sensors.imu.nine_axis_imu.NineAxisIMUSensor"
12
+ topic: str = "/imu/nine_axis"
13
+ name: str = "nine_axis_imu"
14
+ enable_fps_tracking: bool = False
15
+ fps_log_interval: int = 30
@@ -0,0 +1,6 @@
1
+ # Copyright (c) 2025 Dexmate CORPORATION & AFFILIATES. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 with Commons Clause License
4
+ # Condition v1.0 [see LICENSE for details].
5
+
6
+ from .rplidar import RPLidarConfig
@@ -0,0 +1,15 @@
1
+ # Copyright (c) 2025 Dexmate CORPORATION & AFFILIATES. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 with Commons Clause License
4
+ # Condition v1.0 [see LICENSE for details].
5
+
6
+ from dataclasses import dataclass
7
+
8
+
9
+ @dataclass
10
+ class RPLidarConfig:
11
+ _target_: str = "dexcontrol.sensors.lidar.rplidar.RPLidarSensor"
12
+ topic: str = "/lidar/scan"
13
+ name: str = "rplidar"
14
+ enable_fps_tracking: bool = False
15
+ fps_log_interval: int = 30
@@ -0,0 +1,6 @@
1
+ # Copyright (c) 2025 Dexmate CORPORATION & AFFILIATES. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 with Commons Clause License
4
+ # Condition v1.0 [see LICENSE for details].
5
+
6
+ from .ultrasonic import UltraSonicConfig
@@ -0,0 +1,15 @@
1
+ # Copyright (c) 2025 Dexmate CORPORATION & AFFILIATES. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 with Commons Clause License
4
+ # Condition v1.0 [see LICENSE for details].
5
+
6
+ from dataclasses import dataclass
7
+
8
+
9
+ @dataclass
10
+ class UltraSonicConfig:
11
+ _target_: str = "dexcontrol.sensors.ultrasonic.UltrasonicSensor"
12
+ topic: str = "state/ultrasonic"
13
+ name: str = "ultrasonic"
14
+ enable_fps_tracking: bool = False
15
+ fps_log_interval: int = 30
@@ -0,0 +1,65 @@
1
+ # Copyright (c) 2025 Dexmate CORPORATION & AFFILIATES. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 with Commons Clause License
4
+ # Condition v1.0 [see LICENSE for details].
5
+
6
+ """Configuration dataclass for Vega robot sensors.
7
+
8
+ This module defines the VegaSensorsConfig dataclass which specifies the default
9
+ configurations for all sensors on the Vega robot, including cameras, IMUs,
10
+ LiDAR and ultrasonic sensors.
11
+ """
12
+
13
+ from collections.abc import Callable
14
+ from dataclasses import dataclass, field
15
+
16
+ from .cameras import GeminiCameraConfig, RGBCameraConfig
17
+ from .imu import GeminiIMUConfig, NineAxisIMUConfig
18
+ from .lidar import RPLidarConfig
19
+ from .ultrasonic import UltraSonicConfig
20
+
21
+
22
+ def _make_rgb_camera(topic: str, name: str) -> Callable[[], RGBCameraConfig]:
23
+ """Helper function to create RGB camera config factory.
24
+
25
+ Args:
26
+ topic: Camera topic name
27
+ name: Camera instance name
28
+
29
+ Returns:
30
+ Factory function that creates an RGBCameraConfig
31
+ """
32
+ return lambda: RGBCameraConfig(
33
+ topic=f"camera/base/{topic}", name=f"base_{name}_camera"
34
+ )
35
+
36
+
37
+ @dataclass
38
+ class VegaSensorsConfig:
39
+ """Configuration for all sensors on the Vega robot.
40
+
41
+ Contains default configurations for:
42
+ - Head camera (Gemini)
43
+ - Base cameras (RGB) - left, right, front, back
44
+ - IMUs - base (9-axis) and head (Gemini)
45
+ - LiDAR
46
+ - Ultrasonic sensors
47
+ """
48
+
49
+ head_camera: GeminiCameraConfig = field(default_factory=GeminiCameraConfig)
50
+ base_left_camera: RGBCameraConfig = field(
51
+ default_factory=_make_rgb_camera("left", "left")
52
+ )
53
+ base_right_camera: RGBCameraConfig = field(
54
+ default_factory=_make_rgb_camera("right", "right")
55
+ )
56
+ base_front_camera: RGBCameraConfig = field(
57
+ default_factory=_make_rgb_camera("front", "front")
58
+ )
59
+ base_back_camera: RGBCameraConfig = field(
60
+ default_factory=_make_rgb_camera("back", "back")
61
+ )
62
+ base_imu: NineAxisIMUConfig = field(default_factory=NineAxisIMUConfig)
63
+ head_imu: GeminiIMUConfig = field(default_factory=GeminiIMUConfig)
64
+ lidar: RPLidarConfig = field(default_factory=RPLidarConfig)
65
+ ultrasonic: UltraSonicConfig = field(default_factory=UltraSonicConfig)
@@ -0,0 +1,203 @@
1
+ # Copyright (c) 2025 Dexmate CORPORATION & AFFILIATES. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 with Commons Clause License
4
+ # Condition v1.0 [see LICENSE for details].
5
+
6
+ from dataclasses import dataclass, field
7
+ from typing import ClassVar
8
+
9
+ from omegaconf import OmegaConf
10
+
11
+ from .core import (
12
+ ArmConfig,
13
+ BatteryConfig,
14
+ ChassisConfig,
15
+ EStopConfig,
16
+ HandConfig,
17
+ HeadConfig,
18
+ HeartbeatConfig,
19
+ TorsoConfig,
20
+ )
21
+ from .sensors.vega_sensors import VegaSensorsConfig
22
+
23
+
24
+ @dataclass
25
+ class VegaConfig:
26
+ """Base configuration for Vega robots.
27
+
28
+ This class serves as the base configuration for all Vega robot variants.
29
+ Different robot variants can extend this class or be loaded through the
30
+ factory function get_vega_config().
31
+ """
32
+
33
+ # Registry to store variant-specific configuration classes
34
+ _variants: ClassVar[dict[str, type["VegaConfig"]]] = {}
35
+
36
+ sensors: VegaSensorsConfig = field(default_factory=VegaSensorsConfig)
37
+ left_arm: ArmConfig = field(
38
+ default_factory=lambda: ArmConfig(
39
+ state_sub_topic="state/arm/left",
40
+ control_pub_topic="control/arm/left",
41
+ set_mode_query="mode/arm/left",
42
+ wrench_sub_topic="state/wrench/left",
43
+ joint_name=[f"L_arm_j{i + 1}" for i in range(7)],
44
+ pose_pool={
45
+ "folded": [1.57079, 0.0, 0, -3.1, 0, 0, -0.69813],
46
+ "folded_closed_hand": [1.57079, 0.0, 0, -3.1, 0, 0, -0.9],
47
+ "L_shape": [0.064, -0.3, 0.0, -1.556, 1.271, 0.0, 0.0],
48
+ "zero": [-1.57079, 0.0, 0, 0.0, 0, 0, 0.0],
49
+ },
50
+ )
51
+ )
52
+ right_arm: ArmConfig = field(
53
+ default_factory=lambda: ArmConfig(
54
+ state_sub_topic="state/arm/right",
55
+ control_pub_topic="control/arm/right",
56
+ set_mode_query="mode/arm/right",
57
+ wrench_sub_topic="state/wrench/right",
58
+ joint_name=[f"R_arm_j{i + 1}" for i in range(7)],
59
+ pose_pool={
60
+ "folded": [-1.57079, 0.0, 0, -3.1, 0, 0, 0.69813],
61
+ "folded_closed_hand": [-1.57079, 0.0, 0, -3.1, 0, 0, 0.9],
62
+ "L_shape": [-0.064, 0.3, 0.0, -1.556, -1.271, 0.0, 0.0],
63
+ "zero": [1.57079, 0.0, 0, 0.0, 0, 0, 0.0],
64
+ },
65
+ )
66
+ )
67
+ left_hand: HandConfig = field(
68
+ default_factory=lambda: HandConfig(
69
+ state_sub_topic="state/hand/left",
70
+ control_pub_topic="control/hand/left",
71
+ joint_name=[
72
+ "L_th_j1",
73
+ "L_ff_j1",
74
+ "L_mf_j1",
75
+ "L_rf_j1",
76
+ "L_lf_j1",
77
+ "L_th_j0",
78
+ ],
79
+ )
80
+ )
81
+ right_hand: HandConfig = field(
82
+ default_factory=lambda: HandConfig(
83
+ state_sub_topic="state/hand/right",
84
+ control_pub_topic="control/hand/right",
85
+ joint_name=[
86
+ "R_th_j1",
87
+ "R_ff_j1",
88
+ "R_mf_j1",
89
+ "R_rf_j1",
90
+ "R_lf_j1",
91
+ "R_th_j0",
92
+ ],
93
+ )
94
+ )
95
+ head: HeadConfig = field(default_factory=HeadConfig)
96
+ torso: TorsoConfig = field(default_factory=TorsoConfig)
97
+ chassis: ChassisConfig = field(default_factory=ChassisConfig)
98
+
99
+ # Misc
100
+ battery: BatteryConfig = field(default_factory=BatteryConfig)
101
+ estop: EStopConfig = field(default_factory=EStopConfig)
102
+ heartbeat: HeartbeatConfig = field(default_factory=HeartbeatConfig)
103
+
104
+ # Queries
105
+ version_info_name: str = "info/version"
106
+ status_info_name: str = "info/status"
107
+ reboot_query_name: str = "system/reboot"
108
+ clear_error_query_name: str = "system/clear_error"
109
+ led_query_name: str = "system/led"
110
+
111
+ @classmethod
112
+ def register_variant(
113
+ cls, variant_name: str, variant_cls: type["VegaConfig"]
114
+ ) -> None:
115
+ """Register a variant configuration class.
116
+
117
+ Args:
118
+ variant_name: Name of the robot variant.
119
+ variant_cls: Configuration class for the variant.
120
+ """
121
+ cls._variants[variant_name] = variant_cls
122
+
123
+
124
+ @dataclass
125
+ class Vega1Config(VegaConfig):
126
+ """Configuration specific to the Vega 1 robot variant."""
127
+
128
+ left_arm: ArmConfig = field(
129
+ default_factory=lambda: ArmConfig(
130
+ state_sub_topic="state/arm/left",
131
+ control_pub_topic="control/arm/left",
132
+ set_mode_query="mode/arm/left",
133
+ wrench_sub_topic="state/wrench/left",
134
+ joint_name=[f"L_arm_j{i + 1}" for i in range(7)],
135
+ pose_pool={
136
+ "folded": [1.57079, 0.0, 0, -3.1, 0, 0, -0.69813],
137
+ "folded_closed_hand": [1.57079, 0.0, 0, -3.1, 0, 0, -0.9],
138
+ "L_shape": [0.064, 0.3, 0.0, -1.556, 1.271, 0.0, 0.0],
139
+ "zero": [-1.57079, 0.0, 0, 0.0, 0, 0, 0.0],
140
+ },
141
+ )
142
+ )
143
+ right_arm: ArmConfig = field(
144
+ default_factory=lambda: ArmConfig(
145
+ state_sub_topic="state/arm/right",
146
+ control_pub_topic="control/arm/right",
147
+ set_mode_query="mode/arm/right",
148
+ wrench_sub_topic="state/wrench/right",
149
+ joint_name=[f"R_arm_j{i + 1}" for i in range(7)],
150
+ pose_pool={
151
+ "folded": [-1.57079, 0.0, 0, -3.1, 0, 0, 0.69813],
152
+ "folded_closed_hand": [-1.57079, 0.0, 0, -3.1, 0, 0, 0.9],
153
+ "L_shape": [-0.064, -0.3, 0.0, -1.556, -1.271, 0.0, 0.0],
154
+ "zero": [1.57079, 0.0, 0, 0.0, 0, 0, 0.0],
155
+ },
156
+ )
157
+ )
158
+ chassis: ChassisConfig = field(
159
+ default_factory=lambda: ChassisConfig(
160
+ wheels_dist=0.45,
161
+ )
162
+ )
163
+
164
+
165
+ # Register variant configurations
166
+ VegaConfig.register_variant("vega-rc1", VegaConfig)
167
+ VegaConfig.register_variant("vega-rc2", VegaConfig)
168
+ VegaConfig.register_variant("vega-1", Vega1Config)
169
+
170
+
171
+ def get_vega_config(variant: str | None = None) -> VegaConfig:
172
+ """Get the configuration for a specific Vega robot variant.
173
+
174
+ Args:
175
+ variant: The robot variant name (e.g., "rc2", "vega-1").
176
+ If None, returns the base VegaConfig.
177
+
178
+ Returns:
179
+ The configuration for the specified Vega robot variant as an OmegaConf object.
180
+ """
181
+ if variant is None or variant == "base":
182
+ config_class = VegaConfig
183
+ elif variant in VegaConfig._variants:
184
+ config_class = VegaConfig._variants[variant]
185
+ else:
186
+ raise ValueError(
187
+ f"Unknown robot variant: {variant}. "
188
+ f"Available variants: {list(VegaConfig._variants.keys())}"
189
+ )
190
+
191
+ config = config_class()
192
+ return OmegaConf.structured(config)
193
+
194
+
195
+ def get_default_vega_config() -> VegaConfig:
196
+ """Get the default Vega robot configuration.
197
+
198
+ This is kept for backward compatibility.
199
+
200
+ Returns:
201
+ The configuration for the default Vega robot as an OmegaConf object.
202
+ """
203
+ return get_vega_config("vega-1")
File without changes