Autoware as the Ego¶
ego.entity=autoware hands the ego to Autoware. The framework spawns the ego
at the scenario's start, serves the scenario's mission (initial pose, goal,
waypoints) on the AutowareBridge gRPC server, and waits for Autoware to
report it is localized, routed, engaged and driving before the scenario clock
starts. Autoware's side of the bridge is the framework's own scenario_bridge
ROS 2 node (autoware_carla_scenario.autoware_bridge.ros_bridge): run in
Autoware's ROS 2 environment, it pulls the mission and drives localization,
routing and engaging through the AD API. Autoware itself only has to follow the
scenario's world, ego and clock, which autoware_carla_interface does with
scenario_mode:=true.
Autoware's turn indicators reach the ego too. scenario_bridge forwards each
change of /control/command/turn_indicators_cmd (autoware_vehicle_msgs/TurnIndicatorsCommand,
its turn_indicators_topic parameter; empty turns it off) with the bridge's
ReportTurnIndicators, and the entity lights the CARLA ego's indicators with it,
leaving its other lights as they are. That is what a camera sees and what
TurnIndicatorCondition reads, whether or not autoware_carla_interface lights them
itself.
The route Autoware is given is the scenario's: the goal and, when the scenario
names them (a RoutingAction's waypoints, or the route it asserts), the
waypoints on the way there, in order. scenario_bridge puts both in the
/api/routing/set_route_points request (goal and waypoints), so Autoware
drives the road the scenario meant rather than the shortest one to the goal.
Every pose is moved to Autoware's base_link, the rear axle, as the initial
pose is.
A RoutingAction in the tick loop re-routes Autoware part-way through the run.
The framework serves the new goal and waypoints as the next mission_version
of the mission; scenario_bridge, which keeps polling GetMission every
route_watch_period_s (1 s) once Autoware is ready, changes Autoware's route
to it with /api/routing/change_route_points. Localization is left as it is.
The change waits for the route to be SET; one Autoware rejects -- its mission
planner refuses a re-route it does not consider safe while driving, say -- is
retried on the next poll, and given up on after reroute_max_attempts (10)
rejections, with an error in the node's log, leaving Autoware on the route it
had. A re-route after the ego has reached its goal -- the route ARRIVED, which
neither routing service takes, and Autoware stopped -- clears the route
(/api/routing/clear_route), sets the new one with set_route_points and
engages again, as the startup did. A bridge implementation of your own re-routes by implementing
AutowareBridge.reroute(); one that does not raises NotImplementedError at
the re-route instead of leaving Autoware on its old route without a word.
Who starts Autoware is autoware.launcher.type:
| Value | Who starts Autoware |
|---|---|
none (default) |
Someone else, by hand, with the scenario_bridge node (Starting Autoware yourself) |
docker |
The framework, from a local Autoware workspace, in that workspace's dev container |
command |
The framework, by running autoware.launcher.command on this host |
With a launcher, every scenario gets a fresh Autoware: started once the
scenario's ego exists and its mission is being served, and removed (every
process, and with docker the container) when the scenario ends. Nothing
carries over from one scenario to the next -- not the localization, not the
route, not the operation mode, not a planner's memory of the last run -- which
is what makes a batch or a sweep of Autoware scenarios meaningful.
A local workspace in its dev container¶
The workspace is the one you already build in: a clone of
autowarefoundation/autoware
with Autoware's sources in src/, checked out on a branch whose
autoware_carla_interface launch takes scenario_mode, which the launch is
given:
uv run scenario 'scenario=intersection_passing/*' map=town10hd_opt \
ego.entity=autoware \
autoware.launcher.type=docker \
autoware.launcher.workspace=$HOME/autoware \
'autoware.launcher.launch=[autoware_launch,e2e_simulator.launch.xml,"map_path:=/home/aw/autoware_map/Town10HD_Opt","simulator_type:=carla","scenario_mode:=true"]'
What happens:
- Before anything else (before CARLA starts), the workspace is checked:
- The image and the workspace's mount point are read from
.devcontainer/<autoware.launcher.devcontainer>/devcontainer.jsonand the Compose service it names -- the same image and the same path (/home/aw/autoware) VS Code uses. colcon writes absolute paths intoinstall/, so a workspace built in VS Code runs here, and the reverse. - What the stack needs is installed into an image of its own, made from
the dev container's and tagged
autoware-carla-scenario-deps:<digest>: thescenario_bridgenode'spython3-grpcioandpython3-protobuf-- and, when that protobuf is too old for the node's generated code (Ubuntu 22.04's 3.12; it needs 3.20 or later),protobuf>=4.25.0,<8from pip, into Autoware's Python venv when the image has one, checked once rosdep has run -- and the workspace's dependencies (rosdep install --from-paths src). A dev container gets the dependencies a branch added since its image was built by someone runningrosdep installin it; a fresh container per scenario does not, so the launcher does it once, and again only when apackage.xmlor the dev container's image changes (autoware.launcher.rosdep=falseleaves the workspace's out). The output goes toautoware-deps.log. - The workspace is built (
colcon buildin that image) whenautoware.launcher.buildsays so:autobuilds it only wheninstall/setup.bashis missing,alwaysbefore every batch,neverleaves building to you. The output goes toautoware-build.log. When there is a dependency image to make or a build to run, it is done under a lock,.autoware_carla_scenario-build.lockat the root of the workspace (kept there, not in a cache directory of yours, so runs on every node that shares the workspace see it): a second run waits for the first's (up to 4 hours, then fails saying so), and withautouses its build rather than build again. A run with nothing to make takes no lock. The file stays; git shows it as untracked unless you add it to the workspace's.git/info/exclude. - A workspace whose
autoware_carla_interfacelaunch takes noscenario_mode-- one built from a branch without scenario support -- is refused here, not after the first scenario has timed out waiting for it, unless the launch fileautoware.launcher.launchnames declaresscenario_modeitself (see CARLA 1.0). - Containers left behind by a run of yours that was killed are removed.
Each container carries the
autoware_carla_scenario.stack=uid-<your uid>label, so another user's are left alone, and theautoware_carla_scenario.owner=<host>:<pid>label of the process that started it, so the live stack of another run of yours on the host (a SLURM task beside this one) is left alone too: only those whose process no longer runs on this host are removed. One without an owner label (from a version before it) or another host's is removed only once it runs nothing (exited,createdordead), and only named in a warning otherwise (running,paused,restarting). The owner is looked up in the launcher's pid namespace, so the runs on a host are assumed to share it: a run inside a container of its own (a pid namespace of its own) that keeps the host's name could take another run's live stack for a leftover. Two of your own runs on one host each need ports and ROS domains of their own, which SLURM tasks are given (slurm.md) and two local batches are not. - Every docker call the launcher makes for its answer (
docker ps,docker image inspect,docker rm) is given 60 s,docker commitof the dependency image 30 minutes: a daemon that stops answering fails the batch here (a call it needs) or is logged and gone on without (the leftover containers' removal), rather than hang it. A dependency image whosedocker image inspectdoes not answer fails the batch too: it is not taken for a missing one, installed and committed again. The dependencies' install and the build stream their output and are not bounded.
- The image and the workspace's mount point are read from
- For each scenario, once the ego is spawned and the mission served:
docker run --rm --network hostof the dev container image, the workspace mounted where it was built,source install/setup.bash, then thescenario_bridgenode in the background -- this package'sautoware_bridgedirectory is mounted read-only into the container for it, with the bridge's address andautoware.launcher.bridge_parameters-- andexec ros2 launch <autoware.launcher.launch>. The stack's output, the node's included, goes toautoware-<n>-<scenario>.login the run's output directory (<n>counting the stacks the run started from 0); in a batch and a SLURM task, toautoware-<stem>.log, after the file stem of the case it ran for, kept (and appended to) when the case is run again. -
While the stack starts (until
scenario_bridgefirst reaches the bridge), the world ticks at about real time and the wait is measured in wall-clock seconds,autoware.boot_timeout_s. Reaching the bridge means the node's firstReportReadiness, which it sends, not ready, once Autoware can be routed:- The node starts beside
ros2 launch, long before the rest of Autoware, and asks for the mission only once the AD API is up: the services it calls (/api/routing/set_route_points, and/api/localization/initializeand/api/operation_mode/change_to_autonomouswhen it calls them) are reachable and the AD API is publishing its state -- a localization initialization state from the pose initializer, which is up early, or, withinitialize_localization:=false, a route state other than UNKNOWN. - It initializes localization at the mission's initial pose, retrying
while that is rejected. On an NDT stack it is until the pointcloud map
has loaded and
ndt_scan_matchercan align, which on a large map takes a minute or more after the pose initializer is up. A GNSS pose initializer may initialize it first; that counts as well. - Once localization is INITIALIZED -- or straight away with
initialize_localization:=false, whose gate already waited for the mission planner -- it reports in. The mission planner leaves UNKNOWN only once localization is initialized, from the mission's initial pose, so the node takes the mission while the world is still paced: nothing waits on the scenario hearing from it.
Once it has reached the bridge, routing and engaging are measured in ticks,
autoware.ready_timeout_ticks. The route itself waits for UNSET. A stack that takes the mission but never localizes fails atboot_timeout_swithtook the mission but did not report in; one that never asks for it, withdid not reach the bridge. Ascenario_bridgenode older than this, or a client of your own, that reports only once ready keeps the whole startup paced, underboot_timeout_s. 4. When the scenario ends, however it ends, the stack is stopped (SIGINTtoros2 launch, throughdocker run --init) and its container removed withdocker rm --forceonce it has stopped orstop_timeout_shas passed, before the next scenario starts. That removal is given 60 s: a daemon that does not answer in that time is logged as a warning and the batch goes on, the container left for the next batch's start to remove. A scenario that is retried (server.cooldown_max_retries) starts another fresh stack, with nothing of the failed attempt's carried over. - The node starts beside
Every scenario of a batch uses the same launcher: set autoware.launcher on
the command line, not in a scenario's config (a batch whose scenarios disagree
on it is refused).
A stack that exits during a scenario ends it: the result's message says
The Autoware stack exited with code <n>.
So does a stack that stops answering once it is ready, launched or not.
scenario_bridge keeps asking for the mission every route_watch_period_s
(1 s) while the AD API is up, and stops while it is down. Its timers run on the
steady clock, whatever use_sim_time says, so the period is wall-clock time,
which is what the timeout is measured in: a world ticking slower than real
time, or stalled between ticks, is not taken for a dead stack. Once Autoware is
ready, autoware.liveness_timeout_s (30 s) of silence ends the run with
The Autoware stack stopped answering the bridge: ... rather than letting
CARLA drive the ego on the last control Autoware gave it until the scenario
times out. Like an exited stack, it is a driver failure. It is watched only
once the node has asked after Autoware turned ready, so a node that stops
asking then (route_watch_period_s of 0 or less) is not taken for a dead one;
autoware.liveness_timeout_s=0 turns it off. What it sees is the
scenario_bridge node and the AD API behind it: an autoware_carla_interface
that dies on its own, while ros2 launch keeps running, goes unnoticed.
liveness_timeout_s must be comfortably above the longest gap between two
polls of a healthy node. Each poll comes route_watch_period_s after the last
and may take up to mission_poll_timeout_s, so the timeout must be at least
twice their sum, which leaves room for one lost poll:
With the node's defaults, that is 4 s, well below the 30 s default. When the
framework starts the node (autoware.launcher.type=docker or command), it
compares autoware.liveness_timeout_s with the
autoware.launcher.bridge_parameters it starts the node with, using the
node's defaults for those that are not set, and refuses a pair that breaks
this rule when the ego is built, before Autoware or the scenario starts:
bridge_parameters: {route_watch_period_s: 60} with the default 30 s would
otherwise end every healthy run about 30 s after Autoware turned ready. A
route_watch_period_s of 0 or less, or liveness_timeout_s: 0, is not
checked. A node you start yourself is not seen, so check its parameters
yourself.
The node must poll on a steady clock. The liveness timeout is wall-clock time,
and so are the periods of scenario_bridge's timers, whatever use_sim_time
says. An older scenario_bridge, or a node of your own, whose route watch runs
on a ROS timer under use_sim_time:=true polls in simulated time. When the
world runs slower than real time, its polls spread out in wall-clock time.
With the defaults (a 1 s period and a 30 s timeout), a world slower than about
1/30 of real time, or one stalled between ticks for 30 s, gets the stack
falsely failed as stopped answering the bridge. Run such a node on a
steady-clock timer (create_timer(..., clock=Clock(clock_type=ClockType.STEADY_TIME))
in rclpy), or set autoware.liveness_timeout_s=0.
The autoware group holds the bridge's settings (AutowareBridgeConfig:
address, ready_timeout_ticks, boot_timeout_s, boot_tick_period_s,
liveness_timeout_s, base_link_offset_m) and launcher. Any other key is
refused when the ego is built, with an error naming it:
+autoware.boot_timout_s=30 fails the run rather than leaving the default
timeout in place. The values are checked too, naming the key and showing the
value: a null setting is its default, as an absent one is; address is a
host:port with a port from 0 to 65535 (localhost:0 binds an ephemeral
port; an IPv6 host is bracketed, [::1]:50052); ready_timeout_ticks a positive whole number (1200,
or 1200.0, kept as the int); and the seconds and base_link_offset_m are
numbers, an int or a float. A boolean or a quoted number is refused rather
than read as 0, 1 or the number: autoware.liveness_timeout_s=false does not
turn the liveness check off (0 does), and ready_timeout_ticks: "1200" no
longer fails minutes into the run. driver.bridge takes the same settings and
is checked the same way.
timeout_s is still accepted but deprecated: it never had an effect, and
setting it only logs a warning. The scenario_bridge node's RPC timeouts are
its own ROS parameters, rpc_timeout_s (5 s, ReportReadiness) and
mission_poll_timeout_s (1 s, GetMission and ReportTurnIndicators): set
them in autoware.launcher.bridge_parameters, or on the node you start
yourself.
autoware.launcher is checked the same way. It holds the keys of both launcher
types at once (the shipped config does), and each type reads its own: type,
command and every DockerAutowareConfig field (workspace, launch,
devcontainer, image, workspace_mount, build, rosdep,
bridge_parameters, colcon_args, mounts, env, ros_domain_ids, gpus,
user, docker_args, docker, stop_timeout_s, container_prefix; the
command launcher reads env, stop_timeout_s and bridge_parameters of
these). A key neither type reads is refused whatever the type, naming it:
+autoware.launcher.stop_timout_s=60 fails the run, and a batch or a sweep
before its first scenario starts.
The values the launcher's type reads are checked there too, naming the key:
stop_timeout_smust be a finite number of seconds above 0 (an int or a float; not a boolean or a string), as the bridge's timeouts must. A NaN never times out, so a stack that ignoresSIGINTwould never be sentSIGTERMand the batch would hang; 0 or less would skip the grace the stack is given to shut down.- the docker launcher's
ros_domain_idsmust be a list (or null, for none) of whole numbers from 0 to 232, the domain ids ROS 2 can use: above 232 a domain's DDS ports are past 65535 (see The ROS_DOMAIN_ID). On Linux, that page advises 0 to 101, below the kernel's ephemeral ports. - the argument lists --
launch,colcon_args,docker_argsandcommand-- must be lists (or null, for none) of strings or numbers, each made a string. A string is refused, not split and not taken as one argument:"autoware.launcher.docker_args='--shm-size=8g'"used to rundocker run - - s h m ..., a character per argument, and'ros2 launch x y'may be one argument (abash -cscript) or four, which only you know. Write a list, quoting an item that holds spaces:'autoware.launcher.docker_args=[--shm-size=8g]','autoware.launcher.command=[bash,-c,"ros2 launch x y"]'. An item that is a list, a mapping, null or a boolean is refused too. envandmountsmust be mappings (or null) of strings or numbers, andbridge_parametersa mapping (or null) of ROS parameters. Anenvvalue is given as text or a number (ROS_LOCALHOST_ONLY: 1, nottrue).devcontainer,dockerandcontainer_prefixmust be non-empty text, andimage,workspace_mount,gpusandusernull or non-empty text (gpusmay also be a GPU count, 1 or more, asdocker run --gpus 2takes):false, any other number or''is refused rather than handed to Docker as"False"or used as a dev container path, a Docker CLI or a container name ofNone.
A setting that is null is its default, as one that is absent is: type,
workspace, devcontainer, build, rosdep, docker, stop_timeout_s and
container_prefix take the defaults in the table below. A null argument list
or mapping is none, and a null gpus no GPU. All of this is checked before a
container is started or the workspace is built.
+autoware.launcher.stop_timeout_s=nan,
'autoware.launcher.ros_domain_ids=[-3,999]' or
"autoware.launcher.docker_args='--shm-size=8g'" fails the run the same way.
DockerAutowareConfig, CommandAutowareLauncher and ProcessGroup refuse
such a stop_timeout_s, DockerAutowareConfig such a domain id, and
DockerAutowareConfig a str (or bytes) launch, colcon_args or
docker_args, and CommandAutowareLauncher a str argv, with a
ValueError when they are built from Python.
Settings¶
| Setting | Default | Meaning |
|---|---|---|
workspace |
~/autoware |
The autowarefoundation/autoware clone; null is the default, and anything but a non-empty path (false, '') is refused, naming autoware.launcher.workspace |
devcontainer |
universe-devel-cuda |
The .devcontainer/ variant whose image and mount are used; null is the default |
image |
null |
An image to use instead of the dev container's |
workspace_mount |
null |
Where to mount the workspace instead of where the dev container does |
build |
auto |
auto / always / never; null is the default |
rosdep |
true |
Also install the workspace's dependencies into the image the stack runs in. true or false, or one of their spellings as the run's switches take ("false", "off", "no", 0 are false); anything else (ture, 2) is refused, naming autoware.launcher.rosdep; null is the default |
bridge_parameters |
{use_sim_time: true} |
ROS parameters of the scenario_bridge node: auto_engage, initialize_localization, require_localization_initialized, route_watch_period_s, reroute_max_attempts, rpc_timeout_s, mission_poll_timeout_s, ... route_watch_period_s and mission_poll_timeout_s must suit autoware.liveness_timeout_s (above). For both launcher types, the mapping is merged over the default, and null or absent is the default: {auto_engage: false} keeps use_sim_time: true, which use_sim_time: false turns off. A null leaves a parameter at the node's default; a whole number for a seconds parameter is passed as a float, and a whole float for an integer one (reroute_max_attempts: 10.0) as the int, as the node declares them; a fraction for an integer one, a boolean or a string ('5') for a number, a NaN or an infinity for a seconds parameter, and a rpc_timeout_s, mission_poll_timeout_s, step_timeout_s or tick_period_s that is not above 0 are refused, naming the parameter (route_watch_period_s of 0 or less turns the re-route watch off) |
colcon_args |
[--symlink-install, --cmake-args, -DCMAKE_BUILD_TYPE=Release] |
Arguments to colcon build |
launch |
(required) | ros2 launch package, file and name:=value arguments |
mounts |
{~/autoware_data: /home/aw/autoware_data} |
Further mounts; a missing host path is skipped |
env |
{} |
Variables set in the container, over the dev container's own. Passed to docker run by name (--env KEY), so a value (a token) does not show in ps; one the Docker CLI reads itself (PATH, HOME, DOCKER_*, LD_*, PYTHON*, *_PROXY, SSL_*, ...) stays KEY=VALUE on the command line |
ros_domain_ids |
[] |
ROS_DOMAIN_ID per scenario, cycling, each 0 to 232; empty keeps the dev container's |
gpus |
all |
Docker's --gpus (device=0, or a count: 2); null for none |
user |
null |
Docker's --user; by default the image maps aw to your HOST_UID/HOST_GID |
docker_args |
[] |
Further docker run arguments |
docker |
docker |
The Docker CLI; null is the default |
stop_timeout_s |
20.0 |
How long stopping waits after each signal, in seconds above 0; null is the default |
container_prefix |
acs-autoware |
Container names start with this; null is the default |
ros_domain_ids moves each scenario's stack to another ROS domain, so it does
not discover what is left of the last one before those participants time out:
'autoware.launcher.ros_domain_ids=[10,11]'.
Under launcher=slurm each task maps these ids to domains no other task on
the node holds (slurm.md).
Sweeps¶
A sweep (--multirun hydra/sweeper=lanelet_constraint) runs each case in a
job of its own, and each job starts and removes its own Autoware the same way:
uv run scenario --multirun hydra/sweeper=lanelet_constraint \
scenario=intersection_passing/right_turn_sweep map=town10hd_opt \
ego.entity=autoware autoware.launcher.type=docker \
autoware.launcher.workspace=$HOME/autoware \
'autoware.launcher.launch=[...]' \
+sweep.job_timeout_seconds=900
sweep.job_timeout_seconds (120 s by default, and when null; + adds it
to a sweep YAML that does not set it; 0 for no timeout) is a whole job's
budget, in whole seconds -- a fraction, a negative value, NaN, infinity, a
value above 2147483647 (what signal.alarm takes) or text ('900') is
refused, with exit
status 2, before any job starts --
starting Autoware, localizing, routing, engaging and the scenario itself --
so raise it: launching Autoware alone can take most of two minutes. A job the
sweeper kills at that limit leaves its container behind, and the next job's
preparation removes it before its own stack starts.
To draw the weather, the sun or scenario parameters of each case from the
ODD, aimed at what earlier runs left uncovered, add a sweep.odd_sample
(Sampling scenarios from the ODD).
Autoware on the host¶
autoware.launcher.type=command runs a command of your own instead, as a
process group stopped with SIGINT, then SIGTERM, then SIGKILL. It is
sent SIGTERM if the process that started it dies -- a sweeper job killed at
its timeout -- so it does not outlive the job. It starts with SIGINT and
SIGQUIT at their defaults even when the run has them ignored, as a run in the
background (every SLURM task, a scenario ... & in a script) does, so the
SIGINT still shuts ros2 launch down cleanly rather than leaving it to the
SIGTERM after stop_timeout_s; the Docker launcher's docker run starts
the same way. {bridge_address}, {index} and {name}
are filled in, in one pass (what a placeholder is replaced with is never
filled in again), and the address is in AUTOWARE_BRIDGE_ADDRESS too.
{name} is the scenario's name with every character but A-Z, a-z, 0-9,
., _ and - replaced by _ -- the name the stack's log file carries --
so it can stand unquoted in a shell script. The name as given is in
AUTOWARE_SCENARIO_NAME; a script that needs it exactly reads
"$AUTOWARE_SCENARIO_NAME", quoted, and never pastes the name into the script
text itself, since a scenario's name comes from its config.
{scenario_bridge} is a shell command that runs the scenario_bridge node with
that address and autoware.launcher.bridge_parameters, for the command to run
beside the launch in Autoware's ROS 2 environment:
uv run scenario ego.entity=autoware autoware.launcher.type=command \
'autoware.launcher.command=[bash,-c,"source ~/autoware/install/setup.bash && ({scenario_bridge} &) && exec ros2 launch autoware_launch e2e_simulator.launch.xml scenario_mode:=true ..."]'
The node runs on the ROS 2 distribution's own python3, which needs
python3-grpcio and python3-protobuf 3.20 or later: Ubuntu 24.04's
python3-protobuf will do, but 22.04's (3.12, ROS 2 Humble's) cannot import
the node's generated code, so install a newer one over it there
(pip install 'protobuf>=4.25.0,<8'). It imports nothing of the framework
but autoware_carla_scenario.autoware_bridge: {scenario_bridge} puts a
directory on PYTHONPATH that holds that package alone
(~/.cache/autoware_carla_scenario/ros_bridge/).
CARLA's native Autoware interface¶
A CARLA 1.0 server started with -ros2 drives Autoware without a bridge
process (CARLA docs: Autoware):
it applies /control/command/control_cmd and publishes /vehicle/status/*
itself. It does so only for a vehicle whose role name is ego or hero and
that was spawned with the blueprint attribute ros2_autoware_control=true,
which cannot be set afterwards.
ego.native_autoware_interface=true (with ego.entity=autoware; a switch,
read as the others are, off when absent or null) spawns the
ego that way: it sets ros2_autoware_control=true and spawns the ego as
ego. Everything in the framework that looks the ego up by Ego
(EGO_ROLE_NAME: conditions, measures, metrics, actions) still finds it --
ego and hero, in any case, read as Ego
(autoware_carla_scenario.entity_role.canonical_role_name) -- so a scenario
does not change.
Three role names are in play, and they are not the same:
| Who | Role name |
|---|---|
| CARLA's server, applying the control and publishing the status | ego or hero only |
| The framework, spawning the ego | ego with the setting, Ego without |
| The framework, looking the ego up | Ego, ego or hero, all read as Ego |
Since those names all mean the ego, no other entity may take one. A
VehicleEntityConfig, MotorcycleEntityConfig,
EmergencyVehicleEntityConfig or PedestrianEntityConfig whose plain-string
role_name is ego or hero, in any case, is refused with a ValueError,
as an EntityRole is (the motorcycle, emergency vehicle and pedestrian
configs refuse Ego too; EgoConfig is built on VehicleEntityConfig).
A HILS device with a sensor, whose name is that sensor's role_name, is
refused the same way (hils.md).
An interface node running beside the scenario then only spawns the sensor kit,
and must look for the role name the ego was spawned with: ego with the
setting, Ego without (for autoware_carla_interface,
ego_vehicle_role_name:=ego or ego_vehicle_role_name:=Ego).
The setting is read only with ego.entity=autoware. The run-config check
refuses a value that is not true or false, and refuses true with any
other entity, before any scenario starts.
A server whose blueprints have no ros2_autoware_control (one older than
CARLA 1.0) spawns the ego as Ego, as without the setting, and the run logs a
warning. The setting is off by default.
From Python, AutowareEgoEntity(config, bridge=..., native_autoware_interface=True).
CARLA 1.0: autoware_carla_interface_v2¶
On CARLA 1.0 the server itself publishes the sensors and the vehicle status
and applies Autoware's control commands, so the Python bridge of
autoware_carla_interface is not needed.
autoware_carla_interface_v2
is the rclpy node that is left; its autoware_carla_scenario.launch.xml starts
Autoware (e2e_simulator.launch.xml with launch_simulator_interface:=false)
and the node in scenario mode, which attaches to the scenario's ego and spawns
the sensor kit on it. With that package in the workspace's src/, point the
launcher at its launch file:
uv run scenario 'scenario=intersection_passing/*' map=town10hd_opt \
ego.entity=autoware \
autoware.launcher.type=docker \
autoware.launcher.workspace=$HOME/autoware \
'autoware.launcher.launch=[autoware_carla_interface_v2,autoware_carla_scenario.launch.xml,"map_path:=/home/aw/autoware_map/Town10HD_Opt"]'
That launch file declares scenario_mode, which is what the docker launcher's
workspace check accepts in place of autoware_carla_interface's. Localization,
routing and engaging stay with scenario_bridge, as above.
Add ego.native_autoware_interface=true (above)
so the server applies Autoware's control and publishes the vehicle status; the
ego is then spawned as ego, the name the server serves, and the node attaches
to it under that name (as Ego without the setting). Without it, the node
applies the control and publishes the status from the client.
Starting Autoware yourself¶
With autoware.launcher.type=none, start Autoware with scenario_mode:=true
and the node beside it, once the scenario is waiting for Autoware:
source ~/autoware/install/setup.bash
PYTHONPATH=$(uv run python -c "from autoware_carla_scenario.autoware_stack.bridge_node import host_python_root; print(host_python_root())") \
python3 -m autoware_carla_scenario.autoware_bridge.ros_bridge \
--ros-args -p bridge_address:=localhost:50052 -p use_sim_time:=true &
ros2 launch autoware_launch e2e_simulator.launch.xml simulator_type:=carla scenario_mode:=true ...
From Python¶
from pathlib import Path
from autoware_carla_scenario import ScenarioQueue
from autoware_carla_scenario.autoware_stack import (
DockerAutowareConfig,
DockerAutowareLauncher,
)
launcher = DockerAutowareLauncher(
DockerAutowareConfig(
workspace=Path("~/autoware"),
launch=(
"autoware_launch",
"e2e_simulator.launch.xml",
"scenario_mode:=true",
),
)
)
queue = ScenarioQueue(map_name="Town10HD_Opt", autoware_launcher=launcher)
# Each scenario's AutowareEgoEntity is given the same launcher:
# AutowareEgoEntity(config, bridge=..., launcher=launcher)
The queue prepares the launcher when it starts and closes it when it stops;
AutowareEgoEntity starts and stops a stack per scenario. Any object with
prepare / start / poll / stop / close
(autoware_carla_scenario.autoware_stack.AutowareLauncher) can stand in for
the two launchers that ship; it starts the scenario_bridge node with the
stack (autoware_carla_scenario.autoware_stack.bridge_node builds its command).