osiris-agent 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.
- osiris_agent-0.1.0/LICENSE +190 -0
- osiris_agent-0.1.0/PKG-INFO +315 -0
- osiris_agent-0.1.0/README.md +281 -0
- osiris_agent-0.1.0/osiris_agent/__init__.py +5 -0
- osiris_agent-0.1.0/osiris_agent/agent_node.py +967 -0
- osiris_agent-0.1.0/osiris_agent.egg-info/PKG-INFO +315 -0
- osiris_agent-0.1.0/osiris_agent.egg-info/SOURCES.txt +12 -0
- osiris_agent-0.1.0/osiris_agent.egg-info/dependency_links.txt +1 -0
- osiris_agent-0.1.0/osiris_agent.egg-info/entry_points.txt +2 -0
- osiris_agent-0.1.0/osiris_agent.egg-info/requires.txt +5 -0
- osiris_agent-0.1.0/osiris_agent.egg-info/top_level.txt +1 -0
- osiris_agent-0.1.0/setup.cfg +4 -0
- osiris_agent-0.1.0/setup.py +39 -0
- osiris_agent-0.1.0/tests/test_agent_node.py +2 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2025 nicolaselielll
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: osiris_agent
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: OSIRIS agent for ROS2/Humble
|
|
5
|
+
Home-page: https://github.com/nicolaselielll/osiris_agent
|
|
6
|
+
Author: Nicolas Tuomaala
|
|
7
|
+
Author-email: nicolas.tuomaala00@gmail.com
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Keywords: ros2 humble agent
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: websockets
|
|
19
|
+
Requires-Dist: psutil
|
|
20
|
+
Provides-Extra: ros
|
|
21
|
+
Requires-Dist: rclpy; extra == "ros"
|
|
22
|
+
Dynamic: author
|
|
23
|
+
Dynamic: author-email
|
|
24
|
+
Dynamic: classifier
|
|
25
|
+
Dynamic: description
|
|
26
|
+
Dynamic: description-content-type
|
|
27
|
+
Dynamic: home-page
|
|
28
|
+
Dynamic: keywords
|
|
29
|
+
Dynamic: license
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
Dynamic: provides-extra
|
|
32
|
+
Dynamic: requires-dist
|
|
33
|
+
Dynamic: summary
|
|
34
|
+
|
|
35
|
+
# OSIRIS Agent
|
|
36
|
+
|
|
37
|
+
A ROS2 Humble node that bridges your robot to the OSIRIS remote monitoring platform via WebSocket.
|
|
38
|
+
|
|
39
|
+
## Overview
|
|
40
|
+
|
|
41
|
+
The OSIRIS Agent (`osiris_agent`) is a ROS2 node that provides real-time bidirectional communication between your ROS2 robot and a remote WebSocket gateway. It monitors the ROS2 graph, collects system telemetry, and enables dynamic topic subscription from the remote platform.
|
|
42
|
+
|
|
43
|
+
## Features
|
|
44
|
+
|
|
45
|
+
### Real-time Graph Monitoring
|
|
46
|
+
- **Node Detection**: Automatically detects when ROS2 nodes start/stop
|
|
47
|
+
- **Topic Tracking**: Monitors topic creation, destruction, and subscription changes
|
|
48
|
+
- **Action Discovery**: Tracks ROS2 actions and their lifecycle
|
|
49
|
+
- **Service Discovery**: Detects available services and their endpoints
|
|
50
|
+
- **Publisher/Subscriber Relations**: Maps which nodes publish to and subscribe from each topic
|
|
51
|
+
|
|
52
|
+
### Dynamic Topic Subscription
|
|
53
|
+
- Subscribe to any ROS2 topic remotely via WebSocket commands
|
|
54
|
+
- Automatic message type resolution and serialization
|
|
55
|
+
- Configurable subscription limits (default: 100 concurrent subscriptions)
|
|
56
|
+
- Thread-safe subscription management
|
|
57
|
+
- Topic publishing rate calculation
|
|
58
|
+
|
|
59
|
+
### Node Parameters
|
|
60
|
+
- Automatic discovery of node parameters
|
|
61
|
+
- Periodic parameter refresh (every 5 seconds)
|
|
62
|
+
- Asynchronous parameter fetching to avoid blocking
|
|
63
|
+
|
|
64
|
+
### System Telemetry
|
|
65
|
+
- CPU usage monitoring
|
|
66
|
+
- Memory (RAM) utilization tracking
|
|
67
|
+
- Disk space monitoring
|
|
68
|
+
- Enable/disable telemetry on demand
|
|
69
|
+
|
|
70
|
+
### Quality of Service (QoS) Support
|
|
71
|
+
- Full QoS profile inspection for publishers and subscribers
|
|
72
|
+
- Reliability, durability, history policy, depth, and liveliness information
|
|
73
|
+
|
|
74
|
+
### Robust Connection Management
|
|
75
|
+
- Automatic reconnection with exponential backoff
|
|
76
|
+
- Initial delay: 1 second, max delay: 10 seconds
|
|
77
|
+
- Secure WebSocket (WSS) connection
|
|
78
|
+
- Token-based authentication
|
|
79
|
+
|
|
80
|
+
## Architecture
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
WebBridge Node (osiris_agent)
|
|
84
|
+
│
|
|
85
|
+
├─ Main Thread (rclpy.spin)
|
|
86
|
+
│ ├─ ROS2 Node Callbacks
|
|
87
|
+
│ ├─ Graph Change Detector (timer: 100ms)
|
|
88
|
+
│ ├─ Parameter Refresh (timer: 5s)
|
|
89
|
+
│ └─ Telemetry Collector (timer: 1s)
|
|
90
|
+
│
|
|
91
|
+
└─ Daemon Thread (WebSocket Client)
|
|
92
|
+
└─ Asyncio Event Loop
|
|
93
|
+
├─ Send Loop (queue consumer)
|
|
94
|
+
├─ Receive Loop (command handler)
|
|
95
|
+
└─ Reconnection Logic (exponential backoff)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Key Components:**
|
|
99
|
+
- **Graph Monitor**: Polls ROS2 graph for changes (nodes, topics, actions, services)
|
|
100
|
+
- **Subscription Manager**: Handles dynamic topic subscriptions with `threading.Lock()` for thread-safe access to the subscription dictionary
|
|
101
|
+
- **Telemetry Collector**: Gathers CPU, RAM, and disk metrics using `psutil`
|
|
102
|
+
- **WebSocket Client**: Maintains persistent connection with automatic reconnection
|
|
103
|
+
- **Message Queue**: `asyncio.Queue` created on the websocket event loop for serializing all outgoing messages
|
|
104
|
+
|
|
105
|
+
**Threading Model:**
|
|
106
|
+
- Main thread runs ROS2 executor (`rclpy.spin`) with timers and callbacks
|
|
107
|
+
- Daemon thread runs asyncio event loop with websocket client (send/receive coroutines)
|
|
108
|
+
- Shared data (`_topic_subs`) protected by `threading.Lock` to prevent race conditions
|
|
109
|
+
- Cross-thread communication via `asyncio.run_coroutine_threadsafe()` to schedule coroutines from ROS thread onto websocket loop
|
|
110
|
+
|
|
111
|
+
## Installation
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Clone the repository into your workspace
|
|
115
|
+
cd ~/ros2_ws/src
|
|
116
|
+
git clone https://github.com/nicolaselielll/osiris_agent.git
|
|
117
|
+
|
|
118
|
+
# Install the package
|
|
119
|
+
cd osiris_agent
|
|
120
|
+
pip3 install -e .
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The `-e` flag installs in editable mode so changes to the code are reflected immediately.
|
|
124
|
+
|
|
125
|
+
## Configuration
|
|
126
|
+
|
|
127
|
+
Set your authentication token as an environment variable:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
export OSIRIS_AUTH_TOKEN="your-robot-token-here"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Tip**: Add to `~/.bashrc` to persist across sessions:
|
|
134
|
+
```bash
|
|
135
|
+
echo 'export OSIRIS_AUTH_TOKEN="your-token"' >> ~/.bashrc
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Optional: Customize Behavior
|
|
139
|
+
|
|
140
|
+
Edit constants in `osiris_agent/agent_node.py`:
|
|
141
|
+
|
|
142
|
+
- `MAX_SUBSCRIPTIONS = 100`: Maximum concurrent topic subscriptions
|
|
143
|
+
- `ALLOWED_TOPIC_PREFIXES = ['/']`: Restrict subscribable topics (e.g., `['/robot/', '/sensors/']`)
|
|
144
|
+
- `GRAPH_CHECK_INTERVAL = 0.1`: Graph polling interval (seconds)
|
|
145
|
+
- `PARAMETER_REFRESH_INTERVAL = 5.0`: Parameter refresh interval (seconds)
|
|
146
|
+
- `TELEMETRY_INTERVAL = 1.0`: Telemetry collection interval (seconds)
|
|
147
|
+
|
|
148
|
+
## Running
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
export OSIRIS_AUTH_TOKEN="your-token"
|
|
152
|
+
agent_node
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
You should see:
|
|
156
|
+
```
|
|
157
|
+
[INFO] [bridge_node]: Attempting to connect to gateway...
|
|
158
|
+
[INFO] [bridge_node]: Connected to gateway
|
|
159
|
+
[INFO] [bridge_node]: Sent initial state: 5 nodes, 12 topics, 0 actions, 8 services
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Updating
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
cd ~/ros2_ws/src/osiris_agent
|
|
166
|
+
git pull
|
|
167
|
+
# Changes apply immediately if installed with -e
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## WebSocket Protocol
|
|
171
|
+
|
|
172
|
+
### Commands (Gateway → Agent)
|
|
173
|
+
|
|
174
|
+
**Subscribe to Topic**
|
|
175
|
+
```json
|
|
176
|
+
{"type": "subscribe", "topic": "/cmd_vel"}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Unsubscribe**
|
|
180
|
+
```json
|
|
181
|
+
{"type": "unsubscribe", "topic": "/cmd_vel"}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Control Telemetry**
|
|
185
|
+
```json
|
|
186
|
+
{"type": "start_telemetry"}
|
|
187
|
+
{"type": "stop_telemetry"}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Events (Agent → Gateway)
|
|
191
|
+
|
|
192
|
+
**Initial State** (on connect)
|
|
193
|
+
```json
|
|
194
|
+
{
|
|
195
|
+
"type": "initial_state",
|
|
196
|
+
"timestamp": 1234567890.123,
|
|
197
|
+
"data": {
|
|
198
|
+
"nodes": {},
|
|
199
|
+
"topics": {},
|
|
200
|
+
"actions": {},
|
|
201
|
+
"services": {},
|
|
202
|
+
"telemetry": {}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Graph Changes**
|
|
208
|
+
```json
|
|
209
|
+
{"type": "node_event", "node": "/my_node", "event": "started", "timestamp": 123}
|
|
210
|
+
{"type": "topic_event", "topic": "/my_topic", "event": "created", "timestamp": 123}
|
|
211
|
+
{"type": "action_event", "action": "/my_action", "event": "created", "timestamp": 123}
|
|
212
|
+
{"type": "service_event", "service": "/my_service", "event": "created", "timestamp": 123}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
**Topic Data**
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"type": "topic_data",
|
|
219
|
+
"topic": "/cmd_vel",
|
|
220
|
+
"data": {"linear": {"x": 1.0}, "angular": {"z": 0.5}},
|
|
221
|
+
"rate_hz": 10.0,
|
|
222
|
+
"timestamp": 123
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Telemetry**
|
|
227
|
+
```json
|
|
228
|
+
{
|
|
229
|
+
"type": "telemetry",
|
|
230
|
+
"data": {
|
|
231
|
+
"cpu": 45.2,
|
|
232
|
+
"ram": {"percent": 62.5, "used_mb": 5000, "total_mb": 8000},
|
|
233
|
+
"disk": {"percent": 75.0, "used_gb": 150, "total_gb": 200}
|
|
234
|
+
},
|
|
235
|
+
"timestamp": 123
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**Bridge Subscriptions**
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"type": "bridge_subscriptions",
|
|
243
|
+
"subscriptions": ["/topic1", "/topic2"],
|
|
244
|
+
"timestamp": 123
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Troubleshooting
|
|
249
|
+
|
|
250
|
+
**ModuleNotFoundError: websockets or psutil**
|
|
251
|
+
```bash
|
|
252
|
+
pip3 install -e .
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**Connection drops**
|
|
256
|
+
- Check firewall allows outbound HTTPS to `osiris-gateway.fly.dev:443`
|
|
257
|
+
- View logs: `journalctl -u osiris-agent -f`
|
|
258
|
+
|
|
259
|
+
**High CPU usage**
|
|
260
|
+
- Increase `GRAPH_CHECK_INTERVAL` to `0.5` or `1.0`
|
|
261
|
+
- Reduce `PARAMETER_REFRESH_INTERVAL` to `10.0`
|
|
262
|
+
- Disable telemetry when not needed
|
|
263
|
+
|
|
264
|
+
**Topics not appearing**
|
|
265
|
+
- Verify topic exists: `ros2 topic list`
|
|
266
|
+
- Check logs for validation warnings
|
|
267
|
+
- Ensure under `MAX_SUBSCRIPTIONS` limit
|
|
268
|
+
|
|
269
|
+
## Performance Tuning
|
|
270
|
+
|
|
271
|
+
**Large graphs (100+ nodes/topics)**
|
|
272
|
+
```python
|
|
273
|
+
GRAPH_CHECK_INTERVAL = 0.5
|
|
274
|
+
PARAMETER_REFRESH_INTERVAL = 10.0
|
|
275
|
+
MAX_SUBSCRIPTIONS = 50
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**Resource-constrained robots**
|
|
279
|
+
```python
|
|
280
|
+
GRAPH_CHECK_INTERVAL = 1.0
|
|
281
|
+
PARAMETER_REFRESH_INTERVAL = 15.0
|
|
282
|
+
TELEMETRY_INTERVAL = 2.0
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Restrict topic access**
|
|
286
|
+
```python
|
|
287
|
+
ALLOWED_TOPIC_PREFIXES = ['/robot/', '/sensors/']
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Security
|
|
291
|
+
|
|
292
|
+
- Auth token sent via WSS (encrypted in transit)
|
|
293
|
+
- **Never log `self.ws_url`** - it contains the authentication token in the query parameter
|
|
294
|
+
- Set `ALLOWED_TOPIC_PREFIXES` to restrict which topics can be remotely subscribed
|
|
295
|
+
- `MAX_SUBSCRIPTIONS` prevents resource exhaustion from excessive subscriptions
|
|
296
|
+
- Ensure gateway scrubs tokens from access logs
|
|
297
|
+
|
|
298
|
+
## License
|
|
299
|
+
|
|
300
|
+
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
|
|
301
|
+
|
|
302
|
+
## Contributing
|
|
303
|
+
|
|
304
|
+
Issues and PRs welcome at [github.com/nicolaselielll/osiris_agent](https://github.com/nicolaselielll/osiris_agent)
|
|
305
|
+
|
|
306
|
+
## Changelog
|
|
307
|
+
|
|
308
|
+
### v0.1.0
|
|
309
|
+
- WebSocket bridge with secure WSS connection
|
|
310
|
+
- Real-time graph monitoring
|
|
311
|
+
- Dynamic topic subscription
|
|
312
|
+
- System telemetry (CPU/RAM/disk)
|
|
313
|
+
- Auto-reconnect with exponential backoff
|
|
314
|
+
- Parameter discovery
|
|
315
|
+
- QoS profile inspection
|