hex-util-msg 0.1.0a2__tar.gz → 0.1.0a4__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.
- {hex_util_msg-0.1.0a2/hex_util_msg.egg-info → hex_util_msg-0.1.0a4}/PKG-INFO +42 -36
- {hex_util_msg-0.1.0a2 → hex_util_msg-0.1.0a4}/README.md +41 -35
- hex_util_msg-0.1.0a4/hex_util_msg/dataclass/__init__.py +106 -0
- {hex_util_msg-0.1.0a2 → hex_util_msg-0.1.0a4}/hex_util_msg/dataclass/dataclass_base.py +16 -16
- hex_util_msg-0.1.0a4/hex_util_msg/dataclass/dataclass_robo.py +189 -0
- hex_util_msg-0.1.0a4/hex_util_msg/dataclass/dataclass_teleop.py +114 -0
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_base/HexBaseHeader.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_base/HexFbsBaseHeader.py +14 -14
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_base/HexBaseJntFull.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_base/HexFbsBaseJntFull.py +48 -48
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_base/HexBaseJntState.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_base/HexFbsBaseJntState.py +24 -24
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_base/HexBaseOdometry.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_base/HexFbsBaseOdometry.py +14 -14
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_base/HexBasePose.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_base/HexFbsBasePose.py +5 -5
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_base/HexBaseQuaternion.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_base/HexFbsBaseQuaternion.py +7 -7
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_base/HexBaseTime.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_base/HexFbsBaseTime.py +5 -5
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_base/HexBaseTwist.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_base/HexFbsBaseTwist.py +5 -5
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_base/HexBaseVector3.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_base/HexFbsBaseVector3.py +6 -6
- hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_base/__init__.py +21 -0
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_envelope/MsgEnvelope.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_envelope/HexFbsMsgEnvelope.py +10 -10
- hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_envelope/HexFbsMsgPayload.py +39 -0
- hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_envelope/__init__.py +7 -0
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboArmCtrl.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboArmCtrl.py +20 -20
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboArmCtrlMode.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboArmCtrlMode.py +1 -1
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboManipStateStamped.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboArmCtrlStamped.py +15 -15
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboArmState.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboArmState.py +14 -14
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboGripStateStamped.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboArmStateStamped.py +15 -15
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboChsCtrl.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboChsCtrl.py +16 -16
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboChsCtrlMode.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboChsCtrlMode.py +1 -1
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboLiftCtrlStamped.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboChsCtrlStamped.py +15 -15
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboChsState.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboChsState.py +14 -14
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboLiftStateStamped.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboChsStateStamped.py +15 -15
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboGripCtrl.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboGripCtrl.py +12 -12
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboGripCtrlMode.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboGripCtrlMode.py +1 -1
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboManipCtrlStamped.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboGripCtrlStamped.py +15 -15
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboGripState.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboGripState.py +10 -10
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_teleop/HexTeleopHandleCtrlStamped.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboGripStateStamped.py +16 -16
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboLiftCtrl.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboLiftCtrl.py +12 -12
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboLiftCtrlMode.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboLiftCtrlMode.py +1 -1
- hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboLiftCtrlStamped.py +48 -0
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboLiftState.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboLiftState.py +14 -14
- hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboLiftStateStamped.py +48 -0
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboArmCtrlStamped.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboManipCtrl.py +16 -16
- hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboManipCtrlStamped.py +48 -0
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboArmStateStamped.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboManipState.py +16 -16
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_teleop/HexTeleopHandleStateStamped.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/HexFbsRoboManipStateStamped.py +16 -16
- hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_robo/__init__.py +51 -0
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_teleop/HexTeleopHandleCtrl.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_teleop/HexFbsTeleopHandleCtrl.py +24 -24
- hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_teleop/HexFbsTeleopHandleCtrlStamped.py +48 -0
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_teleop/HexTeleopHandleState.py → hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_teleop/HexFbsTeleopHandleState.py +20 -20
- hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_teleop/HexFbsTeleopHandleStateStamped.py +48 -0
- hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_teleop/HexFbsTeleopJoystickState.py +168 -0
- hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_teleop/HexFbsTeleopJoystickStateStamped.py +48 -0
- hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_teleop/HexFbsTeleopKeyboardState.py +232 -0
- hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_teleop/HexFbsTeleopKeyboardStateStamped.py +48 -0
- hex_util_msg-0.1.0a4/hex_util_msg/fbs/msg_teleop/__init__.py +19 -0
- {hex_util_msg-0.1.0a2 → hex_util_msg-0.1.0a4}/hex_util_msg/trans/__init__.py +16 -0
- hex_util_msg-0.1.0a4/hex_util_msg/trans/hex_msg_trans.py +356 -0
- hex_util_msg-0.1.0a4/hex_util_msg/trans/trans_base.py +219 -0
- hex_util_msg-0.1.0a4/hex_util_msg/trans/trans_robo.py +569 -0
- hex_util_msg-0.1.0a4/hex_util_msg/trans/trans_teleop.py +378 -0
- {hex_util_msg-0.1.0a2 → hex_util_msg-0.1.0a4/hex_util_msg.egg-info}/PKG-INFO +42 -36
- hex_util_msg-0.1.0a4/hex_util_msg.egg-info/SOURCES.txt +70 -0
- {hex_util_msg-0.1.0a2 → hex_util_msg-0.1.0a4}/pyproject.toml +1 -1
- {hex_util_msg-0.1.0a2 → hex_util_msg-0.1.0a4}/tests/test_hex_msg_trans.py +114 -114
- hex_util_msg-0.1.0a4/tests/test_hex_util_msg_imports.py +200 -0
- hex_util_msg-0.1.0a4/tests/test_msg_robo.py +333 -0
- hex_util_msg-0.1.0a4/tests/test_msg_teleop.py +275 -0
- hex_util_msg-0.1.0a2/hex_util_msg/dataclass/__init__.py +0 -98
- hex_util_msg-0.1.0a2/hex_util_msg/dataclass/dataclass_robo.py +0 -189
- hex_util_msg-0.1.0a2/hex_util_msg/dataclass/dataclass_teleop.py +0 -48
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_base/__init__.py +0 -21
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_envelope/MsgPayload.py +0 -35
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_envelope/__init__.py +0 -7
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboChsCtrlStamped.py +0 -48
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboChsStateStamped.py +0 -48
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboGripCtrlStamped.py +0 -48
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboManipCtrl.py +0 -48
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/HexRoboManipState.py +0 -48
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_robo/__init__.py +0 -51
- hex_util_msg-0.1.0a2/hex_util_msg/fbs/msg_teleop/__init__.py +0 -11
- hex_util_msg-0.1.0a2/hex_util_msg/trans/hex_msg_trans.py +0 -322
- hex_util_msg-0.1.0a2/hex_util_msg/trans/trans_base.py +0 -219
- hex_util_msg-0.1.0a2/hex_util_msg/trans/trans_robo.py +0 -569
- hex_util_msg-0.1.0a2/hex_util_msg/trans/trans_teleop.py +0 -156
- hex_util_msg-0.1.0a2/hex_util_msg.egg-info/SOURCES.txt +0 -66
- hex_util_msg-0.1.0a2/tests/test_hex_util_msg_imports.py +0 -200
- hex_util_msg-0.1.0a2/tests/test_msg_robo.py +0 -333
- hex_util_msg-0.1.0a2/tests/test_msg_teleop.py +0 -125
- {hex_util_msg-0.1.0a2 → hex_util_msg-0.1.0a4}/LICENSE +0 -0
- {hex_util_msg-0.1.0a2 → hex_util_msg-0.1.0a4}/MANIFEST.in +0 -0
- {hex_util_msg-0.1.0a2 → hex_util_msg-0.1.0a4}/hex_util_msg/__init__.py +0 -0
- {hex_util_msg-0.1.0a2 → hex_util_msg-0.1.0a4}/hex_util_msg.egg-info/dependency_links.txt +0 -0
- {hex_util_msg-0.1.0a2 → hex_util_msg-0.1.0a4}/hex_util_msg.egg-info/requires.txt +0 -0
- {hex_util_msg-0.1.0a2 → hex_util_msg-0.1.0a4}/hex_util_msg.egg-info/top_level.txt +0 -0
- {hex_util_msg-0.1.0a2 → hex_util_msg-0.1.0a4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hex_util_msg
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.0a4
|
|
4
4
|
Summary: HEXFELLOW Util Message
|
|
5
5
|
Author-email: Dong Zhaorui <dzr159@gmail.com>
|
|
6
6
|
Maintainer-email: jecjune <zejun.chen@hexfellow.com>, Dong Zhaorui <dzr159@gmail.com>
|
|
@@ -59,8 +59,8 @@ The library consists of three layers:
|
|
|
59
59
|
|
|
60
60
|
| Layer | Subpackage | Purpose |
|
|
61
61
|
|-------|-----------|---------|
|
|
62
|
-
| **Dataclass** | `hex_util_msg.dataclass` | Type-safe Python `@dataclass` objects for all
|
|
63
|
-
| **Converters** | `hex_util_msg.trans` | Bidirectional `dc2fbs` / `fbs2dc` functions plus the `HexMsgTrans` high-level envelope-based dispatcher |
|
|
62
|
+
| **Dataclass** | `hex_util_msg.dataclass` | Type-safe Python `@dataclass` objects for all 32 message types (base geometry, robot arm/chassis/grip/lift/manip, teleoperation handle/joystick/keyboard) — classes use `HexDc*` naming |
|
|
63
|
+
| **Converters** | `hex_util_msg.trans` | Bidirectional `dc2fbs` / `fbs2dc` functions plus the `HexMsgTrans` high-level envelope-based dispatcher — FBS classes use `HexFbs*` naming |
|
|
64
64
|
| **FlatBuffers** | `hex_util_msg.fbs` | Auto-generated FlatBuffers Python bindings for 4 namespaces (`msg_base`, `msg_robo`, `msg_teleop`, `msg_envelope`) |
|
|
65
65
|
|
|
66
66
|
## Message Categories
|
|
@@ -73,13 +73,15 @@ The library consists of three layers:
|
|
|
73
73
|
| **Lift** | Vertical lift | `Ctrl` / `State` (each with `Stamped` variant) |
|
|
74
74
|
| **Manip** | Composite arm+grip | `Ctrl` / `State` (each with `Stamped` variant) |
|
|
75
75
|
| **Teleop** | Teleoperation handle | `HandleCtrl` / `HandleState` (each with `Stamped` variant) |
|
|
76
|
+
| **Joystick** | Teleoperation joystick | `JoystickState` / `JoystickStateStamped` |
|
|
77
|
+
| **Keyboard** | Teleoperation keyboard | `KeyboardState` / `KeyboardStateStamped` |
|
|
76
78
|
| **Base** | Geometry & time | `Vector3`, `Quaternion`, `Pose`, `Twist`, `Time`, `Header`, `Odometry`, `JntState`, `JntFull` |
|
|
77
79
|
|
|
78
80
|
## What problem it solves
|
|
79
81
|
|
|
80
82
|
- **Zero-copy deserialization**: FlatBuffers enables direct memory access on the receiving end without decode overhead.
|
|
81
83
|
- **Type-safe dataclass API**: Work with standard Python dataclasses and numpy arrays — no manual FlatBuffers table construction.
|
|
82
|
-
- **Envelope dispatch**: `HexMsgTrans.dc2fbs()` and `.fbs2dc()` wrap all messages in a self-describing
|
|
84
|
+
- **Envelope dispatch**: `HexMsgTrans.dc2fbs()` and `.fbs2dc()` wrap all messages in a self-describing `HexFbsMsgEnvelope` so the receiver auto-detects the message type.
|
|
83
85
|
- **NumPy integration**: Joint fields are `np.float64` / `np.uint8` arrays, natural for scientific and robotics workflows.
|
|
84
86
|
|
|
85
87
|
## Target users
|
|
@@ -119,6 +121,10 @@ hex_util_msg/
|
|
|
119
121
|
│ ├── robo_lift_*.fbs # 4 files
|
|
120
122
|
│ ├── robo_manip_*.fbs # 4 files
|
|
121
123
|
│ └── teleop_handle_*.fbs # 4 files
|
|
124
|
+
│ ├── teleop_joystick_state.fbs
|
|
125
|
+
│ ├── teleop_joystick_state_stamped.fbs
|
|
126
|
+
│ ├── teleop_keyboard_state.fbs
|
|
127
|
+
│ └── teleop_keyboard_state_stamped.fbs
|
|
122
128
|
├── docs/
|
|
123
129
|
│ └── api.md # Full API reference
|
|
124
130
|
├── tests/ # pytest test suite
|
|
@@ -167,13 +173,13 @@ source .venv/bin/activate
|
|
|
167
173
|
```python
|
|
168
174
|
import numpy as np
|
|
169
175
|
from hex_util_msg.dataclass import (
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
176
|
+
HexDcBaseVector3, HexDcBaseQuaternion, HexDcBasePose, HexDcBaseTwist,
|
|
177
|
+
HexDcBaseTime, HexDcBaseHeader,
|
|
178
|
+
HexDcBaseJntState, HexDcBaseJntFull,
|
|
179
|
+
HexDcRoboArmCtrl, HexDcRoboArmCtrlMode, HexDcRoboArmCtrlStamped,
|
|
180
|
+
HexDcRoboArmState, HexDcRoboArmStateStamped,
|
|
181
|
+
HexDcRoboManipCtrl, HexDcRoboManipState,
|
|
182
|
+
HexDcTeleopHandleState,
|
|
177
183
|
)
|
|
178
184
|
```
|
|
179
185
|
|
|
@@ -183,16 +189,16 @@ from hex_util_msg.dataclass import (
|
|
|
183
189
|
from hex_util_msg.trans import HexMsgTrans
|
|
184
190
|
|
|
185
191
|
# --- Create a stamped arm control message ---
|
|
186
|
-
arm_ctrl =
|
|
187
|
-
header=
|
|
192
|
+
arm_ctrl = HexDcRoboArmCtrlStamped(
|
|
193
|
+
header=HexDcBaseHeader(
|
|
188
194
|
seq=1,
|
|
189
|
-
stamp=
|
|
195
|
+
stamp=HexDcBaseTime(secs=123, nsecs=456_000_000),
|
|
190
196
|
frame_id="arm_base",
|
|
191
197
|
),
|
|
192
|
-
arm_ctrl=
|
|
193
|
-
ctrl_mode=
|
|
194
|
-
grav=
|
|
195
|
-
jnt=
|
|
198
|
+
arm_ctrl=HexDcRoboArmCtrl(
|
|
199
|
+
ctrl_mode=HexDcRoboArmCtrlMode.MIT,
|
|
200
|
+
grav=HexDcBaseVector3(x=0.0, y=0.0, z=9.81),
|
|
201
|
+
jnt=HexDcBaseJntFull(
|
|
196
202
|
pos=np.zeros(7, dtype=np.float64),
|
|
197
203
|
vel=np.zeros(7, dtype=np.float64),
|
|
198
204
|
eff=np.zeros(7, dtype=np.float64),
|
|
@@ -201,9 +207,9 @@ arm_ctrl = HexRoboArmCtrlStamped(
|
|
|
201
207
|
lim_vel=np.zeros(7, dtype=np.float64),
|
|
202
208
|
lim_acc=np.zeros(7, dtype=np.float64),
|
|
203
209
|
),
|
|
204
|
-
pose=
|
|
205
|
-
position=
|
|
206
|
-
orientation=
|
|
210
|
+
pose=HexDcBasePose(
|
|
211
|
+
position=HexDcBaseVector3(x=0.5, y=0.0, z=1.0),
|
|
212
|
+
orientation=HexDcBaseQuaternion(x=0.0, y=0.0, z=0.0, w=1.0),
|
|
207
213
|
),
|
|
208
214
|
),
|
|
209
215
|
)
|
|
@@ -214,25 +220,25 @@ buf = HexMsgTrans.dc2fbs(arm_ctrl)
|
|
|
214
220
|
# Deserialize back — type is auto-detected from the envelope
|
|
215
221
|
restored = HexMsgTrans.fbs2dc(buf)
|
|
216
222
|
|
|
217
|
-
# restored is a
|
|
223
|
+
# restored is a HexDcRoboArmCtrlStamped dataclass
|
|
218
224
|
print(restored.header.seq) # 1
|
|
219
|
-
print(restored.arm_ctrl.ctrl_mode) #
|
|
225
|
+
print(restored.arm_ctrl.ctrl_mode) # HexDcRoboArmCtrlMode.MIT
|
|
220
226
|
```
|
|
221
227
|
|
|
222
228
|
## Arm state
|
|
223
229
|
|
|
224
230
|
```python
|
|
225
|
-
arm_state =
|
|
226
|
-
header=
|
|
227
|
-
arm_state=
|
|
228
|
-
jnt=
|
|
231
|
+
arm_state = HexDcRoboArmStateStamped(
|
|
232
|
+
header=HexDcBaseHeader(seq=0, stamp=HexDcBaseTime(secs=0), frame_id=""),
|
|
233
|
+
arm_state=HexDcRoboArmState(
|
|
234
|
+
jnt=HexDcBaseJntState(
|
|
229
235
|
position=np.array([0.0, 0.25, 0.5], dtype=np.float64),
|
|
230
236
|
velocity=np.array([0.0, 0.0, 0.0], dtype=np.float64),
|
|
231
237
|
effort=np.zeros(3, dtype=np.float64),
|
|
232
238
|
),
|
|
233
|
-
pose=
|
|
234
|
-
position=
|
|
235
|
-
orientation=
|
|
239
|
+
pose=HexDcBasePose(
|
|
240
|
+
position=HexDcBaseVector3(x=1.0, y=2.0, z=3.0),
|
|
241
|
+
orientation=HexDcBaseQuaternion(x=0.0, y=0.0, z=0.707, w=0.707),
|
|
236
242
|
),
|
|
237
243
|
),
|
|
238
244
|
)
|
|
@@ -243,7 +249,7 @@ restored = HexMsgTrans.fbs2dc(buf)
|
|
|
243
249
|
## Teleop handle state
|
|
244
250
|
|
|
245
251
|
```python
|
|
246
|
-
handle =
|
|
252
|
+
handle = HexDcTeleopHandleState(
|
|
247
253
|
trigger=0.5,
|
|
248
254
|
axis_x=0.3,
|
|
249
255
|
axis_y=-0.2,
|
|
@@ -260,14 +266,14 @@ restored = HexMsgTrans.fbs2dc(buf)
|
|
|
260
266
|
## Manipulator (composite arm + grip)
|
|
261
267
|
|
|
262
268
|
```python
|
|
263
|
-
manip_state =
|
|
264
|
-
arm_state=
|
|
265
|
-
jnt=
|
|
269
|
+
manip_state = HexDcRoboManipState(
|
|
270
|
+
arm_state=HexDcRoboArmState(
|
|
271
|
+
jnt=HexDcBaseJntState(
|
|
266
272
|
position=np.zeros(7, dtype=np.float64),
|
|
267
273
|
),
|
|
268
274
|
),
|
|
269
|
-
grip_state=
|
|
270
|
-
jnt=
|
|
275
|
+
grip_state=HexDcRoboGripState(
|
|
276
|
+
jnt=HexDcBaseJntState(
|
|
271
277
|
position=np.zeros(1, dtype=np.float64),
|
|
272
278
|
),
|
|
273
279
|
),
|
|
@@ -29,8 +29,8 @@ The library consists of three layers:
|
|
|
29
29
|
|
|
30
30
|
| Layer | Subpackage | Purpose |
|
|
31
31
|
|-------|-----------|---------|
|
|
32
|
-
| **Dataclass** | `hex_util_msg.dataclass` | Type-safe Python `@dataclass` objects for all
|
|
33
|
-
| **Converters** | `hex_util_msg.trans` | Bidirectional `dc2fbs` / `fbs2dc` functions plus the `HexMsgTrans` high-level envelope-based dispatcher |
|
|
32
|
+
| **Dataclass** | `hex_util_msg.dataclass` | Type-safe Python `@dataclass` objects for all 32 message types (base geometry, robot arm/chassis/grip/lift/manip, teleoperation handle/joystick/keyboard) — classes use `HexDc*` naming |
|
|
33
|
+
| **Converters** | `hex_util_msg.trans` | Bidirectional `dc2fbs` / `fbs2dc` functions plus the `HexMsgTrans` high-level envelope-based dispatcher — FBS classes use `HexFbs*` naming |
|
|
34
34
|
| **FlatBuffers** | `hex_util_msg.fbs` | Auto-generated FlatBuffers Python bindings for 4 namespaces (`msg_base`, `msg_robo`, `msg_teleop`, `msg_envelope`) |
|
|
35
35
|
|
|
36
36
|
## Message Categories
|
|
@@ -43,13 +43,15 @@ The library consists of three layers:
|
|
|
43
43
|
| **Lift** | Vertical lift | `Ctrl` / `State` (each with `Stamped` variant) |
|
|
44
44
|
| **Manip** | Composite arm+grip | `Ctrl` / `State` (each with `Stamped` variant) |
|
|
45
45
|
| **Teleop** | Teleoperation handle | `HandleCtrl` / `HandleState` (each with `Stamped` variant) |
|
|
46
|
+
| **Joystick** | Teleoperation joystick | `JoystickState` / `JoystickStateStamped` |
|
|
47
|
+
| **Keyboard** | Teleoperation keyboard | `KeyboardState` / `KeyboardStateStamped` |
|
|
46
48
|
| **Base** | Geometry & time | `Vector3`, `Quaternion`, `Pose`, `Twist`, `Time`, `Header`, `Odometry`, `JntState`, `JntFull` |
|
|
47
49
|
|
|
48
50
|
## What problem it solves
|
|
49
51
|
|
|
50
52
|
- **Zero-copy deserialization**: FlatBuffers enables direct memory access on the receiving end without decode overhead.
|
|
51
53
|
- **Type-safe dataclass API**: Work with standard Python dataclasses and numpy arrays — no manual FlatBuffers table construction.
|
|
52
|
-
- **Envelope dispatch**: `HexMsgTrans.dc2fbs()` and `.fbs2dc()` wrap all messages in a self-describing
|
|
54
|
+
- **Envelope dispatch**: `HexMsgTrans.dc2fbs()` and `.fbs2dc()` wrap all messages in a self-describing `HexFbsMsgEnvelope` so the receiver auto-detects the message type.
|
|
53
55
|
- **NumPy integration**: Joint fields are `np.float64` / `np.uint8` arrays, natural for scientific and robotics workflows.
|
|
54
56
|
|
|
55
57
|
## Target users
|
|
@@ -89,6 +91,10 @@ hex_util_msg/
|
|
|
89
91
|
│ ├── robo_lift_*.fbs # 4 files
|
|
90
92
|
│ ├── robo_manip_*.fbs # 4 files
|
|
91
93
|
│ └── teleop_handle_*.fbs # 4 files
|
|
94
|
+
│ ├── teleop_joystick_state.fbs
|
|
95
|
+
│ ├── teleop_joystick_state_stamped.fbs
|
|
96
|
+
│ ├── teleop_keyboard_state.fbs
|
|
97
|
+
│ └── teleop_keyboard_state_stamped.fbs
|
|
92
98
|
├── docs/
|
|
93
99
|
│ └── api.md # Full API reference
|
|
94
100
|
├── tests/ # pytest test suite
|
|
@@ -137,13 +143,13 @@ source .venv/bin/activate
|
|
|
137
143
|
```python
|
|
138
144
|
import numpy as np
|
|
139
145
|
from hex_util_msg.dataclass import (
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
HexDcBaseVector3, HexDcBaseQuaternion, HexDcBasePose, HexDcBaseTwist,
|
|
147
|
+
HexDcBaseTime, HexDcBaseHeader,
|
|
148
|
+
HexDcBaseJntState, HexDcBaseJntFull,
|
|
149
|
+
HexDcRoboArmCtrl, HexDcRoboArmCtrlMode, HexDcRoboArmCtrlStamped,
|
|
150
|
+
HexDcRoboArmState, HexDcRoboArmStateStamped,
|
|
151
|
+
HexDcRoboManipCtrl, HexDcRoboManipState,
|
|
152
|
+
HexDcTeleopHandleState,
|
|
147
153
|
)
|
|
148
154
|
```
|
|
149
155
|
|
|
@@ -153,16 +159,16 @@ from hex_util_msg.dataclass import (
|
|
|
153
159
|
from hex_util_msg.trans import HexMsgTrans
|
|
154
160
|
|
|
155
161
|
# --- Create a stamped arm control message ---
|
|
156
|
-
arm_ctrl =
|
|
157
|
-
header=
|
|
162
|
+
arm_ctrl = HexDcRoboArmCtrlStamped(
|
|
163
|
+
header=HexDcBaseHeader(
|
|
158
164
|
seq=1,
|
|
159
|
-
stamp=
|
|
165
|
+
stamp=HexDcBaseTime(secs=123, nsecs=456_000_000),
|
|
160
166
|
frame_id="arm_base",
|
|
161
167
|
),
|
|
162
|
-
arm_ctrl=
|
|
163
|
-
ctrl_mode=
|
|
164
|
-
grav=
|
|
165
|
-
jnt=
|
|
168
|
+
arm_ctrl=HexDcRoboArmCtrl(
|
|
169
|
+
ctrl_mode=HexDcRoboArmCtrlMode.MIT,
|
|
170
|
+
grav=HexDcBaseVector3(x=0.0, y=0.0, z=9.81),
|
|
171
|
+
jnt=HexDcBaseJntFull(
|
|
166
172
|
pos=np.zeros(7, dtype=np.float64),
|
|
167
173
|
vel=np.zeros(7, dtype=np.float64),
|
|
168
174
|
eff=np.zeros(7, dtype=np.float64),
|
|
@@ -171,9 +177,9 @@ arm_ctrl = HexRoboArmCtrlStamped(
|
|
|
171
177
|
lim_vel=np.zeros(7, dtype=np.float64),
|
|
172
178
|
lim_acc=np.zeros(7, dtype=np.float64),
|
|
173
179
|
),
|
|
174
|
-
pose=
|
|
175
|
-
position=
|
|
176
|
-
orientation=
|
|
180
|
+
pose=HexDcBasePose(
|
|
181
|
+
position=HexDcBaseVector3(x=0.5, y=0.0, z=1.0),
|
|
182
|
+
orientation=HexDcBaseQuaternion(x=0.0, y=0.0, z=0.0, w=1.0),
|
|
177
183
|
),
|
|
178
184
|
),
|
|
179
185
|
)
|
|
@@ -184,25 +190,25 @@ buf = HexMsgTrans.dc2fbs(arm_ctrl)
|
|
|
184
190
|
# Deserialize back — type is auto-detected from the envelope
|
|
185
191
|
restored = HexMsgTrans.fbs2dc(buf)
|
|
186
192
|
|
|
187
|
-
# restored is a
|
|
193
|
+
# restored is a HexDcRoboArmCtrlStamped dataclass
|
|
188
194
|
print(restored.header.seq) # 1
|
|
189
|
-
print(restored.arm_ctrl.ctrl_mode) #
|
|
195
|
+
print(restored.arm_ctrl.ctrl_mode) # HexDcRoboArmCtrlMode.MIT
|
|
190
196
|
```
|
|
191
197
|
|
|
192
198
|
## Arm state
|
|
193
199
|
|
|
194
200
|
```python
|
|
195
|
-
arm_state =
|
|
196
|
-
header=
|
|
197
|
-
arm_state=
|
|
198
|
-
jnt=
|
|
201
|
+
arm_state = HexDcRoboArmStateStamped(
|
|
202
|
+
header=HexDcBaseHeader(seq=0, stamp=HexDcBaseTime(secs=0), frame_id=""),
|
|
203
|
+
arm_state=HexDcRoboArmState(
|
|
204
|
+
jnt=HexDcBaseJntState(
|
|
199
205
|
position=np.array([0.0, 0.25, 0.5], dtype=np.float64),
|
|
200
206
|
velocity=np.array([0.0, 0.0, 0.0], dtype=np.float64),
|
|
201
207
|
effort=np.zeros(3, dtype=np.float64),
|
|
202
208
|
),
|
|
203
|
-
pose=
|
|
204
|
-
position=
|
|
205
|
-
orientation=
|
|
209
|
+
pose=HexDcBasePose(
|
|
210
|
+
position=HexDcBaseVector3(x=1.0, y=2.0, z=3.0),
|
|
211
|
+
orientation=HexDcBaseQuaternion(x=0.0, y=0.0, z=0.707, w=0.707),
|
|
206
212
|
),
|
|
207
213
|
),
|
|
208
214
|
)
|
|
@@ -213,7 +219,7 @@ restored = HexMsgTrans.fbs2dc(buf)
|
|
|
213
219
|
## Teleop handle state
|
|
214
220
|
|
|
215
221
|
```python
|
|
216
|
-
handle =
|
|
222
|
+
handle = HexDcTeleopHandleState(
|
|
217
223
|
trigger=0.5,
|
|
218
224
|
axis_x=0.3,
|
|
219
225
|
axis_y=-0.2,
|
|
@@ -230,14 +236,14 @@ restored = HexMsgTrans.fbs2dc(buf)
|
|
|
230
236
|
## Manipulator (composite arm + grip)
|
|
231
237
|
|
|
232
238
|
```python
|
|
233
|
-
manip_state =
|
|
234
|
-
arm_state=
|
|
235
|
-
jnt=
|
|
239
|
+
manip_state = HexDcRoboManipState(
|
|
240
|
+
arm_state=HexDcRoboArmState(
|
|
241
|
+
jnt=HexDcBaseJntState(
|
|
236
242
|
position=np.zeros(7, dtype=np.float64),
|
|
237
243
|
),
|
|
238
244
|
),
|
|
239
|
-
grip_state=
|
|
240
|
-
jnt=
|
|
245
|
+
grip_state=HexDcRoboGripState(
|
|
246
|
+
jnt=HexDcBaseJntState(
|
|
241
247
|
position=np.zeros(1, dtype=np.float64),
|
|
242
248
|
),
|
|
243
249
|
),
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding:utf-8 -*-
|
|
3
|
+
################################################################
|
|
4
|
+
# Copyright 2026 Dong Zhaorui. All rights reserved.
|
|
5
|
+
# Author: Dong Zhaorui 847235539@qq.com
|
|
6
|
+
# Date : 2026-06-11
|
|
7
|
+
################################################################
|
|
8
|
+
|
|
9
|
+
from .dataclass_base import (
|
|
10
|
+
HexDcBaseHeader,
|
|
11
|
+
HexDcBaseOdometry,
|
|
12
|
+
HexDcBaseJntState,
|
|
13
|
+
HexDcBaseJntFull,
|
|
14
|
+
HexDcBasePose,
|
|
15
|
+
HexDcBaseQuaternion,
|
|
16
|
+
HexDcBaseTime,
|
|
17
|
+
HexDcBaseTwist,
|
|
18
|
+
HexDcBaseVector3,
|
|
19
|
+
)
|
|
20
|
+
from .dataclass_robo import (
|
|
21
|
+
HexDcRoboArmCtrl,
|
|
22
|
+
HexDcRoboArmCtrlMode,
|
|
23
|
+
HexDcRoboArmCtrlStamped,
|
|
24
|
+
HexDcRoboArmState,
|
|
25
|
+
HexDcRoboArmStateStamped,
|
|
26
|
+
HexDcRoboChsCtrl,
|
|
27
|
+
HexDcRoboChsCtrlMode,
|
|
28
|
+
HexDcRoboChsCtrlStamped,
|
|
29
|
+
HexDcRoboChsState,
|
|
30
|
+
HexDcRoboChsStateStamped,
|
|
31
|
+
HexDcRoboGripCtrl,
|
|
32
|
+
HexDcRoboGripCtrlMode,
|
|
33
|
+
HexDcRoboGripCtrlStamped,
|
|
34
|
+
HexDcRoboGripState,
|
|
35
|
+
HexDcRoboGripStateStamped,
|
|
36
|
+
HexDcRoboLiftCtrl,
|
|
37
|
+
HexDcRoboLiftCtrlMode,
|
|
38
|
+
HexDcRoboLiftCtrlStamped,
|
|
39
|
+
HexDcRoboLiftState,
|
|
40
|
+
HexDcRoboLiftStateStamped,
|
|
41
|
+
HexDcRoboManipCtrl,
|
|
42
|
+
HexDcRoboManipCtrlStamped,
|
|
43
|
+
HexDcRoboManipState,
|
|
44
|
+
HexDcRoboManipStateStamped,
|
|
45
|
+
)
|
|
46
|
+
from .dataclass_teleop import (
|
|
47
|
+
HexDcTeleopHandleCtrl,
|
|
48
|
+
HexDcTeleopHandleCtrlStamped,
|
|
49
|
+
HexDcTeleopHandleState,
|
|
50
|
+
HexDcTeleopHandleStateStamped,
|
|
51
|
+
HexDcTeleopJoystickState,
|
|
52
|
+
HexDcTeleopJoystickStateStamped,
|
|
53
|
+
HexDcTeleopKeyboardState,
|
|
54
|
+
HexDcTeleopKeyboardStateStamped,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
__all__ = [
|
|
58
|
+
# Base types
|
|
59
|
+
"HexDcBaseHeader",
|
|
60
|
+
"HexDcBaseOdometry",
|
|
61
|
+
"HexDcBaseJntState",
|
|
62
|
+
"HexDcBaseJntFull",
|
|
63
|
+
"HexDcBasePose",
|
|
64
|
+
"HexDcBaseQuaternion",
|
|
65
|
+
"HexDcBaseTime",
|
|
66
|
+
"HexDcBaseTwist",
|
|
67
|
+
"HexDcBaseVector3",
|
|
68
|
+
# Arm
|
|
69
|
+
"HexDcRoboArmCtrl",
|
|
70
|
+
"HexDcRoboArmCtrlMode",
|
|
71
|
+
"HexDcRoboArmCtrlStamped",
|
|
72
|
+
"HexDcRoboArmState",
|
|
73
|
+
"HexDcRoboArmStateStamped",
|
|
74
|
+
# Chassis
|
|
75
|
+
"HexDcRoboChsCtrl",
|
|
76
|
+
"HexDcRoboChsCtrlMode",
|
|
77
|
+
"HexDcRoboChsCtrlStamped",
|
|
78
|
+
"HexDcRoboChsState",
|
|
79
|
+
"HexDcRoboChsStateStamped",
|
|
80
|
+
# Grip
|
|
81
|
+
"HexDcRoboGripCtrl",
|
|
82
|
+
"HexDcRoboGripCtrlMode",
|
|
83
|
+
"HexDcRoboGripCtrlStamped",
|
|
84
|
+
"HexDcRoboGripState",
|
|
85
|
+
"HexDcRoboGripStateStamped",
|
|
86
|
+
# Lift
|
|
87
|
+
"HexDcRoboLiftCtrl",
|
|
88
|
+
"HexDcRoboLiftCtrlMode",
|
|
89
|
+
"HexDcRoboLiftCtrlStamped",
|
|
90
|
+
"HexDcRoboLiftState",
|
|
91
|
+
"HexDcRoboLiftStateStamped",
|
|
92
|
+
# Manip
|
|
93
|
+
"HexDcRoboManipCtrl",
|
|
94
|
+
"HexDcRoboManipCtrlStamped",
|
|
95
|
+
"HexDcRoboManipState",
|
|
96
|
+
"HexDcRoboManipStateStamped",
|
|
97
|
+
# Teleop
|
|
98
|
+
"HexDcTeleopHandleCtrl",
|
|
99
|
+
"HexDcTeleopHandleCtrlStamped",
|
|
100
|
+
"HexDcTeleopHandleState",
|
|
101
|
+
"HexDcTeleopHandleStateStamped",
|
|
102
|
+
"HexDcTeleopJoystickState",
|
|
103
|
+
"HexDcTeleopJoystickStateStamped",
|
|
104
|
+
"HexDcTeleopKeyboardState",
|
|
105
|
+
"HexDcTeleopKeyboardStateStamped",
|
|
106
|
+
]
|
|
@@ -12,14 +12,14 @@ import numpy as np
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
@dataclass
|
|
15
|
-
class
|
|
15
|
+
class HexDcBaseVector3:
|
|
16
16
|
x: float = 0.0
|
|
17
17
|
y: float = 0.0
|
|
18
18
|
z: float = 0.0
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
@dataclass
|
|
22
|
-
class
|
|
22
|
+
class HexDcBaseQuaternion:
|
|
23
23
|
x: float = 0.0
|
|
24
24
|
y: float = 0.0
|
|
25
25
|
z: float = 0.0
|
|
@@ -27,38 +27,38 @@ class HexBaseQuaternion:
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
@dataclass
|
|
30
|
-
class
|
|
31
|
-
position:
|
|
32
|
-
orientation:
|
|
30
|
+
class HexDcBasePose:
|
|
31
|
+
position: HexDcBaseVector3 = field(default_factory=HexDcBaseVector3)
|
|
32
|
+
orientation: HexDcBaseQuaternion = field(default_factory=HexDcBaseQuaternion)
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
@dataclass
|
|
36
|
-
class
|
|
37
|
-
linear:
|
|
38
|
-
angular:
|
|
36
|
+
class HexDcBaseTwist:
|
|
37
|
+
linear: HexDcBaseVector3 = field(default_factory=HexDcBaseVector3)
|
|
38
|
+
angular: HexDcBaseVector3 = field(default_factory=HexDcBaseVector3)
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
@dataclass
|
|
42
|
-
class
|
|
42
|
+
class HexDcBaseTime:
|
|
43
43
|
secs: int = 0
|
|
44
44
|
nsecs: int = 0
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
@dataclass
|
|
48
|
-
class
|
|
48
|
+
class HexDcBaseHeader:
|
|
49
49
|
seq: int = 0
|
|
50
|
-
stamp:
|
|
50
|
+
stamp: HexDcBaseTime = field(default_factory=HexDcBaseTime)
|
|
51
51
|
frame_id: str = ""
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
@dataclass
|
|
55
|
-
class
|
|
56
|
-
pose:
|
|
57
|
-
twist:
|
|
55
|
+
class HexDcBaseOdometry:
|
|
56
|
+
pose: HexDcBasePose = field(default_factory=HexDcBasePose)
|
|
57
|
+
twist: HexDcBaseTwist = field(default_factory=HexDcBaseTwist)
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
@dataclass
|
|
61
|
-
class
|
|
61
|
+
class HexDcBaseJntState:
|
|
62
62
|
position: np.ndarray = field(
|
|
63
63
|
default_factory=lambda: np.array([], dtype=np.float64))
|
|
64
64
|
velocity: np.ndarray = field(
|
|
@@ -68,7 +68,7 @@ class HexBaseJntState:
|
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
@dataclass
|
|
71
|
-
class
|
|
71
|
+
class HexDcBaseJntFull:
|
|
72
72
|
pos: np.ndarray = field(
|
|
73
73
|
default_factory=lambda: np.array([], dtype=np.float64))
|
|
74
74
|
vel: np.ndarray = field(
|