hex-util-msg 0.0.1a4__tar.gz → 0.1.0__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.0/PKG-INFO +347 -0
- hex_util_msg-0.1.0/README.md +317 -0
- hex_util_msg-0.1.0/hex_util_msg/__init__.py +39 -0
- hex_util_msg-0.1.0/hex_util_msg/dataclass/__init__.py +106 -0
- hex_util_msg-0.1.0/hex_util_msg/dataclass/dataclass_base.py +85 -0
- hex_util_msg-0.1.0/hex_util_msg/dataclass/dataclass_robo.py +189 -0
- hex_util_msg-0.1.0/hex_util_msg/dataclass/dataclass_teleop.py +114 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_base/HexFbsBaseHeader.py +52 -0
- hex_util_msg-0.0.1a4/hex_util_msg/msg_robot/HexGripCtrl.py → hex_util_msg-0.1.0/hex_util_msg/fbs/msg_base/HexFbsBaseJntFull.py +113 -116
- hex_util_msg-0.0.1a4/hex_util_msg/msg_robot/HexJntState.py → hex_util_msg-0.1.0/hex_util_msg/fbs/msg_base/HexFbsBaseJntState.py +48 -56
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_base/HexFbsBaseOdometry.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_base/HexFbsBasePose.py +38 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_base/HexFbsBaseQuaternion.py +31 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_base/HexFbsBaseTime.py +25 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_base/HexFbsBaseTwist.py +37 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_base/HexFbsBaseVector3.py +28 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_base/__init__.py +21 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_envelope/HexFbsMsgEnvelope.py +43 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_envelope/HexFbsMsgPayload.py +39 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_envelope/__init__.py +7 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboArmCtrl.py +68 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboArmCtrlMode.py +10 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboArmCtrlStamped.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboArmState.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboArmStateStamped.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboChsCtrl.py +56 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboChsCtrlMode.py +9 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboChsCtrlStamped.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboChsState.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboChsStateStamped.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboGripCtrl.py +44 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboGripCtrlMode.py +10 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboGripCtrlStamped.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboGripState.py +36 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboGripStateStamped.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboLiftCtrl.py +44 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboLiftCtrlMode.py +9 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboLiftCtrlStamped.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboLiftState.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboLiftStateStamped.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboManipCtrl.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboManipCtrlStamped.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboManipState.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/HexFbsRoboManipStateStamped.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_robo/__init__.py +51 -0
- hex_util_msg-0.0.1a4/hex_util_msg/msg_robot/HexRgbCtrl.py → hex_util_msg-0.1.0/hex_util_msg/fbs/msg_teleop/HexFbsTeleopHandleCtrl.py +48 -56
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_teleop/HexFbsTeleopHandleCtrlStamped.py +48 -0
- hex_util_msg-0.0.1a4/hex_util_msg/msg_teleop/HexTeleopHello.py → hex_util_msg-0.1.0/hex_util_msg/fbs/msg_teleop/HexFbsTeleopHandleState.py +27 -35
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_teleop/HexFbsTeleopHandleStateStamped.py +48 -0
- hex_util_msg-0.0.1a4/hex_util_msg/msg_teleop/HexTeleopJoy.py → hex_util_msg-0.1.0/hex_util_msg/fbs/msg_teleop/HexFbsTeleopJoystickState.py +60 -68
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_teleop/HexFbsTeleopJoystickStateStamped.py +48 -0
- hex_util_msg-0.0.1a4/hex_util_msg/msg_teleop/HexTeleopKeyboard.py → hex_util_msg-0.1.0/hex_util_msg/fbs/msg_teleop/HexFbsTeleopKeyboardState.py +86 -94
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_teleop/HexFbsTeleopKeyboardStateStamped.py +48 -0
- hex_util_msg-0.1.0/hex_util_msg/fbs/msg_teleop/__init__.py +19 -0
- hex_util_msg-0.1.0/hex_util_msg/trans/__init__.py +184 -0
- hex_util_msg-0.1.0/hex_util_msg/trans/hex_msg_trans.py +356 -0
- hex_util_msg-0.1.0/hex_util_msg/trans/trans_base.py +219 -0
- hex_util_msg-0.1.0/hex_util_msg/trans/trans_robo.py +569 -0
- hex_util_msg-0.1.0/hex_util_msg/trans/trans_teleop.py +378 -0
- hex_util_msg-0.1.0/hex_util_msg.egg-info/PKG-INFO +347 -0
- hex_util_msg-0.1.0/hex_util_msg.egg-info/SOURCES.txt +70 -0
- {hex_util_msg-0.0.1a4 → hex_util_msg-0.1.0}/hex_util_msg.egg-info/requires.txt +1 -1
- {hex_util_msg-0.0.1a4 → hex_util_msg-0.1.0}/pyproject.toml +5 -3
- hex_util_msg-0.1.0/tests/test_hex_msg_trans.py +395 -0
- hex_util_msg-0.1.0/tests/test_hex_util_msg_imports.py +200 -0
- hex_util_msg-0.1.0/tests/test_msg_robo.py +333 -0
- hex_util_msg-0.1.0/tests/test_msg_teleop.py +275 -0
- hex_util_msg-0.0.1a4/PKG-INFO +0 -249
- hex_util_msg-0.0.1a4/README.md +0 -221
- hex_util_msg-0.0.1a4/hex_util_msg/__init__.py +0 -13
- hex_util_msg-0.0.1a4/hex_util_msg/builder_basic.py +0 -181
- hex_util_msg-0.0.1a4/hex_util_msg/builder_image.py +0 -74
- hex_util_msg-0.0.1a4/hex_util_msg/builder_robot.py +0 -488
- hex_util_msg-0.0.1a4/hex_util_msg/builder_teleop.py +0 -296
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexBool.py +0 -40
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexBoolArray.py +0 -61
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexFloat32.py +0 -40
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexFloat32Array.py +0 -61
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexFloat64.py +0 -40
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexFloat64Array.py +0 -61
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexInt16.py +0 -40
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexInt16Array.py +0 -61
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexInt32.py +0 -40
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexInt32Array.py +0 -61
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexInt64.py +0 -40
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexInt64Array.py +0 -61
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexInt8.py +0 -40
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexInt8Array.py +0 -61
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexString.py +0 -40
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexStringArray.py +0 -54
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexUint16.py +0 -40
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexUint16Array.py +0 -61
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexUint32.py +0 -40
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexUint32Array.py +0 -61
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexUint64.py +0 -40
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexUint64Array.py +0 -61
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexUint8.py +0 -40
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/HexUint8Array.py +0 -61
- hex_util_msg-0.0.1a4/hex_util_msg/msg_basic/__init__.py +0 -24
- hex_util_msg-0.0.1a4/hex_util_msg/msg_image/HexImgEncoding.py +0 -10
- hex_util_msg-0.0.1a4/hex_util_msg/msg_image/HexImgSimple.py +0 -85
- hex_util_msg-0.0.1a4/hex_util_msg/msg_image/__init__.py +0 -2
- hex_util_msg-0.0.1a4/hex_util_msg/msg_robot/HexArmCtrl.py +0 -338
- hex_util_msg-0.0.1a4/hex_util_msg/msg_robot/HexArmCtrlMode.py +0 -12
- hex_util_msg-0.0.1a4/hex_util_msg/msg_robot/HexArmState.py +0 -177
- hex_util_msg-0.0.1a4/hex_util_msg/msg_robot/HexGripCtrlMode.py +0 -10
- hex_util_msg-0.0.1a4/hex_util_msg/msg_robot/HexGripState.py +0 -119
- hex_util_msg-0.0.1a4/hex_util_msg/msg_robot/HexPoseState.py +0 -90
- hex_util_msg-0.0.1a4/hex_util_msg/msg_robot/__init__.py +0 -9
- hex_util_msg-0.0.1a4/hex_util_msg/msg_teleop/__init__.py +0 -3
- hex_util_msg-0.0.1a4/hex_util_msg.egg-info/PKG-INFO +0 -249
- hex_util_msg-0.0.1a4/hex_util_msg.egg-info/SOURCES.txt +0 -64
- hex_util_msg-0.0.1a4/tests/test_builder_basic.py +0 -192
- hex_util_msg-0.0.1a4/tests/test_builder_image.py +0 -54
- hex_util_msg-0.0.1a4/tests/test_builder_robot.py +0 -170
- hex_util_msg-0.0.1a4/tests/test_builder_teleop.py +0 -109
- hex_util_msg-0.0.1a4/tests/test_hex_util_msg_imports.py +0 -74
- hex_util_msg-0.0.1a4/tests/test_msg_image.py +0 -43
- hex_util_msg-0.0.1a4/tests/test_msg_robot.py +0 -183
- hex_util_msg-0.0.1a4/tests/test_msg_teleop.py +0 -88
- {hex_util_msg-0.0.1a4 → hex_util_msg-0.1.0}/LICENSE +0 -0
- {hex_util_msg-0.0.1a4 → hex_util_msg-0.1.0}/MANIFEST.in +0 -0
- {hex_util_msg-0.0.1a4 → hex_util_msg-0.1.0}/hex_util_msg.egg-info/dependency_links.txt +0 -0
- {hex_util_msg-0.0.1a4 → hex_util_msg-0.1.0}/hex_util_msg.egg-info/top_level.txt +0 -0
- {hex_util_msg-0.0.1a4 → hex_util_msg-0.1.0}/setup.cfg +0 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hex_util_msg
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: HEXFELLOW Util Message
|
|
5
|
+
Author-email: Dong Zhaorui <dzr159@gmail.com>
|
|
6
|
+
Maintainer-email: jecjune <zejun.chen@hexfellow.com>, Dong Zhaorui <dzr159@gmail.com>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Project-URL: Homepage, https://github.com/hexfellow/hex_util_msg
|
|
9
|
+
Project-URL: Repository, https://github.com/hexfellow/hex_util_msg.git
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/hexfellow/hex_util_msg/issues
|
|
11
|
+
Project-URL: Documentation, https://github.com/hexfellow/hex_util_msg/wiki
|
|
12
|
+
Keywords: hex,util,message
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: flatbuffers>=25.0.0
|
|
28
|
+
Requires-Dist: numpy>=1.17.4
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
<h1 align="center">HEXFELLOW UTILITY MESSAGES</h1>
|
|
32
|
+
|
|
33
|
+
<p align="center">
|
|
34
|
+
<a href="https://github.com/hexfellow/hex_util_msg/stargazers">
|
|
35
|
+
<img src="https://img.shields.io/github/stars/hexfellow/hex_util_msg?style=flat-square&logo=github" />
|
|
36
|
+
</a>
|
|
37
|
+
<a href="https://github.com/hexfellow/hex_util_msg/forks">
|
|
38
|
+
<img src="https://img.shields.io/github/forks/hexfellow/hex_util_msg?style=flat-square&logo=github" />
|
|
39
|
+
</a>
|
|
40
|
+
|
|
41
|
+
<a href="https://github.com/hexfellow/hex_util_msg/issues">
|
|
42
|
+
<img src="https://img.shields.io/github/issues/hexfellow/hex_util_msg?style=flat-square&logo=github" />
|
|
43
|
+
</a>
|
|
44
|
+
|
|
45
|
+
<img src="https://img.shields.io/badge/python-≥3.8-blue?style=flat-square&logo=python" />
|
|
46
|
+
|
|
47
|
+
<img src="https://img.shields.io/badge/platform-Linux-orange?style=flat-square" />
|
|
48
|
+
</p>
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
# 📖 Overview
|
|
53
|
+
|
|
54
|
+
## What is `hex_util_msg`
|
|
55
|
+
|
|
56
|
+
`hex_util_msg` is a Python message library that provides [FlatBuffers](https://flatbuffers.dev/) message definitions and high-level dataclass-based helpers for robotics and teleoperation. It is part of the HEXFELLOW ecosystem.
|
|
57
|
+
|
|
58
|
+
The library consists of three layers:
|
|
59
|
+
|
|
60
|
+
| Layer | Subpackage | Purpose |
|
|
61
|
+
|-------|-----------|---------|
|
|
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
|
+
| **FlatBuffers** | `hex_util_msg.fbs` | Auto-generated FlatBuffers Python bindings for 4 namespaces (`msg_base`, `msg_robo`, `msg_teleop`, `msg_envelope`) |
|
|
65
|
+
|
|
66
|
+
## Message Categories
|
|
67
|
+
|
|
68
|
+
| Category | Robot Subsystem | Message Pairs |
|
|
69
|
+
|----------|----------------|---------------|
|
|
70
|
+
| **Arm** | Robotic arm (7-DOF) | `Ctrl` / `State` (each with `Stamped` variant) |
|
|
71
|
+
| **Chassis** | Mobile base | `Ctrl` / `State` (each with `Stamped` variant) |
|
|
72
|
+
| **Grip** | Gripper/end-effector | `Ctrl` / `State` (each with `Stamped` variant) |
|
|
73
|
+
| **Lift** | Vertical lift | `Ctrl` / `State` (each with `Stamped` variant) |
|
|
74
|
+
| **Manip** | Composite arm+grip | `Ctrl` / `State` (each with `Stamped` variant) |
|
|
75
|
+
| **Teleop** | Teleoperation handle | `HandleCtrl` / `HandleState` (each with `Stamped` variant) |
|
|
76
|
+
| **Joystick** | Teleoperation joystick | `JoystickState` / `JoystickStateStamped` |
|
|
77
|
+
| **Keyboard** | Teleoperation keyboard | `KeyboardState` / `KeyboardStateStamped` |
|
|
78
|
+
| **Base** | Geometry & time | `Vector3`, `Quaternion`, `Pose`, `Twist`, `Time`, `Header`, `Odometry`, `JntState`, `JntFull` |
|
|
79
|
+
|
|
80
|
+
## What problem it solves
|
|
81
|
+
|
|
82
|
+
- **Zero-copy deserialization**: FlatBuffers enables direct memory access on the receiving end without decode overhead.
|
|
83
|
+
- **Type-safe dataclass API**: Work with standard Python dataclasses and numpy arrays — no manual FlatBuffers table construction.
|
|
84
|
+
- **Envelope dispatch**: `HexMsgTrans.dc2fbs()` and `.fbs2dc()` wrap all messages in a self-describing `HexFbsMsgEnvelope` so the receiver auto-detects the message type.
|
|
85
|
+
- **NumPy integration**: Joint fields are `np.float64` / `np.uint8` arrays, natural for scientific and robotics workflows.
|
|
86
|
+
|
|
87
|
+
## Target users
|
|
88
|
+
|
|
89
|
+
- Robotics engineers building control systems with structured inter-process communication.
|
|
90
|
+
- Developers producing or consuming FlatBuffers-encoded data in the HEXFELLOW ecosystem.
|
|
91
|
+
- Anyone needing a standardised, typed message format with zero-copy deserialization.
|
|
92
|
+
|
|
93
|
+
## Project structure
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
hex_util_msg/
|
|
97
|
+
├── hex_util_msg/ # Python package
|
|
98
|
+
│ ├── __init__.py
|
|
99
|
+
│ ├── dataclass/ # Python dataclass definitions
|
|
100
|
+
│ │ ├── __init__.py
|
|
101
|
+
│ │ ├── dataclass_base.py # Base geometry/time/joint types
|
|
102
|
+
│ │ ├── dataclass_robo.py # Robot arm/chassis/grip/lift/manip types
|
|
103
|
+
│ │ └── dataclass_teleop.py # Teleoperation handle types
|
|
104
|
+
│ ├── fbs/ # FlatBuffers-generated Python code
|
|
105
|
+
│ │ ├── msg_base/
|
|
106
|
+
│ │ ├── msg_envelope/
|
|
107
|
+
│ │ ├── msg_robo/
|
|
108
|
+
│ │ └── msg_teleop/
|
|
109
|
+
│ └── trans/ # Dataclass <-> FlatBuffers converters
|
|
110
|
+
│ ├── __init__.py
|
|
111
|
+
│ ├── hex_msg_trans.py # HexMsgTrans class + dispatch tables
|
|
112
|
+
│ ├── trans_base.py
|
|
113
|
+
│ ├── trans_robo.py
|
|
114
|
+
│ └── trans_teleop.py
|
|
115
|
+
├── msgs/ # FlatBuffers schema sources (.fbs)
|
|
116
|
+
│ ├── base.fbs
|
|
117
|
+
│ ├── msg_envelope.fbs
|
|
118
|
+
│ ├── robo_arm_*.fbs # 4 files
|
|
119
|
+
│ ├── robo_chs_*.fbs # 4 files
|
|
120
|
+
│ ├── robo_grip_*.fbs # 4 files
|
|
121
|
+
│ ├── robo_lift_*.fbs # 4 files
|
|
122
|
+
│ ├── robo_manip_*.fbs # 4 files
|
|
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
|
|
128
|
+
├── docs/
|
|
129
|
+
│ └── api.md # Full API reference
|
|
130
|
+
├── tests/ # pytest test suite
|
|
131
|
+
├── generate.sh # Regenerate Python code from .fbs schemas
|
|
132
|
+
├── venv.sh # Set up dev virtual environment
|
|
133
|
+
├── pyproject.toml
|
|
134
|
+
└── LICENSE
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
# 📦 Installation
|
|
140
|
+
|
|
141
|
+
## Requirements
|
|
142
|
+
|
|
143
|
+
- **Python** ≥ 3.8
|
|
144
|
+
- **OS**: Linux
|
|
145
|
+
- **Dependencies**:
|
|
146
|
+
- `flatbuffers ≥ 25.0.0`
|
|
147
|
+
- `numpy ≥ 1.17.4`
|
|
148
|
+
|
|
149
|
+
## Install from Source
|
|
150
|
+
|
|
151
|
+
We use [**uv**](https://github.com/astral-sh/uv) to manage the Python environment. Please install it first.
|
|
152
|
+
|
|
153
|
+
1. Clone and install in editable mode:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
git clone https://github.com/hexfellow/hex_util_msg.git
|
|
157
|
+
cd hex_util_msg
|
|
158
|
+
./venv.sh
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
2. Activate before using:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
source .venv/bin/activate
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
# ⚡ Quick Start
|
|
170
|
+
|
|
171
|
+
## Import and construct dataclasses
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
import numpy as np
|
|
175
|
+
from hex_util_msg.dataclass import (
|
|
176
|
+
HexDcBaseVector3, HexDcBaseQuaternion, HexDcBasePose, HexDcBaseTwist,
|
|
177
|
+
HexDcBaseTime, HexDcBaseHeader,
|
|
178
|
+
HexDcBaseJntState, HexDcBaseJntFull,
|
|
179
|
+
HexDcRoboArmCtrl, HexDcRoboArmCtrlMode, HexDcRoboArmCtrlStamped,
|
|
180
|
+
HexDcRoboArmState, HexDcRoboArmStateStamped,
|
|
181
|
+
HexDcRoboManipCtrl, HexDcRoboManipState,
|
|
182
|
+
HexDcTeleopHandleState,
|
|
183
|
+
)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Serialize and deserialize with `HexMsgTrans`
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
from hex_util_msg.trans import HexMsgTrans
|
|
190
|
+
|
|
191
|
+
# --- Create a stamped arm control message ---
|
|
192
|
+
arm_ctrl = HexDcRoboArmCtrlStamped(
|
|
193
|
+
header=HexDcBaseHeader(
|
|
194
|
+
seq=1,
|
|
195
|
+
stamp=HexDcBaseTime(secs=123, nsecs=456_000_000),
|
|
196
|
+
frame_id="arm_base",
|
|
197
|
+
),
|
|
198
|
+
arm_ctrl=HexDcRoboArmCtrl(
|
|
199
|
+
ctrl_mode=HexDcRoboArmCtrlMode.MIT,
|
|
200
|
+
grav=HexDcBaseVector3(x=0.0, y=0.0, z=9.81),
|
|
201
|
+
jnt=HexDcBaseJntFull(
|
|
202
|
+
pos=np.zeros(7, dtype=np.float64),
|
|
203
|
+
vel=np.zeros(7, dtype=np.float64),
|
|
204
|
+
eff=np.zeros(7, dtype=np.float64),
|
|
205
|
+
kp=np.full(7, 100.0, dtype=np.float64),
|
|
206
|
+
kd=np.full(7, 10.0, dtype=np.float64),
|
|
207
|
+
lim_vel=np.zeros(7, dtype=np.float64),
|
|
208
|
+
lim_acc=np.zeros(7, dtype=np.float64),
|
|
209
|
+
),
|
|
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),
|
|
213
|
+
),
|
|
214
|
+
),
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
# Serialize to bytes
|
|
218
|
+
buf = HexMsgTrans.dc2fbs(arm_ctrl)
|
|
219
|
+
|
|
220
|
+
# Deserialize back — type is auto-detected from the envelope
|
|
221
|
+
restored = HexMsgTrans.fbs2dc(buf)
|
|
222
|
+
|
|
223
|
+
# restored is a HexDcRoboArmCtrlStamped dataclass
|
|
224
|
+
print(restored.header.seq) # 1
|
|
225
|
+
print(restored.arm_ctrl.ctrl_mode) # HexDcRoboArmCtrlMode.MIT
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Arm state
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
arm_state = HexDcRoboArmStateStamped(
|
|
232
|
+
header=HexDcBaseHeader(seq=0, stamp=HexDcBaseTime(secs=0), frame_id=""),
|
|
233
|
+
arm_state=HexDcRoboArmState(
|
|
234
|
+
jnt=HexDcBaseJntState(
|
|
235
|
+
position=np.array([0.0, 0.25, 0.5], dtype=np.float64),
|
|
236
|
+
velocity=np.array([0.0, 0.0, 0.0], dtype=np.float64),
|
|
237
|
+
effort=np.zeros(3, dtype=np.float64),
|
|
238
|
+
),
|
|
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),
|
|
242
|
+
),
|
|
243
|
+
),
|
|
244
|
+
)
|
|
245
|
+
buf = HexMsgTrans.dc2fbs(arm_state)
|
|
246
|
+
restored = HexMsgTrans.fbs2dc(buf)
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## Teleop handle state
|
|
250
|
+
|
|
251
|
+
```python
|
|
252
|
+
handle = HexDcTeleopHandleState(
|
|
253
|
+
trigger=0.5,
|
|
254
|
+
axis_x=0.3,
|
|
255
|
+
axis_y=-0.2,
|
|
256
|
+
btn_w=True,
|
|
257
|
+
btn_x=False,
|
|
258
|
+
btn_y=False,
|
|
259
|
+
btn_z=False,
|
|
260
|
+
)
|
|
261
|
+
buf = HexMsgTrans.dc2fbs(handle)
|
|
262
|
+
restored = HexMsgTrans.fbs2dc(buf)
|
|
263
|
+
# restored.btn_w == True, restored.trigger == 0.5
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Manipulator (composite arm + grip)
|
|
267
|
+
|
|
268
|
+
```python
|
|
269
|
+
manip_state = HexDcRoboManipState(
|
|
270
|
+
arm_state=HexDcRoboArmState(
|
|
271
|
+
jnt=HexDcBaseJntState(
|
|
272
|
+
position=np.zeros(7, dtype=np.float64),
|
|
273
|
+
),
|
|
274
|
+
),
|
|
275
|
+
grip_state=HexDcRoboGripState(
|
|
276
|
+
jnt=HexDcBaseJntState(
|
|
277
|
+
position=np.zeros(1, dtype=np.float64),
|
|
278
|
+
),
|
|
279
|
+
),
|
|
280
|
+
)
|
|
281
|
+
buf = HexMsgTrans.dc2fbs(manip_state)
|
|
282
|
+
restored = HexMsgTrans.fbs2dc(buf)
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
# 📑 Documentation
|
|
288
|
+
|
|
289
|
+
- [**API Reference**](docs/api.md) — Detailed documentation of all dataclasses, enums, and converter functions.
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
# 🔧 Development
|
|
294
|
+
|
|
295
|
+
## Environment setup
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
./venv.sh
|
|
299
|
+
source .venv/bin/activate
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Regenerating code from schemas
|
|
303
|
+
|
|
304
|
+
If you modify `.fbs` files under `msgs/`, regenerate the Python bindings:
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
# Requires flatc (FlatBuffers compiler) on PATH
|
|
308
|
+
./generate.sh
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
This removes existing generated directories and re-runs `flatc --python` for all namespaces.
|
|
312
|
+
|
|
313
|
+
## Testing
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
pytest tests/ -v
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
# 📄 License
|
|
322
|
+
|
|
323
|
+
Apache License 2.0. See [LICENSE](LICENSE).
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
# 👥 Authors & Maintainers
|
|
328
|
+
|
|
329
|
+
| Role | Name | Email |
|
|
330
|
+
|------|------|-------|
|
|
331
|
+
| **Author** | Dong Zhaorui | dzr159@gmail.com |
|
|
332
|
+
| **Maintainer** | jecjune (Chen Zejun) | zejun.chen@hexfellow.com |
|
|
333
|
+
| **Maintainer** | Dong Zhaorui | dzr159@gmail.com |
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
# 🌟 Star History
|
|
338
|
+
|
|
339
|
+
[](https://star-history.com/#hexfellow/hex_util_msg&Date)
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
# 👥 Contributors
|
|
344
|
+
|
|
345
|
+
<a href="https://github.com/hexfellow/hex_util_msg/graphs/contributors">
|
|
346
|
+
<img src="https://contrib.rocks/image?repo=hexfellow/hex_util_msg" />
|
|
347
|
+
</a>
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
<h1 align="center">HEXFELLOW UTILITY MESSAGES</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://github.com/hexfellow/hex_util_msg/stargazers">
|
|
5
|
+
<img src="https://img.shields.io/github/stars/hexfellow/hex_util_msg?style=flat-square&logo=github" />
|
|
6
|
+
</a>
|
|
7
|
+
<a href="https://github.com/hexfellow/hex_util_msg/forks">
|
|
8
|
+
<img src="https://img.shields.io/github/forks/hexfellow/hex_util_msg?style=flat-square&logo=github" />
|
|
9
|
+
</a>
|
|
10
|
+
|
|
11
|
+
<a href="https://github.com/hexfellow/hex_util_msg/issues">
|
|
12
|
+
<img src="https://img.shields.io/github/issues/hexfellow/hex_util_msg?style=flat-square&logo=github" />
|
|
13
|
+
</a>
|
|
14
|
+
|
|
15
|
+
<img src="https://img.shields.io/badge/python-≥3.8-blue?style=flat-square&logo=python" />
|
|
16
|
+
|
|
17
|
+
<img src="https://img.shields.io/badge/platform-Linux-orange?style=flat-square" />
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# 📖 Overview
|
|
23
|
+
|
|
24
|
+
## What is `hex_util_msg`
|
|
25
|
+
|
|
26
|
+
`hex_util_msg` is a Python message library that provides [FlatBuffers](https://flatbuffers.dev/) message definitions and high-level dataclass-based helpers for robotics and teleoperation. It is part of the HEXFELLOW ecosystem.
|
|
27
|
+
|
|
28
|
+
The library consists of three layers:
|
|
29
|
+
|
|
30
|
+
| Layer | Subpackage | Purpose |
|
|
31
|
+
|-------|-----------|---------|
|
|
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
|
+
| **FlatBuffers** | `hex_util_msg.fbs` | Auto-generated FlatBuffers Python bindings for 4 namespaces (`msg_base`, `msg_robo`, `msg_teleop`, `msg_envelope`) |
|
|
35
|
+
|
|
36
|
+
## Message Categories
|
|
37
|
+
|
|
38
|
+
| Category | Robot Subsystem | Message Pairs |
|
|
39
|
+
|----------|----------------|---------------|
|
|
40
|
+
| **Arm** | Robotic arm (7-DOF) | `Ctrl` / `State` (each with `Stamped` variant) |
|
|
41
|
+
| **Chassis** | Mobile base | `Ctrl` / `State` (each with `Stamped` variant) |
|
|
42
|
+
| **Grip** | Gripper/end-effector | `Ctrl` / `State` (each with `Stamped` variant) |
|
|
43
|
+
| **Lift** | Vertical lift | `Ctrl` / `State` (each with `Stamped` variant) |
|
|
44
|
+
| **Manip** | Composite arm+grip | `Ctrl` / `State` (each with `Stamped` variant) |
|
|
45
|
+
| **Teleop** | Teleoperation handle | `HandleCtrl` / `HandleState` (each with `Stamped` variant) |
|
|
46
|
+
| **Joystick** | Teleoperation joystick | `JoystickState` / `JoystickStateStamped` |
|
|
47
|
+
| **Keyboard** | Teleoperation keyboard | `KeyboardState` / `KeyboardStateStamped` |
|
|
48
|
+
| **Base** | Geometry & time | `Vector3`, `Quaternion`, `Pose`, `Twist`, `Time`, `Header`, `Odometry`, `JntState`, `JntFull` |
|
|
49
|
+
|
|
50
|
+
## What problem it solves
|
|
51
|
+
|
|
52
|
+
- **Zero-copy deserialization**: FlatBuffers enables direct memory access on the receiving end without decode overhead.
|
|
53
|
+
- **Type-safe dataclass API**: Work with standard Python dataclasses and numpy arrays — no manual FlatBuffers table construction.
|
|
54
|
+
- **Envelope dispatch**: `HexMsgTrans.dc2fbs()` and `.fbs2dc()` wrap all messages in a self-describing `HexFbsMsgEnvelope` so the receiver auto-detects the message type.
|
|
55
|
+
- **NumPy integration**: Joint fields are `np.float64` / `np.uint8` arrays, natural for scientific and robotics workflows.
|
|
56
|
+
|
|
57
|
+
## Target users
|
|
58
|
+
|
|
59
|
+
- Robotics engineers building control systems with structured inter-process communication.
|
|
60
|
+
- Developers producing or consuming FlatBuffers-encoded data in the HEXFELLOW ecosystem.
|
|
61
|
+
- Anyone needing a standardised, typed message format with zero-copy deserialization.
|
|
62
|
+
|
|
63
|
+
## Project structure
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
hex_util_msg/
|
|
67
|
+
├── hex_util_msg/ # Python package
|
|
68
|
+
│ ├── __init__.py
|
|
69
|
+
│ ├── dataclass/ # Python dataclass definitions
|
|
70
|
+
│ │ ├── __init__.py
|
|
71
|
+
│ │ ├── dataclass_base.py # Base geometry/time/joint types
|
|
72
|
+
│ │ ├── dataclass_robo.py # Robot arm/chassis/grip/lift/manip types
|
|
73
|
+
│ │ └── dataclass_teleop.py # Teleoperation handle types
|
|
74
|
+
│ ├── fbs/ # FlatBuffers-generated Python code
|
|
75
|
+
│ │ ├── msg_base/
|
|
76
|
+
│ │ ├── msg_envelope/
|
|
77
|
+
│ │ ├── msg_robo/
|
|
78
|
+
│ │ └── msg_teleop/
|
|
79
|
+
│ └── trans/ # Dataclass <-> FlatBuffers converters
|
|
80
|
+
│ ├── __init__.py
|
|
81
|
+
│ ├── hex_msg_trans.py # HexMsgTrans class + dispatch tables
|
|
82
|
+
│ ├── trans_base.py
|
|
83
|
+
│ ├── trans_robo.py
|
|
84
|
+
│ └── trans_teleop.py
|
|
85
|
+
├── msgs/ # FlatBuffers schema sources (.fbs)
|
|
86
|
+
│ ├── base.fbs
|
|
87
|
+
│ ├── msg_envelope.fbs
|
|
88
|
+
│ ├── robo_arm_*.fbs # 4 files
|
|
89
|
+
│ ├── robo_chs_*.fbs # 4 files
|
|
90
|
+
│ ├── robo_grip_*.fbs # 4 files
|
|
91
|
+
│ ├── robo_lift_*.fbs # 4 files
|
|
92
|
+
│ ├── robo_manip_*.fbs # 4 files
|
|
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
|
|
98
|
+
├── docs/
|
|
99
|
+
│ └── api.md # Full API reference
|
|
100
|
+
├── tests/ # pytest test suite
|
|
101
|
+
├── generate.sh # Regenerate Python code from .fbs schemas
|
|
102
|
+
├── venv.sh # Set up dev virtual environment
|
|
103
|
+
├── pyproject.toml
|
|
104
|
+
└── LICENSE
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
# 📦 Installation
|
|
110
|
+
|
|
111
|
+
## Requirements
|
|
112
|
+
|
|
113
|
+
- **Python** ≥ 3.8
|
|
114
|
+
- **OS**: Linux
|
|
115
|
+
- **Dependencies**:
|
|
116
|
+
- `flatbuffers ≥ 25.0.0`
|
|
117
|
+
- `numpy ≥ 1.17.4`
|
|
118
|
+
|
|
119
|
+
## Install from Source
|
|
120
|
+
|
|
121
|
+
We use [**uv**](https://github.com/astral-sh/uv) to manage the Python environment. Please install it first.
|
|
122
|
+
|
|
123
|
+
1. Clone and install in editable mode:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
git clone https://github.com/hexfellow/hex_util_msg.git
|
|
127
|
+
cd hex_util_msg
|
|
128
|
+
./venv.sh
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
2. Activate before using:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
source .venv/bin/activate
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
# ⚡ Quick Start
|
|
140
|
+
|
|
141
|
+
## Import and construct dataclasses
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
import numpy as np
|
|
145
|
+
from hex_util_msg.dataclass import (
|
|
146
|
+
HexDcBaseVector3, HexDcBaseQuaternion, HexDcBasePose, HexDcBaseTwist,
|
|
147
|
+
HexDcBaseTime, HexDcBaseHeader,
|
|
148
|
+
HexDcBaseJntState, HexDcBaseJntFull,
|
|
149
|
+
HexDcRoboArmCtrl, HexDcRoboArmCtrlMode, HexDcRoboArmCtrlStamped,
|
|
150
|
+
HexDcRoboArmState, HexDcRoboArmStateStamped,
|
|
151
|
+
HexDcRoboManipCtrl, HexDcRoboManipState,
|
|
152
|
+
HexDcTeleopHandleState,
|
|
153
|
+
)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Serialize and deserialize with `HexMsgTrans`
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
from hex_util_msg.trans import HexMsgTrans
|
|
160
|
+
|
|
161
|
+
# --- Create a stamped arm control message ---
|
|
162
|
+
arm_ctrl = HexDcRoboArmCtrlStamped(
|
|
163
|
+
header=HexDcBaseHeader(
|
|
164
|
+
seq=1,
|
|
165
|
+
stamp=HexDcBaseTime(secs=123, nsecs=456_000_000),
|
|
166
|
+
frame_id="arm_base",
|
|
167
|
+
),
|
|
168
|
+
arm_ctrl=HexDcRoboArmCtrl(
|
|
169
|
+
ctrl_mode=HexDcRoboArmCtrlMode.MIT,
|
|
170
|
+
grav=HexDcBaseVector3(x=0.0, y=0.0, z=9.81),
|
|
171
|
+
jnt=HexDcBaseJntFull(
|
|
172
|
+
pos=np.zeros(7, dtype=np.float64),
|
|
173
|
+
vel=np.zeros(7, dtype=np.float64),
|
|
174
|
+
eff=np.zeros(7, dtype=np.float64),
|
|
175
|
+
kp=np.full(7, 100.0, dtype=np.float64),
|
|
176
|
+
kd=np.full(7, 10.0, dtype=np.float64),
|
|
177
|
+
lim_vel=np.zeros(7, dtype=np.float64),
|
|
178
|
+
lim_acc=np.zeros(7, dtype=np.float64),
|
|
179
|
+
),
|
|
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),
|
|
183
|
+
),
|
|
184
|
+
),
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
# Serialize to bytes
|
|
188
|
+
buf = HexMsgTrans.dc2fbs(arm_ctrl)
|
|
189
|
+
|
|
190
|
+
# Deserialize back — type is auto-detected from the envelope
|
|
191
|
+
restored = HexMsgTrans.fbs2dc(buf)
|
|
192
|
+
|
|
193
|
+
# restored is a HexDcRoboArmCtrlStamped dataclass
|
|
194
|
+
print(restored.header.seq) # 1
|
|
195
|
+
print(restored.arm_ctrl.ctrl_mode) # HexDcRoboArmCtrlMode.MIT
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Arm state
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
arm_state = HexDcRoboArmStateStamped(
|
|
202
|
+
header=HexDcBaseHeader(seq=0, stamp=HexDcBaseTime(secs=0), frame_id=""),
|
|
203
|
+
arm_state=HexDcRoboArmState(
|
|
204
|
+
jnt=HexDcBaseJntState(
|
|
205
|
+
position=np.array([0.0, 0.25, 0.5], dtype=np.float64),
|
|
206
|
+
velocity=np.array([0.0, 0.0, 0.0], dtype=np.float64),
|
|
207
|
+
effort=np.zeros(3, dtype=np.float64),
|
|
208
|
+
),
|
|
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),
|
|
212
|
+
),
|
|
213
|
+
),
|
|
214
|
+
)
|
|
215
|
+
buf = HexMsgTrans.dc2fbs(arm_state)
|
|
216
|
+
restored = HexMsgTrans.fbs2dc(buf)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Teleop handle state
|
|
220
|
+
|
|
221
|
+
```python
|
|
222
|
+
handle = HexDcTeleopHandleState(
|
|
223
|
+
trigger=0.5,
|
|
224
|
+
axis_x=0.3,
|
|
225
|
+
axis_y=-0.2,
|
|
226
|
+
btn_w=True,
|
|
227
|
+
btn_x=False,
|
|
228
|
+
btn_y=False,
|
|
229
|
+
btn_z=False,
|
|
230
|
+
)
|
|
231
|
+
buf = HexMsgTrans.dc2fbs(handle)
|
|
232
|
+
restored = HexMsgTrans.fbs2dc(buf)
|
|
233
|
+
# restored.btn_w == True, restored.trigger == 0.5
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Manipulator (composite arm + grip)
|
|
237
|
+
|
|
238
|
+
```python
|
|
239
|
+
manip_state = HexDcRoboManipState(
|
|
240
|
+
arm_state=HexDcRoboArmState(
|
|
241
|
+
jnt=HexDcBaseJntState(
|
|
242
|
+
position=np.zeros(7, dtype=np.float64),
|
|
243
|
+
),
|
|
244
|
+
),
|
|
245
|
+
grip_state=HexDcRoboGripState(
|
|
246
|
+
jnt=HexDcBaseJntState(
|
|
247
|
+
position=np.zeros(1, dtype=np.float64),
|
|
248
|
+
),
|
|
249
|
+
),
|
|
250
|
+
)
|
|
251
|
+
buf = HexMsgTrans.dc2fbs(manip_state)
|
|
252
|
+
restored = HexMsgTrans.fbs2dc(buf)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
# 📑 Documentation
|
|
258
|
+
|
|
259
|
+
- [**API Reference**](docs/api.md) — Detailed documentation of all dataclasses, enums, and converter functions.
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
# 🔧 Development
|
|
264
|
+
|
|
265
|
+
## Environment setup
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
./venv.sh
|
|
269
|
+
source .venv/bin/activate
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Regenerating code from schemas
|
|
273
|
+
|
|
274
|
+
If you modify `.fbs` files under `msgs/`, regenerate the Python bindings:
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
# Requires flatc (FlatBuffers compiler) on PATH
|
|
278
|
+
./generate.sh
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
This removes existing generated directories and re-runs `flatc --python` for all namespaces.
|
|
282
|
+
|
|
283
|
+
## Testing
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
pytest tests/ -v
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
# 📄 License
|
|
292
|
+
|
|
293
|
+
Apache License 2.0. See [LICENSE](LICENSE).
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
# 👥 Authors & Maintainers
|
|
298
|
+
|
|
299
|
+
| Role | Name | Email |
|
|
300
|
+
|------|------|-------|
|
|
301
|
+
| **Author** | Dong Zhaorui | dzr159@gmail.com |
|
|
302
|
+
| **Maintainer** | jecjune (Chen Zejun) | zejun.chen@hexfellow.com |
|
|
303
|
+
| **Maintainer** | Dong Zhaorui | dzr159@gmail.com |
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
# 🌟 Star History
|
|
308
|
+
|
|
309
|
+
[](https://star-history.com/#hexfellow/hex_util_msg&Date)
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
# 👥 Contributors
|
|
314
|
+
|
|
315
|
+
<a href="https://github.com/hexfellow/hex_util_msg/graphs/contributors">
|
|
316
|
+
<img src="https://contrib.rocks/image?repo=hexfellow/hex_util_msg" />
|
|
317
|
+
</a>
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
import sys
|
|
10
|
+
|
|
11
|
+
# FlatBuffers-generated Python uses bare ``import msg_robo / msg_teleop / msg_base``.
|
|
12
|
+
from hex_util_msg.fbs import msg_envelope # noqa: E402
|
|
13
|
+
from hex_util_msg.fbs import msg_robo # noqa: E402
|
|
14
|
+
from hex_util_msg.fbs import msg_teleop # noqa: E402
|
|
15
|
+
from hex_util_msg.fbs import msg_base # noqa: E402
|
|
16
|
+
|
|
17
|
+
sys.modules.setdefault("msg_envelope", msg_envelope)
|
|
18
|
+
sys.modules.setdefault("msg_robo", msg_robo)
|
|
19
|
+
sys.modules.setdefault("msg_teleop", msg_teleop)
|
|
20
|
+
sys.modules.setdefault("msg_base", msg_base)
|
|
21
|
+
|
|
22
|
+
from hex_util_msg.dataclass import dataclass_base # noqa: E402
|
|
23
|
+
from hex_util_msg.dataclass import dataclass_robo # noqa: E402
|
|
24
|
+
from hex_util_msg.dataclass import dataclass_teleop # noqa: E402
|
|
25
|
+
from hex_util_msg.trans import trans_base # noqa: E402
|
|
26
|
+
from hex_util_msg.trans import trans_robo # noqa: E402
|
|
27
|
+
from hex_util_msg.trans import trans_teleop # noqa: E402
|
|
28
|
+
|
|
29
|
+
__all__ = [
|
|
30
|
+
"dataclass_base",
|
|
31
|
+
"dataclass_robo",
|
|
32
|
+
"dataclass_teleop",
|
|
33
|
+
"msg_robo",
|
|
34
|
+
"msg_teleop",
|
|
35
|
+
"msg_base",
|
|
36
|
+
"trans_base",
|
|
37
|
+
"trans_robo",
|
|
38
|
+
"trans_teleop",
|
|
39
|
+
]
|