dora-rs 0.3.10rc3__cp37-abi3-musllinux_1_2_aarch64.whl → 0.3.11rc1__cp37-abi3-musllinux_1_2_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dora-rs might be problematic. Click here for more details.
- dora/__init__.py +4 -4
- dora/__init__.pyi +171 -147
- dora/cuda.py +9 -11
- dora/dora.abi3.so +0 -0
- {dora_rs-0.3.10rc3.dist-info → dora_rs-0.3.11rc1.dist-info}/METADATA +1 -1
- dora_rs-0.3.11rc1.dist-info/RECORD +8 -0
- {dora_rs-0.3.10rc3.dist-info → dora_rs-0.3.11rc1.dist-info}/WHEEL +1 -1
- dora_rs-0.3.10rc3.dist-info/RECORD +0 -8
dora/__init__.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"""
|
|
2
|
-
# dora-rs
|
|
2
|
+
# dora-rs.
|
|
3
|
+
|
|
3
4
|
This is the dora python client for interacting with dora dataflow.
|
|
4
5
|
You can install it via:
|
|
5
6
|
```bash
|
|
6
7
|
pip install dora-rs
|
|
7
|
-
|
|
8
|
+
```.
|
|
8
9
|
"""
|
|
9
10
|
|
|
10
11
|
from enum import Enum
|
|
@@ -28,8 +29,7 @@ from .dora import (
|
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
class DoraStatus(Enum):
|
|
31
|
-
"""Dora status to indicate if operator `on_input` loop
|
|
32
|
-
should be stopped.
|
|
32
|
+
"""Dora status to indicate if operator `on_input` loop should be stopped.
|
|
33
33
|
|
|
34
34
|
Args:
|
|
35
35
|
Enum (u8): Status signaling to dora operator to
|
dora/__init__.pyi
CHANGED
|
@@ -1,86 +1,100 @@
|
|
|
1
|
-
import dora
|
|
2
|
-
import pyarrow
|
|
3
1
|
import typing
|
|
4
2
|
|
|
3
|
+
import pyarrow
|
|
4
|
+
|
|
5
|
+
import dora
|
|
6
|
+
|
|
5
7
|
@typing.final
|
|
6
8
|
class Enum:
|
|
7
9
|
"""Generic enumeration.
|
|
8
10
|
|
|
9
|
-
Derive from this class to define new enumerations.
|
|
11
|
+
Derive from this class to define new enumerations.
|
|
12
|
+
"""
|
|
13
|
+
|
|
10
14
|
__members__: mappingproxy = ...
|
|
11
15
|
|
|
12
16
|
@typing.final
|
|
13
17
|
class Node:
|
|
14
18
|
"""The custom node API lets you integrate `dora` into your application.
|
|
15
|
-
|
|
19
|
+
|
|
20
|
+
It allows you to retrieve input and send output in any fashion you want.
|
|
16
21
|
|
|
17
|
-
Use with:
|
|
22
|
+
Use with:
|
|
18
23
|
|
|
19
|
-
```python
|
|
20
|
-
from dora import Node
|
|
24
|
+
```python
|
|
25
|
+
from dora import Node
|
|
21
26
|
|
|
22
|
-
node = Node()
|
|
23
|
-
```
|
|
27
|
+
node = Node()
|
|
28
|
+
```
|
|
29
|
+
"""
|
|
24
30
|
|
|
25
31
|
def __init__(self, node_id: str=None) -> None:
|
|
26
|
-
"""
|
|
27
|
-
It allows you to retrieve input and send output in any fashion you want.
|
|
32
|
+
"""Use the custom node API to embed `dora` into your application.
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
It allows you to retrieve input and send output in any fashion you want.
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
from dora import Node
|
|
36
|
+
Use with:
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
```python
|
|
39
|
+
from dora import Node
|
|
40
|
+
|
|
41
|
+
node = Node()
|
|
42
|
+
```
|
|
43
|
+
"""
|
|
36
44
|
|
|
37
45
|
def dataflow_descriptor(self) -> dict:
|
|
38
|
-
"""
|
|
46
|
+
"""Return the full dataflow descriptor that this node is part of.
|
|
39
47
|
|
|
40
|
-
This method returns the parsed dataflow YAML file.
|
|
48
|
+
This method returns the parsed dataflow YAML file.
|
|
49
|
+
"""
|
|
41
50
|
|
|
42
51
|
def dataflow_id(self) -> str:
|
|
43
|
-
"""
|
|
52
|
+
"""Return the dataflow id."""
|
|
44
53
|
|
|
45
54
|
def merge_external_events(self, subscription: dora.Ros2Subscription) -> None:
|
|
46
55
|
"""Merge an external event stream with dora main loop.
|
|
47
|
-
|
|
56
|
+
|
|
57
|
+
This currently only work with ROS2.
|
|
58
|
+
"""
|
|
48
59
|
|
|
49
60
|
def next(self, timeout: float=None) -> dict:
|
|
50
61
|
"""`.next()` gives you the next input that the node has received.
|
|
51
|
-
It blocks until the next event becomes available.
|
|
52
|
-
You can use timeout in seconds to return if no input is available.
|
|
53
|
-
It will return `None` when all senders has been dropped.
|
|
54
62
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
It blocks until the next event becomes available.
|
|
64
|
+
You can use timeout in seconds to return if no input is available.
|
|
65
|
+
It will return `None` when all senders has been dropped.
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
event = node.next()
|
|
69
|
+
```
|
|
58
70
|
|
|
59
|
-
You can also iterate over the event stream with a loop
|
|
71
|
+
You can also iterate over the event stream with a loop
|
|
60
72
|
|
|
61
|
-
```python
|
|
62
|
-
for event in node:
|
|
63
|
-
match event["type"]:
|
|
64
|
-
case "INPUT":
|
|
65
|
-
match event["id"]:
|
|
66
|
-
case "image":
|
|
67
|
-
```
|
|
73
|
+
```python
|
|
74
|
+
for event in node:
|
|
75
|
+
match event["type"]:
|
|
76
|
+
case "INPUT":
|
|
77
|
+
match event["id"]:
|
|
78
|
+
case "image":
|
|
79
|
+
```
|
|
80
|
+
"""
|
|
68
81
|
|
|
69
82
|
def send_output(self, output_id: str, data: pyarrow.Array, metadata: dict=None) -> None:
|
|
70
83
|
"""`send_output` send data from the node.
|
|
71
84
|
|
|
72
|
-
```python
|
|
73
|
-
Args:
|
|
74
|
-
output_id: str,
|
|
75
|
-
data: pyarrow.Array,
|
|
76
|
-
metadata: Option[Dict],
|
|
77
|
-
```
|
|
85
|
+
```python
|
|
86
|
+
Args:
|
|
87
|
+
output_id: str,
|
|
88
|
+
data: pyarrow.Array,
|
|
89
|
+
metadata: Option[Dict],
|
|
90
|
+
```
|
|
78
91
|
|
|
79
|
-
ex:
|
|
92
|
+
ex:
|
|
80
93
|
|
|
81
|
-
```python
|
|
82
|
-
node.send_output("string", b"string", {"open_telemetry_context": "7632e76"})
|
|
83
|
-
```
|
|
94
|
+
```python
|
|
95
|
+
node.send_output("string", b"string", {"open_telemetry_context": "7632e76"})
|
|
96
|
+
```
|
|
97
|
+
"""
|
|
84
98
|
|
|
85
99
|
def __iter__(self) -> typing.Any:
|
|
86
100
|
"""Implement iter(self)."""
|
|
@@ -92,63 +106,66 @@ node.send_output("string", b"string", {"open_telemetry_context": "7632e76"})
|
|
|
92
106
|
class Ros2Context:
|
|
93
107
|
"""ROS2 Context holding all messages definition for receiving and sending messages to ROS2.
|
|
94
108
|
|
|
95
|
-
By default, Ros2Context will use env `AMENT_PREFIX_PATH` to search for message definition.
|
|
109
|
+
By default, Ros2Context will use env `AMENT_PREFIX_PATH` to search for message definition.
|
|
96
110
|
|
|
97
|
-
AMENT_PREFIX_PATH folder structure should be the following:
|
|
111
|
+
AMENT_PREFIX_PATH folder structure should be the following:
|
|
98
112
|
|
|
99
|
-
- For messages: <namespace>/msg/<name>.msg
|
|
100
|
-
- For services: <namespace>/srv/<name>.srv
|
|
113
|
+
- For messages: <namespace>/msg/<name>.msg
|
|
114
|
+
- For services: <namespace>/srv/<name>.srv
|
|
101
115
|
|
|
102
|
-
You can also use `ros_paths` if you don't want to use env variable.
|
|
116
|
+
You can also use `ros_paths` if you don't want to use env variable.
|
|
103
117
|
|
|
104
|
-
warning::
|
|
105
|
-
dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
106
|
-
at any point without it being considered a breaking change.
|
|
118
|
+
warning::
|
|
119
|
+
dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
120
|
+
at any point without it being considered a breaking change.
|
|
107
121
|
|
|
108
|
-
```python
|
|
109
|
-
context = Ros2Context()
|
|
110
|
-
```
|
|
122
|
+
```python
|
|
123
|
+
context = Ros2Context()
|
|
124
|
+
```
|
|
125
|
+
"""
|
|
111
126
|
|
|
112
|
-
def __init__(self, ros_paths:
|
|
127
|
+
def __init__(self, ros_paths: list[str]=None) -> None:
|
|
113
128
|
"""ROS2 Context holding all messages definition for receiving and sending messages to ROS2.
|
|
114
129
|
|
|
115
|
-
By default, Ros2Context will use env `AMENT_PREFIX_PATH` to search for message definition.
|
|
130
|
+
By default, Ros2Context will use env `AMENT_PREFIX_PATH` to search for message definition.
|
|
116
131
|
|
|
117
|
-
AMENT_PREFIX_PATH folder structure should be the following:
|
|
132
|
+
AMENT_PREFIX_PATH folder structure should be the following:
|
|
118
133
|
|
|
119
|
-
- For messages: <namespace>/msg/<name>.msg
|
|
120
|
-
- For services: <namespace>/srv/<name>.srv
|
|
134
|
+
- For messages: <namespace>/msg/<name>.msg
|
|
135
|
+
- For services: <namespace>/srv/<name>.srv
|
|
121
136
|
|
|
122
|
-
You can also use `ros_paths` if you don't want to use env variable.
|
|
137
|
+
You can also use `ros_paths` if you don't want to use env variable.
|
|
123
138
|
|
|
124
|
-
warning::
|
|
125
|
-
dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
126
|
-
at any point without it being considered a breaking change.
|
|
139
|
+
warning::
|
|
140
|
+
dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
141
|
+
at any point without it being considered a breaking change.
|
|
127
142
|
|
|
128
|
-
```python
|
|
129
|
-
context = Ros2Context()
|
|
130
|
-
```
|
|
143
|
+
```python
|
|
144
|
+
context = Ros2Context()
|
|
145
|
+
```
|
|
146
|
+
"""
|
|
131
147
|
|
|
132
148
|
def new_node(self, name: str, namespace: str, options: dora.Ros2NodeOptions) -> dora.Ros2Node:
|
|
133
|
-
"""Create a new ROS2 node
|
|
149
|
+
"""Create a new ROS2 node.
|
|
134
150
|
|
|
135
|
-
```python
|
|
136
|
-
ros2_node = ros2_context.new_node(
|
|
137
|
-
"turtle_teleop",
|
|
138
|
-
"/ros2_demo",
|
|
139
|
-
Ros2NodeOptions(rosout=True),
|
|
140
|
-
)
|
|
141
|
-
```
|
|
151
|
+
```python
|
|
152
|
+
ros2_node = ros2_context.new_node(
|
|
153
|
+
"turtle_teleop",
|
|
154
|
+
"/ros2_demo",
|
|
155
|
+
Ros2NodeOptions(rosout=True),
|
|
156
|
+
)
|
|
157
|
+
```
|
|
142
158
|
|
|
143
|
-
warning::
|
|
144
|
-
dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
145
|
-
at any point without it being considered a breaking change.
|
|
159
|
+
warning::
|
|
160
|
+
dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
161
|
+
at any point without it being considered a breaking change.
|
|
162
|
+
"""
|
|
146
163
|
|
|
147
164
|
@typing.final
|
|
148
165
|
class Ros2Durability:
|
|
149
|
-
"""DDS 2.2.3.4 DURABILITY"""
|
|
166
|
+
"""DDS 2.2.3.4 DURABILITY."""
|
|
150
167
|
|
|
151
|
-
def __eq__(self, value:
|
|
168
|
+
def __eq__(self, value: object) -> bool:
|
|
152
169
|
"""Return self==value."""
|
|
153
170
|
|
|
154
171
|
def __ge__(self, value: typing.Any) -> bool:
|
|
@@ -158,7 +175,7 @@ class Ros2Durability:
|
|
|
158
175
|
"""Return self>value."""
|
|
159
176
|
|
|
160
177
|
def __int__(self) -> None:
|
|
161
|
-
"""int(self)"""
|
|
178
|
+
"""int(self)."""
|
|
162
179
|
|
|
163
180
|
def __le__(self, value: typing.Any) -> bool:
|
|
164
181
|
"""Return self<=value."""
|
|
@@ -166,11 +183,9 @@ class Ros2Durability:
|
|
|
166
183
|
def __lt__(self, value: typing.Any) -> bool:
|
|
167
184
|
"""Return self<value."""
|
|
168
185
|
|
|
169
|
-
def __ne__(self, value:
|
|
186
|
+
def __ne__(self, value: object) -> bool:
|
|
170
187
|
"""Return self!=value."""
|
|
171
188
|
|
|
172
|
-
def __repr__(self) -> str:
|
|
173
|
-
"""Return repr(self)."""
|
|
174
189
|
Persistent: Ros2Durability = ...
|
|
175
190
|
Transient: Ros2Durability = ...
|
|
176
191
|
TransientLocal: Ros2Durability = ...
|
|
@@ -178,9 +193,9 @@ class Ros2Durability:
|
|
|
178
193
|
|
|
179
194
|
@typing.final
|
|
180
195
|
class Ros2Liveliness:
|
|
181
|
-
"""DDS 2.2.3.11 LIVELINESS"""
|
|
196
|
+
"""DDS 2.2.3.11 LIVELINESS."""
|
|
182
197
|
|
|
183
|
-
def __eq__(self, value:
|
|
198
|
+
def __eq__(self, value: object) -> bool:
|
|
184
199
|
"""Return self==value."""
|
|
185
200
|
|
|
186
201
|
def __ge__(self, value: typing.Any) -> bool:
|
|
@@ -190,7 +205,7 @@ class Ros2Liveliness:
|
|
|
190
205
|
"""Return self>value."""
|
|
191
206
|
|
|
192
207
|
def __int__(self) -> None:
|
|
193
|
-
"""int(self)"""
|
|
208
|
+
"""int(self)."""
|
|
194
209
|
|
|
195
210
|
def __le__(self, value: typing.Any) -> bool:
|
|
196
211
|
"""Return self<=value."""
|
|
@@ -198,114 +213,123 @@ class Ros2Liveliness:
|
|
|
198
213
|
def __lt__(self, value: typing.Any) -> bool:
|
|
199
214
|
"""Return self<value."""
|
|
200
215
|
|
|
201
|
-
def __ne__(self, value:
|
|
216
|
+
def __ne__(self, value: object) -> bool:
|
|
202
217
|
"""Return self!=value."""
|
|
203
218
|
|
|
204
|
-
def __repr__(self) -> str:
|
|
205
|
-
"""Return repr(self)."""
|
|
206
219
|
Automatic: Ros2Liveliness = ...
|
|
207
220
|
ManualByParticipant: Ros2Liveliness = ...
|
|
208
221
|
ManualByTopic: Ros2Liveliness = ...
|
|
209
222
|
|
|
210
223
|
@typing.final
|
|
211
224
|
class Ros2Node:
|
|
212
|
-
"""ROS2 Node
|
|
225
|
+
"""ROS2 Node.
|
|
213
226
|
|
|
214
|
-
warnings::
|
|
215
|
-
- dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
216
|
-
at any point without it being considered a breaking change.
|
|
217
|
-
- There's a known issue about ROS2 nodes not being discoverable by ROS2
|
|
218
|
-
See: https://github.com/jhelovuo/ros2-client/issues/4
|
|
227
|
+
warnings::
|
|
228
|
+
- dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
229
|
+
at any point without it being considered a breaking change.
|
|
230
|
+
- There's a known issue about ROS2 nodes not being discoverable by ROS2
|
|
231
|
+
See: https://github.com/jhelovuo/ros2-client/issues/4
|
|
232
|
+
"""
|
|
219
233
|
|
|
220
234
|
def create_publisher(self, topic: dora.Ros2Topic, qos: dora.Ros2QosPolicies=None) -> dora.Ros2Publisher:
|
|
221
|
-
"""Create a ROS2 publisher
|
|
235
|
+
"""Create a ROS2 publisher.
|
|
222
236
|
|
|
223
|
-
```python
|
|
224
|
-
pose_publisher = ros2_node.create_publisher(turtle_pose_topic)
|
|
225
|
-
```
|
|
226
|
-
warnings:
|
|
227
|
-
- dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
228
|
-
at any point without it being considered a breaking change.
|
|
237
|
+
```python
|
|
238
|
+
pose_publisher = ros2_node.create_publisher(turtle_pose_topic)
|
|
239
|
+
```
|
|
240
|
+
warnings:
|
|
241
|
+
- dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
242
|
+
at any point without it being considered a breaking change.
|
|
243
|
+
"""
|
|
229
244
|
|
|
230
245
|
def create_subscription(self, topic: dora.Ros2Topic, qos: dora.Ros2QosPolicies=None) -> dora.Ros2Subscription:
|
|
231
|
-
"""Create a ROS2 subscription
|
|
246
|
+
"""Create a ROS2 subscription.
|
|
232
247
|
|
|
233
|
-
```python
|
|
234
|
-
pose_reader = ros2_node.create_subscription(turtle_pose_topic)
|
|
235
|
-
```
|
|
248
|
+
```python
|
|
249
|
+
pose_reader = ros2_node.create_subscription(turtle_pose_topic)
|
|
250
|
+
```
|
|
236
251
|
|
|
237
|
-
|
|
238
|
-
- dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
239
|
-
at any point without it being considered a breaking change.
|
|
252
|
+
Warnings:
|
|
253
|
+
- dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
254
|
+
at any point without it being considered a breaking change.
|
|
255
|
+
|
|
256
|
+
"""
|
|
240
257
|
|
|
241
258
|
def create_topic(self, name: str, message_type: str, qos: dora.Ros2QosPolicies) -> dora.Ros2Topic:
|
|
242
259
|
"""Create a ROS2 topic to connect to.
|
|
243
260
|
|
|
244
|
-
```python
|
|
245
|
-
turtle_twist_topic = ros2_node.create_topic(
|
|
246
|
-
"/turtle1/cmd_vel", "geometry_msgs/Twist", topic_qos
|
|
247
|
-
)
|
|
248
|
-
```
|
|
261
|
+
```python
|
|
262
|
+
turtle_twist_topic = ros2_node.create_topic(
|
|
263
|
+
"/turtle1/cmd_vel", "geometry_msgs/Twist", topic_qos
|
|
264
|
+
)
|
|
265
|
+
```
|
|
266
|
+
"""
|
|
249
267
|
|
|
250
268
|
@typing.final
|
|
251
269
|
class Ros2NodeOptions:
|
|
252
|
-
"""ROS2 Node Options"""
|
|
270
|
+
"""ROS2 Node Options."""
|
|
253
271
|
|
|
254
272
|
def __init__(self, rosout: bool=None) -> None:
|
|
255
|
-
"""ROS2 Node Options"""
|
|
273
|
+
"""ROS2 Node Options."""
|
|
256
274
|
|
|
257
275
|
@typing.final
|
|
258
276
|
class Ros2Publisher:
|
|
259
|
-
"""ROS2 Publisher
|
|
277
|
+
"""ROS2 Publisher.
|
|
278
|
+
|
|
279
|
+
Warnings:
|
|
280
|
+
- dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
281
|
+
at any point without it being considered a breaking change.
|
|
260
282
|
|
|
261
|
-
|
|
262
|
-
- dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
263
|
-
at any point without it being considered a breaking change."""
|
|
283
|
+
"""
|
|
264
284
|
|
|
265
285
|
def publish(self, data: pyarrow.Array) -> None:
|
|
266
286
|
"""Publish a message into ROS2 topic.
|
|
267
287
|
|
|
268
|
-
Remember that the data format should respect the structure of the ROS2 message using an arrow Structure.
|
|
269
|
-
|
|
270
|
-
ex:
|
|
271
|
-
```python
|
|
272
|
-
gripper_command.publish(
|
|
273
|
-
pa.array(
|
|
274
|
-
[
|
|
275
|
-
{
|
|
276
|
-
"name": "gripper",
|
|
277
|
-
"cmd": np.float32(5),
|
|
278
|
-
}
|
|
279
|
-
]
|
|
280
|
-
),
|
|
281
|
-
)
|
|
282
|
-
```
|
|
288
|
+
Remember that the data format should respect the structure of the ROS2 message using an arrow Structure.
|
|
289
|
+
|
|
290
|
+
ex:
|
|
291
|
+
```python
|
|
292
|
+
gripper_command.publish(
|
|
293
|
+
pa.array(
|
|
294
|
+
[
|
|
295
|
+
{
|
|
296
|
+
"name": "gripper",
|
|
297
|
+
"cmd": np.float32(5),
|
|
298
|
+
}
|
|
299
|
+
]
|
|
300
|
+
),
|
|
301
|
+
)
|
|
302
|
+
```
|
|
303
|
+
"""
|
|
283
304
|
|
|
284
305
|
@typing.final
|
|
285
306
|
class Ros2QosPolicies:
|
|
286
|
-
"""ROS2 QoS Policy"""
|
|
307
|
+
"""ROS2 QoS Policy."""
|
|
287
308
|
|
|
288
309
|
def __init__(self, durability: dora.Ros2Durability=None, liveliness: dora.Ros2Liveliness=None, reliable: bool=None, keep_all: bool=None, lease_duration: float=None, max_blocking_time: float=None, keep_last: int=None) -> dora.Ros2QoSPolicies:
|
|
289
|
-
"""ROS2 QoS Policy"""
|
|
310
|
+
"""ROS2 QoS Policy."""
|
|
290
311
|
|
|
291
312
|
@typing.final
|
|
292
313
|
class Ros2Subscription:
|
|
293
|
-
"""ROS2 Subscription
|
|
314
|
+
"""ROS2 Subscription.
|
|
294
315
|
|
|
316
|
+
Warnings:
|
|
317
|
+
- dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
318
|
+
at any point without it being considered a breaking change.
|
|
295
319
|
|
|
296
|
-
|
|
297
|
-
- dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
298
|
-
at any point without it being considered a breaking change."""
|
|
320
|
+
"""
|
|
299
321
|
|
|
300
322
|
def next(self):...
|
|
301
323
|
|
|
302
324
|
@typing.final
|
|
303
325
|
class Ros2Topic:
|
|
304
|
-
"""ROS2 Topic
|
|
326
|
+
"""ROS2 Topic.
|
|
327
|
+
|
|
328
|
+
Warnings:
|
|
329
|
+
- dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
330
|
+
at any point without it being considered a breaking change.
|
|
305
331
|
|
|
306
|
-
|
|
307
|
-
- dora Ros2 bridge functionality is considered **unstable**. It may be changed
|
|
308
|
-
at any point without it being considered a breaking change."""
|
|
332
|
+
"""
|
|
309
333
|
|
|
310
334
|
def start_runtime() -> None:
|
|
311
|
-
"""Start a runtime for Operators"""
|
|
335
|
+
"""Start a runtime for Operators."""
|
dora/cuda.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"""TODO: Add docstring."""
|
|
2
|
+
|
|
1
3
|
import pyarrow as pa
|
|
2
4
|
|
|
3
5
|
# Make sure to install torch with cuda
|
|
@@ -12,7 +14,7 @@ from pyarrow import cuda
|
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
def torch_to_ipc_buffer(tensor: torch.TensorType) -> tuple[pa.array, dict]:
|
|
15
|
-
"""
|
|
17
|
+
"""Convert a Pytorch tensor into a pyarrow buffer containing the IPC handle and its metadata.
|
|
16
18
|
|
|
17
19
|
Example Use:
|
|
18
20
|
```python
|
|
@@ -33,7 +35,7 @@ def torch_to_ipc_buffer(tensor: torch.TensorType) -> tuple[pa.array, dict]:
|
|
|
33
35
|
|
|
34
36
|
|
|
35
37
|
def ipc_buffer_to_ipc_handle(handle_buffer: pa.array) -> cuda.IpcMemHandle:
|
|
36
|
-
"""
|
|
38
|
+
"""Convert a buffer containing a serialized handler into cuda IPC MemHandle.
|
|
37
39
|
|
|
38
40
|
example use:
|
|
39
41
|
```python
|
|
@@ -50,12 +52,11 @@ def ipc_buffer_to_ipc_handle(handle_buffer: pa.array) -> cuda.IpcMemHandle:
|
|
|
50
52
|
```
|
|
51
53
|
"""
|
|
52
54
|
handle_buffer = handle_buffer.buffers()[1]
|
|
53
|
-
|
|
54
|
-
return ipc_handle
|
|
55
|
+
return pa.cuda.IpcMemHandle.from_buffer(handle_buffer)
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
def cudabuffer_to_numba(buffer: cuda.CudaBuffer, metadata: dict) -> DeviceNDArray:
|
|
58
|
-
"""
|
|
59
|
+
"""Convert a pyarrow CUDA buffer to numba.
|
|
59
60
|
|
|
60
61
|
example use:
|
|
61
62
|
```python
|
|
@@ -74,12 +75,11 @@ def cudabuffer_to_numba(buffer: cuda.CudaBuffer, metadata: dict) -> DeviceNDArra
|
|
|
74
75
|
shape = metadata["shape"]
|
|
75
76
|
strides = metadata["strides"]
|
|
76
77
|
dtype = metadata["dtype"]
|
|
77
|
-
|
|
78
|
-
return device_arr
|
|
78
|
+
return DeviceNDArray(shape, strides, dtype, gpu_data=buffer.to_numba())
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
def cudabuffer_to_torch(buffer: cuda.CudaBuffer, metadata: dict) -> torch.Tensor:
|
|
82
|
-
"""
|
|
82
|
+
"""Convert a pyarrow CUDA buffer to a torch tensor.
|
|
83
83
|
|
|
84
84
|
example use:
|
|
85
85
|
```python
|
|
@@ -95,6 +95,4 @@ def cudabuffer_to_torch(buffer: cuda.CudaBuffer, metadata: dict) -> torch.Tensor
|
|
|
95
95
|
torch_tensor = cudabuffer_to_torch(cudabuffer, event["metadata"]) # on cuda
|
|
96
96
|
```
|
|
97
97
|
"""
|
|
98
|
-
|
|
99
|
-
torch_tensor = torch.as_tensor(device_arr, device="cuda")
|
|
100
|
-
return torch_tensor
|
|
98
|
+
return torch.as_tensor(cudabuffer_to_numba(buffer, metadata), device="cuda")
|
dora/dora.abi3.so
CHANGED
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
dora_rs-0.3.11rc1.dist-info/METADATA,sha256=pMogX_WlUTfayv-JsbHbblQxJdFnazJBhkvYZLqzp_c,628
|
|
2
|
+
dora_rs-0.3.11rc1.dist-info/WHEEL,sha256=WrGUR7ngwVFrVacMsT0_VXRBz8qXxr-guHvJS0C03OA,106
|
|
3
|
+
dora.libs/libgcc_s-e52197c3.so.1,sha256=vkPW1Auw6CH9Bjk7frmX3hry_1H9c0tRI0Ncyg71WUI,724137
|
|
4
|
+
dora/__init__.py,sha256=mogA09uYFBIwnBnnMfeQtD52ZJbVbWmWo1h70GZj2aU,709
|
|
5
|
+
dora/cuda.py,sha256=qpFjenSdwFFtUGX9zWypkPrxe094BnWpdevTvkCCj0k,3069
|
|
6
|
+
dora/__init__.pyi,sha256=-jnLcWmFIi8ygYv44-VeYmq4e4I9a5zBHdz5q2Kae-E,9148
|
|
7
|
+
dora/dora.abi3.so,sha256=xtEyUzqKDrYK4OoTh5hG7DXwjUiHLIlKZkZn6XRPyUE,43455265
|
|
8
|
+
dora_rs-0.3.11rc1.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
dora_rs-0.3.10rc3.dist-info/METADATA,sha256=A8nVcWAUsXfcbrQAMxAYLTHwqwaIAr0fQH7Objbtk8I,628
|
|
2
|
-
dora_rs-0.3.10rc3.dist-info/WHEEL,sha256=aHv5HX65QENlLW9e5L7TyxnWH-yvyCXdUtHfahe7pDg,106
|
|
3
|
-
dora.libs/libgcc_s-e52197c3.so.1,sha256=vkPW1Auw6CH9Bjk7frmX3hry_1H9c0tRI0Ncyg71WUI,724137
|
|
4
|
-
dora/__init__.pyi,sha256=MZfafEGo1F_Al2RLrD36_cGRfFgOYY8Qa1_14bFYcf0,8342
|
|
5
|
-
dora/__init__.py,sha256=x3SdgwncpcHNnvLdsSc8Jrj1BBEC2uZVOCMYULyTrvo,711
|
|
6
|
-
dora/cuda.py,sha256=KuB-J8cykDkcbLjeSYWt4oz5lbkrKOUycUh3o1hfJRA,3161
|
|
7
|
-
dora/dora.abi3.so,sha256=3SsZx4AA2GW3Z0W6i0_x214vBG_piPRwfD1cx9q_fbY,23531713
|
|
8
|
-
dora_rs-0.3.10rc3.dist-info/RECORD,,
|