hex-device 1.3.4__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.
- hex_device/__init__.py +189 -0
- hex_device/arm.py +643 -0
- hex_device/arm_config.py +597 -0
- hex_device/chassis.py +680 -0
- hex_device/common_utils.py +75 -0
- hex_device/device_base.py +195 -0
- hex_device/device_base_optional.py +146 -0
- hex_device/device_factory.py +247 -0
- hex_device/error_type.py +25 -0
- hex_device/generated/__init__.py +1 -0
- hex_device/generated/public_api_down_pb2.py +37 -0
- hex_device/generated/public_api_types_pb2.py +118 -0
- hex_device/generated/public_api_up_pb2.py +37 -0
- hex_device/hands.py +414 -0
- hex_device/hex_device_api.py +1001 -0
- hex_device/hex_socket.py +231 -0
- hex_device/kcp_client_core.py +398 -0
- hex_device/linear_lift.py +356 -0
- hex_device/motor_base.py +1317 -0
- hex_device-1.3.4.dist-info/METADATA +161 -0
- hex_device-1.3.4.dist-info/RECORD +24 -0
- hex_device-1.3.4.dist-info/WHEEL +5 -0
- hex_device-1.3.4.dist-info/licenses/LICENSE.txt +201 -0
- hex_device-1.3.4.dist-info/top_level.txt +1 -0
hex_device/__init__.py
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding:utf-8 -*-
|
|
3
|
+
################################################################
|
|
4
|
+
# Copyright 2025 Jecjune. All rights reserved.
|
|
5
|
+
# Author: Jecjune zejun.chen@hexfellow.com
|
|
6
|
+
# Date : 2025-8-1
|
|
7
|
+
################################################################
|
|
8
|
+
"""
|
|
9
|
+
HexDevice Python Library
|
|
10
|
+
|
|
11
|
+
A Python library for controlling HexDevice robots and devices.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import logging
|
|
15
|
+
|
|
16
|
+
# Configure default logging for the hex_device package
|
|
17
|
+
# Users can override this configuration if needed
|
|
18
|
+
def _setup_default_logging():
|
|
19
|
+
"""Setup default logging configuration for hex_device package"""
|
|
20
|
+
logger = logging.getLogger('hex_device')
|
|
21
|
+
|
|
22
|
+
# Only add handler if no handlers exist (avoid duplicate handlers)
|
|
23
|
+
if not logger.handlers:
|
|
24
|
+
# Create handler
|
|
25
|
+
handler = logging.StreamHandler()
|
|
26
|
+
|
|
27
|
+
# Create formatter
|
|
28
|
+
formatter = logging.Formatter(
|
|
29
|
+
'%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
|
30
|
+
datefmt='%Y-%m-%d %H:%M:%S'
|
|
31
|
+
)
|
|
32
|
+
handler.setFormatter(formatter)
|
|
33
|
+
|
|
34
|
+
# Add handler to logger
|
|
35
|
+
logger.addHandler(handler)
|
|
36
|
+
|
|
37
|
+
# Set default level to INFO (so DEBUG are not shown by default)
|
|
38
|
+
# Users can change this by calling logging.getLogger('hex_device').setLevel(logging.INFO)
|
|
39
|
+
logger.setLevel(logging.INFO)
|
|
40
|
+
|
|
41
|
+
# Prevent propagation to root logger to avoid duplicate messages
|
|
42
|
+
logger.propagate = False
|
|
43
|
+
|
|
44
|
+
# Setup default logging
|
|
45
|
+
_setup_default_logging()
|
|
46
|
+
|
|
47
|
+
def set_log_level(level):
|
|
48
|
+
"""
|
|
49
|
+
Set the logging level for hex_device package
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
level: Logging level (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR)
|
|
53
|
+
or string ('DEBUG', 'INFO', 'WARNING', 'ERROR')
|
|
54
|
+
|
|
55
|
+
Example:
|
|
56
|
+
import hex_device
|
|
57
|
+
import logging
|
|
58
|
+
|
|
59
|
+
# Enable INFO level logging
|
|
60
|
+
hex_device.set_log_level(logging.INFO)
|
|
61
|
+
# or
|
|
62
|
+
hex_device.set_log_level('INFO')
|
|
63
|
+
"""
|
|
64
|
+
logger = logging.getLogger('hex_device')
|
|
65
|
+
|
|
66
|
+
if isinstance(level, str):
|
|
67
|
+
level = getattr(logging, level.upper())
|
|
68
|
+
|
|
69
|
+
logger.setLevel(level)
|
|
70
|
+
|
|
71
|
+
def get_logger():
|
|
72
|
+
"""
|
|
73
|
+
Get the hex_device logger
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
logging.Logger: The hex_device package logger
|
|
77
|
+
|
|
78
|
+
Example:
|
|
79
|
+
import hex_device
|
|
80
|
+
logger = hex_device.get_logger()
|
|
81
|
+
logger.info("Custom log message")
|
|
82
|
+
"""
|
|
83
|
+
return logging.getLogger('hex_device')
|
|
84
|
+
|
|
85
|
+
# Core classes
|
|
86
|
+
from .device_base import DeviceBase
|
|
87
|
+
from .device_base_optional import OptionalDeviceBase
|
|
88
|
+
from .device_factory import DeviceFactory
|
|
89
|
+
from .motor_base import (
|
|
90
|
+
MotorBase,
|
|
91
|
+
MotorError,
|
|
92
|
+
MotorCommand,
|
|
93
|
+
CommandType,
|
|
94
|
+
MitMotorCommand
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# Device implementations
|
|
98
|
+
from .arm import Arm
|
|
99
|
+
from .chassis import Chassis
|
|
100
|
+
from .linear_lift import LinearLift
|
|
101
|
+
|
|
102
|
+
# Optional device implementations
|
|
103
|
+
from .hands import Hands
|
|
104
|
+
|
|
105
|
+
# Arm configuration system
|
|
106
|
+
from .arm_config import (
|
|
107
|
+
ArmConfig,
|
|
108
|
+
ArmConfigManager,
|
|
109
|
+
DofType,
|
|
110
|
+
JointParam,
|
|
111
|
+
JointParams,
|
|
112
|
+
load_default_arm_config,
|
|
113
|
+
get_arm_config,
|
|
114
|
+
add_arm_config,
|
|
115
|
+
arm_config_manager,
|
|
116
|
+
set_arm_initial_positions,
|
|
117
|
+
set_arm_initial_velocities,
|
|
118
|
+
clear_arm_position_history,
|
|
119
|
+
clear_arm_velocity_history,
|
|
120
|
+
clear_arm_motion_history,
|
|
121
|
+
get_arm_last_positions,
|
|
122
|
+
get_arm_last_velocities
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
# Error types
|
|
126
|
+
from .error_type import WsError, ProtocolError
|
|
127
|
+
|
|
128
|
+
# API utilities
|
|
129
|
+
from .hex_device_api import HexDeviceApi
|
|
130
|
+
|
|
131
|
+
# Define what gets imported with "from hex_device import *"
|
|
132
|
+
__all__ = [
|
|
133
|
+
# Core classes
|
|
134
|
+
'DeviceBase',
|
|
135
|
+
'OptionalDeviceBase',
|
|
136
|
+
'DeviceFactory',
|
|
137
|
+
'MotorBase',
|
|
138
|
+
'MotorError',
|
|
139
|
+
'MotorCommand',
|
|
140
|
+
'CommandType',
|
|
141
|
+
'MitMotorCommand',
|
|
142
|
+
|
|
143
|
+
# Device implementations
|
|
144
|
+
'Arm',
|
|
145
|
+
'Chassis',
|
|
146
|
+
'LinearLift',
|
|
147
|
+
|
|
148
|
+
# Optional device implementations
|
|
149
|
+
'Hands',
|
|
150
|
+
|
|
151
|
+
# Arm configuration system
|
|
152
|
+
'ArmConfig',
|
|
153
|
+
'ArmConfigManager',
|
|
154
|
+
'DofType',
|
|
155
|
+
'JointParam',
|
|
156
|
+
'JointParams',
|
|
157
|
+
'load_default_arm_config',
|
|
158
|
+
'get_arm_config',
|
|
159
|
+
'add_arm_config',
|
|
160
|
+
'arm_config_manager',
|
|
161
|
+
'set_arm_initial_positions',
|
|
162
|
+
'set_arm_initial_velocities',
|
|
163
|
+
'clear_arm_position_history',
|
|
164
|
+
'clear_arm_velocity_history',
|
|
165
|
+
'clear_arm_motion_history',
|
|
166
|
+
'get_arm_last_positions',
|
|
167
|
+
'get_arm_last_velocities',
|
|
168
|
+
|
|
169
|
+
# Error types
|
|
170
|
+
'WsError',
|
|
171
|
+
'ProtocolError',
|
|
172
|
+
|
|
173
|
+
# API utilities
|
|
174
|
+
'HexDeviceApi',
|
|
175
|
+
|
|
176
|
+
# Logging functionality
|
|
177
|
+
'set_log_level',
|
|
178
|
+
'get_logger',
|
|
179
|
+
|
|
180
|
+
# Version information
|
|
181
|
+
'__version__',
|
|
182
|
+
'__author__',
|
|
183
|
+
'__email__'
|
|
184
|
+
]
|
|
185
|
+
|
|
186
|
+
# Version information
|
|
187
|
+
__version__ = "1.0.0"
|
|
188
|
+
__author__ = "Jecjune"
|
|
189
|
+
__email__ = "zejun.chen@hexfellow.com"
|