feat(autoware_demo): add --spawn_pose for maps without usable spawn points - #37
Draft
youtalk wants to merge 1 commit into
Draft
feat(autoware_demo): add --spawn_pose for maps without usable spawn points#37youtalk wants to merge 1 commit into
youtalk wants to merge 1 commit into
Conversation
…oints autoware_demo.py can only place the ego on one of the level's spawn points, so a map that ships none offers no way to start at all, and a map that ships a single one fixes every run to the same start. The AWSIM Nishi-Shinjuku level is the latter: one spawn point, and no way to aim a run at a goal derived from the map's own lanelet2 geometry. Add --spawn_pose "X,Y,Z,YAW" (CARLA metres and degrees), which overrides --spawn_index, and pass it through run_carla_autoware.sh as --spawn-pose, mutually exclusive with --spawn-index. Z is the caller's responsibility: the demo does not probe the ground height at (X, Y). Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem.
autoware_demo.pycan place the ego only on one of the level's own spawn points, selected by--spawn_index. A map that ships none therefore offers no way to start at all, and a map that ships exactly one fixes every run to the same start pose. Neither case is unusual for an imported map: spawn points are authored content, and a digital twin imported from OpenDRIVE plus lanelet2 arrives with whatever its converter happened to emit.The concrete case. The AWSIM Nishi-Shinjuku level exposes exactly one CARLA spawn point (
ego_spawn_points: 1,~/ue58-logs/p3/01-map-probe.txt). Reproducible gate cells need a specific start pose chosen to suit the route being measured — in this work, a pose derived from the map's own lanelet2 geometry so that the start and the goal are expressed in the same frame the stack localises in. With only--spawn_indexavailable there is no way to ask for one.Change. Add
--spawn_pose "X,Y,Z,YAW"toautoware_demo.py— CARLA metres and degrees — which overrides--spawn_index, and pass it throughrun_carla_autoware.shas--spawn-pose, mutually exclusive with--spawn-index. Three unit tests cover the new parser. The spawn-selection block continues to prefer the level's ego spawn points and to fall back as before when no pose is given, so the default path is unchanged.One implementation detail worth a reviewer's attention. The composed command uses the
--spawn_pose=<value>form rather than a separate argv word. That is not cosmetic: see the note under "Where has this been tested?".Where has this been tested?
CarlaUnreal/UnrealEngine@ue58-dev-carlacacb25b99f14Unit tests, run locally.
python -m pytest PythonAPI/test/unit/test_autoware_demo_args.py— 3 tests coveringparse_spawn_pose, including that"1,2,3"(three fields instead of four) raisesargparse.ArgumentTypeError. They were written before the implementation and were confirmed to fail withAttributeErroragainst the parent commit, and to fail again when extracted and run against the unmodifiedautoware_demo.py. The suite's two pre-existing failures elsewhere inPythonAPI/test/unit(test_vehicle'smoiattribute andtest_client's version string) are present identically on the parent commit and are untouched by this change. No fork CI job runs this directory, as stated at the top.Live, three full closed-loop cells on Nishi-Shinjuku. Every cell passed
--spawn-pose "-278.383,220.550,-0.975,-33.780"with--goal "-84.114,117.602,-10.442"and reached routing state 3 = ARRIVED:N-content(~/ue58-logs/p3-10-cell-nishi-content/),N-fallback(~/ue58-logs/p3-11-cell-nishi-fallback/) andN-humble(~/ue58-logs/p3-12-cell-nishi-humble/). Gate verdicts are in each cell'sgates/gates.txt.The requested pose is the pose the vehicle got, checked against a second representation of the road. The XY and yaw were derived offline from the lanelet2 centreline (lanelet 255 at
s = 7.477,~/ue58-logs/p3/11-spawn-derivation.txt) and then cross-checked live against CARLA's OpenDRIVE waypoints (Map.get_waypoint,lane_type=Driving,~/ue58-logs/p3/12-poses.txt): nearest waypoint-278.366, 220.557on road 108 / lane 2, lateral distance 0.018 m, yaw difference +0.09°, against thresholds of 0.5 m and 5°. The two sides of that comparison are produced by independent pipelines — a lanelet2 reader and CARLA's own OpenDRIVE map — so a frame or converter error would show as a multi-metre gap rather than 18 mm on a ~3.5 m lane. TheZcomponent is the live ground height plus 0.3 m:cast_rayreturnedground_z = -1.274694800376892and the pose carries-0.975.A defect this feature found in itself, caught only by a live run. The first
N-contentattempt produced no ego vehicle and no gate verdicts.run_carla_autoware.shcomposed${SPAWN_POSE:+ --spawn_pose $SPAWN_POSE}, so the value arrived as a separate argv word; Nishi's pose begins with-and is not a bare negative number, soargparserejected it andautoware_demo.pydied at parse time withargument --spawn_pose: expected one argument(~/ue58-logs/p3-10-cell-nishi-content-FAILED-argv/autoware_demo.log). A dry run cannot catch this: it prints the composed command string and never hands it to a parser, so a text-level review of the printed line passes while the bug is live — and the printed line is not even a faithful rendering of the executed argv, because the dry-run display re-wraps an already-quoted string. Fixed here by switching to the=form, and verified at the parser level rather than by text match: the command was composed the way the script composes it and the resulting argv fed toautoware_demo.py's real parsers, where the new form parses and the old form splits into four words and raises.Limits of the live evidence, stated plainly. One map, one pose, one route, one build; three cells differing in level state and ROS distro, not in the pose.
N-humble's G3 control gate reports FAIL at 36.33 Hz; that is a property of how the gate scores its measurement — it returns only the last rate window, and an intermittent duplicate-delivery burst oncontrol_cmdcontaminates windows in all three cells — and is unrelated to this change.Possible Drawbacks
Zis the caller's responsibility. The demo does not probe the ground height at(X, Y). AZbelow the surface drops the vehicle through the map and aZfar above it makes the vehicle fall, in both cases before the stack has anything to localise. The cells above obtainedZfrom a separatecast_rayprobe; nothing in this change does that for the user.YAWis unvalidated beyond being a number. A pose that is geometrically on the road but facing the wrong way produces a route the planner cannot follow, and the failure surfaces well downstream of the flag.run_carla_autoware.shvalidatesX,Y,Z,YAWwith a shell regex andautoware_demo.pyvalidates it again inparse_spawn_pose. This is defence in depth rather than a defect — the demo is usable directly — but the two must be kept in step.--spawn-poseand--spawn-indexcannot be given together at the shell level, and--spawn_poseoverrides--spawn_indexat the Python level. A caller invoking the demo directly with both gets the pose, without a warning.