urml-av-runtime 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""urml_av_runtime — autonomous-vehicle reference runtime for URML.
|
|
2
|
+
|
|
3
|
+
AutowareAdapter (+ AutowareConfig, load_av_config)
|
|
4
|
+
The Autoware Universe AD API (``autoware_adapi_v1_msgs``) backing for
|
|
5
|
+
URML's AV trajectory verbs (RFC-0020): ``plan_path`` sets a route via
|
|
6
|
+
``/api/routing/set_route_points``; ``follow_trajectory`` engages
|
|
7
|
+
autonomous driving via ``/api/operation_mode/change_to_autonomous``,
|
|
8
|
+
under an optional published speed cap. It is the first substrate to
|
|
9
|
+
implement the ``TrajectoryAdapter`` Protocol (only ``MockROSAdapter``
|
|
10
|
+
did before). rclpy and the Autoware messages are imported lazily, so
|
|
11
|
+
this module loads on every host, including Windows.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
from urml_av_runtime._version import __version__
|
|
17
|
+
from urml_av_runtime.adapter import AutowareAdapter
|
|
18
|
+
from urml_av_runtime.config import AutowareConfig, MapPose, load_av_config
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"AutowareAdapter",
|
|
22
|
+
"AutowareConfig",
|
|
23
|
+
"MapPose",
|
|
24
|
+
"__version__",
|
|
25
|
+
"load_av_config",
|
|
26
|
+
]
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
"""AutowareAdapter — real ROS 2 backing for URML's AV trajectory verbs.
|
|
2
|
+
|
|
3
|
+
Implements the ``TrajectoryAdapter`` Protocol (RFC-0020) against the
|
|
4
|
+
Autoware Universe **AD API** (``autoware_adapi_v1_msgs``). It is the first
|
|
5
|
+
substrate to implement that protocol; until now only ``MockROSAdapter`` did.
|
|
6
|
+
|
|
7
|
+
## What it maps
|
|
8
|
+
|
|
9
|
+
- ``plan_path`` -> ``plan_trajectory``: set a route to the goal pose through
|
|
10
|
+
the AD API routing service (``/api/routing/set_route_points``). Autoware
|
|
11
|
+
plans the dense trajectory internally from the vehicle's localized pose;
|
|
12
|
+
URML binds a route handle, not raw waypoints (the payload is opaque per the
|
|
13
|
+
protocol contract).
|
|
14
|
+
- ``follow_trajectory`` -> ``follow_trajectory_goal``: optionally publish a
|
|
15
|
+
speed cap (``VelocityLimit`` to the scenario-planning ``max_velocity``
|
|
16
|
+
topic), then engage autonomous driving via the operation-mode service
|
|
17
|
+
(``/api/operation_mode/change_to_autonomous``). Engaging autonomous is what
|
|
18
|
+
makes Autoware follow the planned route.
|
|
19
|
+
|
|
20
|
+
## Honest boundaries
|
|
21
|
+
|
|
22
|
+
- ``start`` is ignored: Autoware routes from the vehicle's current localized
|
|
23
|
+
pose, not an arbitrary start.
|
|
24
|
+
- ``along`` (an HD-map corridor id) is checked by the validator upstream; it
|
|
25
|
+
is not a field the AD API routing request takes, so it is not forwarded.
|
|
26
|
+
- ``max_accel_mps2`` and ``on_off_route`` are vehicle- and
|
|
27
|
+
planning-configured in Autoware; the adapter records the intent but does not
|
|
28
|
+
set them per call. This is stated, not silently dropped.
|
|
29
|
+
- Every AD API service / topic / message-type name is configurable
|
|
30
|
+
(:class:`AutowareConfig`) so the adapter tracks a specific Autoware release
|
|
31
|
+
without a code change.
|
|
32
|
+
|
|
33
|
+
## Lazy rclpy
|
|
34
|
+
|
|
35
|
+
``rclpy`` and the Autoware message packages are imported lazily, so this
|
|
36
|
+
module imports on every host (including Windows) and the hermetic tests run
|
|
37
|
+
without a ROS 2 install. ``rclpy.init()`` is the caller's responsibility, as
|
|
38
|
+
in ``RclpyAdapter``. Real-vehicle behavior is verified separately under a
|
|
39
|
+
gated integration workflow, never in the hermetic suite.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
from __future__ import annotations
|
|
43
|
+
|
|
44
|
+
import importlib
|
|
45
|
+
import math
|
|
46
|
+
from contextlib import suppress
|
|
47
|
+
from typing import Any
|
|
48
|
+
|
|
49
|
+
from urml_ros2_runtime.substrate.base import (
|
|
50
|
+
NavigationResult,
|
|
51
|
+
SubstrateResult,
|
|
52
|
+
TrajectoryPlanResult,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
from urml_av_runtime._version import __version__
|
|
56
|
+
from urml_av_runtime.config import AutowareConfig, MapPose, load_av_config
|
|
57
|
+
|
|
58
|
+
__all__ = ["AutowareAdapter", "AutowareConfig", "MapPose", "__version__", "load_av_config"]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _require_rclpy() -> Any:
|
|
62
|
+
"""Lazy-import rclpy and surface a clear error if it isn't installed."""
|
|
63
|
+
try:
|
|
64
|
+
import rclpy # type: ignore[import-not-found,unused-ignore]
|
|
65
|
+
except ImportError as exc:
|
|
66
|
+
raise RuntimeError(
|
|
67
|
+
"rclpy is not installed. AutowareAdapter requires a ROS 2 + Autoware "
|
|
68
|
+
"environment.\n"
|
|
69
|
+
" On Linux: install ROS 2 and Autoware, source the setup files, then "
|
|
70
|
+
"launch Python.\n"
|
|
71
|
+
" On Windows: this adapter is not supported; use WSL2, or fall back to "
|
|
72
|
+
"MockROSAdapter for development."
|
|
73
|
+
) from exc
|
|
74
|
+
return rclpy
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _import_type(spec: str) -> Any:
|
|
78
|
+
"""Import a ``module:attr`` type spec (e.g. ``geometry_msgs.msg:Pose``)."""
|
|
79
|
+
module_name, _, attr = spec.partition(":")
|
|
80
|
+
if not attr:
|
|
81
|
+
raise ValueError(f"type spec {spec!r} must be 'module:attr'")
|
|
82
|
+
module = importlib.import_module(module_name)
|
|
83
|
+
return getattr(module, attr)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class AutowareAdapter:
|
|
87
|
+
"""Autoware AD API backing for URML's ``plan_path`` / ``follow_trajectory``."""
|
|
88
|
+
|
|
89
|
+
def __init__(self, config: AutowareConfig | None = None) -> None:
|
|
90
|
+
self._rclpy = _require_rclpy()
|
|
91
|
+
self._config = config or AutowareConfig()
|
|
92
|
+
self._node = self._rclpy.create_node(
|
|
93
|
+
self._config.node_name,
|
|
94
|
+
namespace=self._config.ros2_namespace,
|
|
95
|
+
)
|
|
96
|
+
# Lazy client / publisher slots — None until first use.
|
|
97
|
+
self._clients: dict[str, Any] = {}
|
|
98
|
+
self._velocity_pub: Any = None
|
|
99
|
+
self._reports: list[dict[str, Any]] = []
|
|
100
|
+
self._closed = False
|
|
101
|
+
|
|
102
|
+
# ------------------------------------------------------------------
|
|
103
|
+
# Lifecycle
|
|
104
|
+
# ------------------------------------------------------------------
|
|
105
|
+
|
|
106
|
+
def close(self) -> None:
|
|
107
|
+
if self._closed:
|
|
108
|
+
return
|
|
109
|
+
with suppress(Exception):
|
|
110
|
+
self._node.destroy_node()
|
|
111
|
+
self._closed = True
|
|
112
|
+
|
|
113
|
+
def __enter__(self) -> AutowareAdapter:
|
|
114
|
+
return self
|
|
115
|
+
|
|
116
|
+
def __exit__(self, *_: object) -> None:
|
|
117
|
+
self.close()
|
|
118
|
+
|
|
119
|
+
# ------------------------------------------------------------------
|
|
120
|
+
# Service / topic plumbing
|
|
121
|
+
# ------------------------------------------------------------------
|
|
122
|
+
|
|
123
|
+
def _client(self, service_name: str, srv_type_spec: str) -> Any:
|
|
124
|
+
client = self._clients.get(service_name)
|
|
125
|
+
if client is None:
|
|
126
|
+
srv_type = _import_type(srv_type_spec)
|
|
127
|
+
client = self._node.create_client(srv_type, service_name)
|
|
128
|
+
self._clients[service_name] = client
|
|
129
|
+
return client
|
|
130
|
+
|
|
131
|
+
def _call_service(
|
|
132
|
+
self, service_name: str, srv_type_spec: str, request: Any
|
|
133
|
+
) -> tuple[Any | None, str | None]:
|
|
134
|
+
"""Call a service and wait. Returns (response, reason). reason is set on failure."""
|
|
135
|
+
client = self._client(service_name, srv_type_spec)
|
|
136
|
+
timeout = self._config.service_timeout_seconds
|
|
137
|
+
if not client.wait_for_service(timeout_sec=timeout):
|
|
138
|
+
return None, f"service_unavailable: {service_name}"
|
|
139
|
+
future = client.call_async(request)
|
|
140
|
+
self._rclpy.spin_until_future_complete(self._node, future, timeout_sec=timeout)
|
|
141
|
+
response = future.result()
|
|
142
|
+
if response is None:
|
|
143
|
+
return None, f"no_response: {service_name}"
|
|
144
|
+
return response, None
|
|
145
|
+
|
|
146
|
+
@staticmethod
|
|
147
|
+
def _status_ok(response: Any) -> bool:
|
|
148
|
+
"""AD API responses carry a ResponseStatus with a `success` flag."""
|
|
149
|
+
status = getattr(response, "status", None)
|
|
150
|
+
if status is None:
|
|
151
|
+
# Some services return a bare success field.
|
|
152
|
+
return bool(getattr(response, "success", False))
|
|
153
|
+
return bool(getattr(status, "success", False))
|
|
154
|
+
|
|
155
|
+
@staticmethod
|
|
156
|
+
def _status_message(response: Any) -> str:
|
|
157
|
+
status = getattr(response, "status", None)
|
|
158
|
+
if status is not None:
|
|
159
|
+
return str(getattr(status, "message", "") or "")
|
|
160
|
+
return str(getattr(response, "message", "") or "")
|
|
161
|
+
|
|
162
|
+
def _resolve_goal_pose(self, goal: dict[str, float] | str) -> MapPose | None:
|
|
163
|
+
if isinstance(goal, str):
|
|
164
|
+
return self._config.resolve_pose(goal)
|
|
165
|
+
# A pose dict {x, y, z?, yaw?} from the program.
|
|
166
|
+
return MapPose.model_validate(goal)
|
|
167
|
+
|
|
168
|
+
def _build_pose(self, pose: MapPose) -> Any:
|
|
169
|
+
pose_type = _import_type("geometry_msgs.msg:Pose")
|
|
170
|
+
msg = pose_type()
|
|
171
|
+
msg.position.x = float(pose.x)
|
|
172
|
+
msg.position.y = float(pose.y)
|
|
173
|
+
msg.position.z = float(pose.z)
|
|
174
|
+
# Heading (yaw) as a quaternion about z.
|
|
175
|
+
msg.orientation.z = math.sin(pose.yaw / 2.0)
|
|
176
|
+
msg.orientation.w = math.cos(pose.yaw / 2.0)
|
|
177
|
+
return msg
|
|
178
|
+
|
|
179
|
+
# ------------------------------------------------------------------
|
|
180
|
+
# TrajectoryAdapter (RFC-0020)
|
|
181
|
+
# ------------------------------------------------------------------
|
|
182
|
+
|
|
183
|
+
def plan_trajectory(
|
|
184
|
+
self,
|
|
185
|
+
*,
|
|
186
|
+
start: dict[str, float] | str | None,
|
|
187
|
+
goal: dict[str, float] | str,
|
|
188
|
+
along: str | None = None,
|
|
189
|
+
) -> TrajectoryPlanResult:
|
|
190
|
+
goal_pose = self._resolve_goal_pose(goal)
|
|
191
|
+
if goal_pose is None:
|
|
192
|
+
return TrajectoryPlanResult(
|
|
193
|
+
success=False,
|
|
194
|
+
reason=(
|
|
195
|
+
f"goal_not_resolvable: {goal!r} is declared in the manifest but not "
|
|
196
|
+
"mapped to a pose in av_adapter.yaml `location_to_pose`."
|
|
197
|
+
),
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
if self._config.clear_route_before_plan:
|
|
201
|
+
clear_type = _import_type(self._config.clear_route_srv_type)
|
|
202
|
+
_resp, reason = self._call_service(
|
|
203
|
+
self._config.clear_route_service, self._config.clear_route_srv_type, clear_type.Request()
|
|
204
|
+
)
|
|
205
|
+
# A clear failure is not fatal (there may be no route yet); the
|
|
206
|
+
# set below is the authority. Only a service-unavailable is worth
|
|
207
|
+
# noting, and set_route will surface it too, so continue.
|
|
208
|
+
|
|
209
|
+
set_type = _import_type(self._config.set_route_srv_type)
|
|
210
|
+
request = set_type.Request()
|
|
211
|
+
# header: stamp + frame. Fields present on the AD API request.
|
|
212
|
+
if hasattr(request, "header"):
|
|
213
|
+
request.header.frame_id = self._config.map_frame
|
|
214
|
+
with suppress(Exception):
|
|
215
|
+
request.header.stamp = self._node.get_clock().now().to_msg()
|
|
216
|
+
request.goal = self._build_pose(goal_pose)
|
|
217
|
+
if hasattr(request, "waypoints"):
|
|
218
|
+
request.waypoints = []
|
|
219
|
+
|
|
220
|
+
response, reason = self._call_service(
|
|
221
|
+
self._config.set_route_service, self._config.set_route_srv_type, request
|
|
222
|
+
)
|
|
223
|
+
if response is None:
|
|
224
|
+
return TrajectoryPlanResult(success=False, reason=reason)
|
|
225
|
+
if not self._status_ok(response):
|
|
226
|
+
return TrajectoryPlanResult(
|
|
227
|
+
success=False,
|
|
228
|
+
reason=f"route_rejected: {self._status_message(response) or 'AD API declined the route'}",
|
|
229
|
+
)
|
|
230
|
+
return TrajectoryPlanResult(
|
|
231
|
+
success=True,
|
|
232
|
+
payload={
|
|
233
|
+
"goal": {"x": goal_pose.x, "y": goal_pose.y, "z": goal_pose.z, "yaw": goal_pose.yaw},
|
|
234
|
+
"frame": self._config.map_frame,
|
|
235
|
+
"along": along,
|
|
236
|
+
"waypoints": [],
|
|
237
|
+
"route_set": True,
|
|
238
|
+
},
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
def follow_trajectory_goal(
|
|
242
|
+
self,
|
|
243
|
+
*,
|
|
244
|
+
trajectory: dict[str, Any] | None,
|
|
245
|
+
max_velocity_mps: float | None = None,
|
|
246
|
+
max_accel_mps2: float | None = None,
|
|
247
|
+
on_off_route: str = "abort",
|
|
248
|
+
) -> NavigationResult:
|
|
249
|
+
if trajectory is None or not trajectory.get("route_set"):
|
|
250
|
+
return NavigationResult(
|
|
251
|
+
success=False,
|
|
252
|
+
reason=(
|
|
253
|
+
"no_route: follow_trajectory needs a route bound by plan_path "
|
|
254
|
+
"(the trajectory payload has no `route_set`)."
|
|
255
|
+
),
|
|
256
|
+
)
|
|
257
|
+
if max_velocity_mps is not None:
|
|
258
|
+
self._publish_velocity_limit(max_velocity_mps)
|
|
259
|
+
|
|
260
|
+
change_type = _import_type(self._config.change_mode_srv_type)
|
|
261
|
+
response, reason = self._call_service(
|
|
262
|
+
self._config.change_to_autonomous_service,
|
|
263
|
+
self._config.change_mode_srv_type,
|
|
264
|
+
change_type.Request(),
|
|
265
|
+
)
|
|
266
|
+
if response is None:
|
|
267
|
+
return NavigationResult(success=False, reason=reason)
|
|
268
|
+
if not self._status_ok(response):
|
|
269
|
+
return NavigationResult(
|
|
270
|
+
success=False,
|
|
271
|
+
reason=(
|
|
272
|
+
f"engage_rejected: {self._status_message(response) or 'AD API declined autonomous mode'}"
|
|
273
|
+
),
|
|
274
|
+
)
|
|
275
|
+
return NavigationResult(success=True, frame=self._config.map_frame)
|
|
276
|
+
|
|
277
|
+
def _publish_velocity_limit(self, max_velocity_mps: float) -> None:
|
|
278
|
+
if self._velocity_pub is None:
|
|
279
|
+
msg_type = _import_type(self._config.velocity_limit_msg_type)
|
|
280
|
+
self._velocity_pub = self._node.create_publisher(
|
|
281
|
+
msg_type, self._config.velocity_limit_topic, 1
|
|
282
|
+
)
|
|
283
|
+
msg_type = _import_type(self._config.velocity_limit_msg_type)
|
|
284
|
+
msg = msg_type()
|
|
285
|
+
if hasattr(msg, "stamp"):
|
|
286
|
+
with suppress(Exception):
|
|
287
|
+
msg.stamp = self._node.get_clock().now().to_msg()
|
|
288
|
+
msg.max_velocity = float(max_velocity_mps)
|
|
289
|
+
self._velocity_pub.publish(msg)
|
|
290
|
+
|
|
291
|
+
# ------------------------------------------------------------------
|
|
292
|
+
# Non-actuating base primitives an AV program may use
|
|
293
|
+
# ------------------------------------------------------------------
|
|
294
|
+
|
|
295
|
+
def wait_passively(self, *, duration_seconds: float) -> SubstrateResult:
|
|
296
|
+
return SubstrateResult(success=True)
|
|
297
|
+
|
|
298
|
+
def emit_report(
|
|
299
|
+
self,
|
|
300
|
+
*,
|
|
301
|
+
to: str,
|
|
302
|
+
facts: dict[str, Any],
|
|
303
|
+
attachments: list[str] | None = None,
|
|
304
|
+
status: str = "success",
|
|
305
|
+
severity: str = "info",
|
|
306
|
+
) -> SubstrateResult:
|
|
307
|
+
self._reports.append({"to": to, "status": status, "severity": severity, "facts": facts})
|
|
308
|
+
return SubstrateResult(success=True)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""Deployment-side configuration for the Autoware AV adapter.
|
|
2
|
+
|
|
3
|
+
Which WGS84/map pose a manifest-declared location (``depot``, ``dropoff``)
|
|
4
|
+
resolves to, and which Autoware AD API service / topic names to drive, is
|
|
5
|
+
deployment-specific, so it lives here rather than in the URML
|
|
6
|
+
program/manifest/envelope (the ros2 / px4 / ardupilot ``location_to_*``
|
|
7
|
+
precedent).
|
|
8
|
+
|
|
9
|
+
The defaults track the documented Autoware Universe AD API
|
|
10
|
+
(``autoware_adapi_v1_msgs``): routing via ``/api/routing/set_route_points``,
|
|
11
|
+
actuation via ``/api/operation_mode/change_to_autonomous``, and a speed cap
|
|
12
|
+
published to the scenario-planning ``max_velocity`` topic. Every name is
|
|
13
|
+
overridable so the adapter tracks a specific Autoware release without a code
|
|
14
|
+
change.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
|
|
21
|
+
import yaml
|
|
22
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class MapPose(BaseModel):
|
|
26
|
+
"""A goal pose in the map frame. ``yaw`` is the heading in radians."""
|
|
27
|
+
|
|
28
|
+
model_config = ConfigDict(extra="forbid")
|
|
29
|
+
|
|
30
|
+
x: float
|
|
31
|
+
y: float
|
|
32
|
+
z: float = 0.0
|
|
33
|
+
yaw: float = 0.0
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class AutowareConfig(BaseModel):
|
|
37
|
+
"""Connection + AD API binding config for :class:`AutowareAdapter`."""
|
|
38
|
+
|
|
39
|
+
model_config = ConfigDict(extra="forbid")
|
|
40
|
+
|
|
41
|
+
ros2_namespace: str = Field(default="", description="ROS 2 namespace for the adapter node.")
|
|
42
|
+
node_name: str = Field(default="urml_av_adapter", description="Node name the adapter creates.")
|
|
43
|
+
map_frame: str = Field(default="map", description="Frame id stamped on the route goal.")
|
|
44
|
+
|
|
45
|
+
location_to_pose: dict[str, MapPose] = Field(
|
|
46
|
+
default_factory=dict,
|
|
47
|
+
description="Map manifest-declared location names (depot, dropoff, ...) to map-frame poses.",
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
# AD API surface (autoware_adapi_v1_msgs). Overridable per Autoware release.
|
|
51
|
+
set_route_service: str = "/api/routing/set_route_points"
|
|
52
|
+
clear_route_service: str = "/api/routing/clear_route"
|
|
53
|
+
change_to_autonomous_service: str = "/api/operation_mode/change_to_autonomous"
|
|
54
|
+
set_route_srv_type: str = "autoware_adapi_v1_msgs.srv:SetRoutePoints"
|
|
55
|
+
clear_route_srv_type: str = "autoware_adapi_v1_msgs.srv:ClearRoute"
|
|
56
|
+
change_mode_srv_type: str = "autoware_adapi_v1_msgs.srv:ChangeOperationMode"
|
|
57
|
+
|
|
58
|
+
# Speed cap: a latched VelocityLimit publish, since the AD API has no
|
|
59
|
+
# per-call velocity-limit service across releases.
|
|
60
|
+
velocity_limit_topic: str = "/planning/scenario_planning/max_velocity"
|
|
61
|
+
velocity_limit_msg_type: str = "tier4_planning_msgs.msg:VelocityLimit"
|
|
62
|
+
|
|
63
|
+
clear_route_before_plan: bool = Field(
|
|
64
|
+
default=True,
|
|
65
|
+
description="Clear any existing route before setting a new one (idempotent planning).",
|
|
66
|
+
)
|
|
67
|
+
service_timeout_seconds: float = Field(default=10.0, gt=0)
|
|
68
|
+
|
|
69
|
+
def resolve_pose(self, name: str) -> MapPose | None:
|
|
70
|
+
return self.location_to_pose.get(name)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def load_av_config(path: str | Path) -> AutowareConfig:
|
|
74
|
+
"""Parse an ``av_adapter.yaml`` file into an :class:`AutowareConfig`."""
|
|
75
|
+
p = Path(path)
|
|
76
|
+
with p.open(encoding="utf-8") as fh:
|
|
77
|
+
data = yaml.safe_load(fh) or {}
|
|
78
|
+
if not isinstance(data, dict):
|
|
79
|
+
raise ValueError(f"av-config file {p} did not contain a YAML mapping at the top level.")
|
|
80
|
+
return AutowareConfig.model_validate(data)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: urml-av-runtime
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Autonomous-vehicle reference runtime for URML — Autoware AD API via rclpy.
|
|
5
|
+
Project-URL: Homepage, https://github.com/urml-dev/URML
|
|
6
|
+
Project-URL: Repository, https://github.com/urml-dev/URML
|
|
7
|
+
Project-URL: Issues, https://github.com/urml-dev/URML/issues
|
|
8
|
+
Author: URML Maintainers
|
|
9
|
+
License: BUSL-1.1
|
|
10
|
+
Keywords: adapi,autonomous-vehicle,autoware,robotics,ros2,runtime,trajectory,urml
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: Other/Proprietary License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Requires-Dist: pydantic<3,>=2.6
|
|
21
|
+
Requires-Dist: pyyaml<7,>=6.0
|
|
22
|
+
Requires-Dist: urml-ros2-runtime>=0.4.0
|
|
23
|
+
Requires-Dist: urml-validator>=0.4.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest-cov>=5; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
28
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
<p align="center">
|
|
32
|
+
<a href="https://urml.dev"><img src="https://urml.dev/favicon.svg" alt="URML" width="72" height="72"></a>
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
# urml-av-runtime
|
|
36
|
+
|
|
37
|
+
**Autonomous-vehicle reference runtime for URML** — `AutowareAdapter`, over the Autoware Universe AD API.
|
|
38
|
+
|
|
39
|
+
The first substrate to implement URML's `TrajectoryAdapter` Protocol (RFC-0020). Until now only `MockROSAdapter` did; this backs the AV verbs against a real [Autoware](https://autoware.org/) stack through the documented [AD API](https://autowarefoundation.github.io/autoware-documentation/main/design/autoware-interfaces/ad-api/) (`autoware_adapi_v1_msgs`).
|
|
40
|
+
|
|
41
|
+
## Method coverage
|
|
42
|
+
|
|
43
|
+
| URML primitive | Autoware AD API | behaviour |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| `plan_path` (compute) | `/api/routing/set_route_points` (`SetRoutePoints`) | sets a route to the goal pose; Autoware plans the dense trajectory from the vehicle's localized pose. URML binds a route handle, not raw waypoints |
|
|
46
|
+
| `follow_trajectory` (actuate) | `/api/operation_mode/change_to_autonomous` (`ChangeOperationMode`) + a `VelocityLimit` publish | engages autonomous driving under an optional speed cap. The only AV verb that actuates |
|
|
47
|
+
| `wait` / `report` | none | passive hold / local report sink, so a full AV program runs |
|
|
48
|
+
|
|
49
|
+
Everything else in the substrate surface is not implemented: an AV program is `plan_path` then `follow_trajectory` (see [`examples/av/robotaxi-trip.urml.yaml`](../../examples/av/robotaxi-trip.urml.yaml)).
|
|
50
|
+
|
|
51
|
+
## Honest boundaries
|
|
52
|
+
|
|
53
|
+
- `start` is ignored: Autoware routes from the vehicle's current localized pose.
|
|
54
|
+
- `along` (an HD-map corridor id) is checked by the validator upstream; the AD API routing request takes no such field, so it is not forwarded.
|
|
55
|
+
- `max_accel` and `on_off_route` are vehicle- and planning-configured in Autoware; the adapter records the intent, it does not set them per call.
|
|
56
|
+
- Every AD API service / topic / message-type name is overridable in `AutowareConfig`, so the adapter tracks a specific Autoware release without a code change.
|
|
57
|
+
|
|
58
|
+
## Install / use
|
|
59
|
+
|
|
60
|
+
`rclpy` and the Autoware message packages ship with a ROS 2 + Autoware install, not from PyPI, so there is no installable extra. They are imported lazily, so this module loads on every host (Windows included) and the hermetic suite runs without ROS 2.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install -e reference/av-runtime # hermetic dev; adapter needs Linux + Autoware to actuate
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from urml_av_runtime import AutowareAdapter, AutowareConfig, MapPose
|
|
68
|
+
|
|
69
|
+
cfg = AutowareConfig(location_to_pose={
|
|
70
|
+
"depot": MapPose(x=0.0, y=0.0),
|
|
71
|
+
"dropoff": MapPose(x=30.0, y=12.0, yaw=1.57),
|
|
72
|
+
})
|
|
73
|
+
# rclpy.init() is the caller's responsibility, as with RclpyAdapter.
|
|
74
|
+
with AutowareAdapter(cfg) as av:
|
|
75
|
+
plan = av.plan_trajectory(start=None, goal="dropoff", along="city_map")
|
|
76
|
+
av.follow_trajectory_goal(trajectory=plan.payload, max_velocity_mps=12.0)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Status
|
|
80
|
+
|
|
81
|
+
**v0.1 (this release):**
|
|
82
|
+
- `AutowareAdapter` + `AutowareConfig` + `load_av_config`. Hermetic suite green via fake-`rclpy` / fake-message injection (`pytest reference/av-runtime/tests -q`).
|
|
83
|
+
- The `av` profile is research-grade, not production safety-certified (RFC-0020). Real-vehicle validation on a Linux + Autoware host is a gated follow-up, never claimed from the hermetic suite.
|
|
84
|
+
|
|
85
|
+
## Core Commitment
|
|
86
|
+
|
|
87
|
+
Business Source License 1.1: free for non-production use, commercial license for production (see [`LICENSING.md`](../../LICENSING.md)). No vendor coupling, no cloud dependency. `rclpy` and the Autoware messages are imported lazily, never at module load.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
urml_av_runtime/__init__.py,sha256=92MJXQwhDBl90AjKtBi7sNn2oe2Mny_1DkzaSl6dJ9Y,1022
|
|
2
|
+
urml_av_runtime/_version.py,sha256=E5rRAxDRNIsA89ZzGERJeca0a74MUnpI6Avs1JFLuv0,66
|
|
3
|
+
urml_av_runtime/adapter.py,sha256=q2hdrunzLCYfwC77KoVQd7ybpTuN08c32MjSQB8XKm8,12558
|
|
4
|
+
urml_av_runtime/config.py,sha256=Ux1ChNXEJHvu0hnARb6rglS3P0egFK9GqxFbxKE7A9U,3253
|
|
5
|
+
urml_av_runtime-0.4.0.dist-info/METADATA,sha256=RgD4hJG7aUS7a4QGpB3O8i-QHYg2Gxo84c6_DDUEC-4,4752
|
|
6
|
+
urml_av_runtime-0.4.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
7
|
+
urml_av_runtime-0.4.0.dist-info/RECORD,,
|