feat: hangar_sim, add beluga_amcl localization with hardcoded initial…#605
feat: hangar_sim, add beluga_amcl localization with hardcoded initial…#605bkanator wants to merge 1 commit into
Conversation
9a9d7a0 to
308ed11
Compare
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR enables map-based localization using beluga_amcl in the simulation environment. It refactors ChangesLocalization feature enablement
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/hangar_sim/launch/sim/robot_drivers_to_persist_sim.launch.py (1)
329-337:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winFix duplicate
conditionkeyword instatic_tf_map_to_odomNode call (parse-time failure).
static_tf_map_to_odom = Node(...)passescondition=twice (lines 329-337), which prevents the launch file from compiling/executing. Remove the secondcondition.Suggested fix
static_tf_map_to_odom = Node( condition=IfCondition( PythonExpression(["not ", slam, " and not ", localization]) ), package="tf2_ros", executable="static_transform_publisher", name="static_tf_map_to_odom", output="log", arguments=["0.0", "0.0", "0.0", "0.0", "0.0", "0.0", "map", "odom"], - condition=IfCondition(PythonExpression(["not ", slam])), )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/hangar_sim/launch/sim/robot_drivers_to_persist_sim.launch.py` around lines 329 - 337, The Node call that creates static_tf_map_to_odom passes the condition= keyword twice causing a parse error; edit the Node(...) for static_tf_map_to_odom to remove the duplicate condition argument (keep the intended condition IfCondition(PythonExpression(["not ", slam, " and not ", localization])) and delete the later condition=IfCondition(PythonExpression(["not ", slam]))). Ensure only one condition kwarg exists on the static_tf_map_to_odom Node to restore valid launch file syntax.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/hangar_sim/launch/sim/localization_launch.py`:
- Line 60: Remove the unused LaunchConfiguration assignment by deleting the
log_level = LaunchConfiguration("log_level") line (remove the symbol log_level
and its LaunchConfiguration call) so the unused variable no longer triggers
F841; ensure no other references to log_level remain and run lint to confirm the
warning is resolved.
- Around line 82-83: The gate compares
context.perform_substitution(localization) to the exact string "True", which
fails for "true"/" TRUE"/etc.; normalize the substituted localization value
before comparing (e.g., call .strip().lower() on the result) so the check uses a
boolean-safe comparison in the if statement that currently references
localization; update that condition in localization_launch.py to compare the
normalized string to "true".
---
Outside diff comments:
In `@src/hangar_sim/launch/sim/robot_drivers_to_persist_sim.launch.py`:
- Around line 329-337: The Node call that creates static_tf_map_to_odom passes
the condition= keyword twice causing a parse error; edit the Node(...) for
static_tf_map_to_odom to remove the duplicate condition argument (keep the
intended condition IfCondition(PythonExpression(["not ", slam, " and not ",
localization])) and delete the later
condition=IfCondition(PythonExpression(["not ", slam]))). Ensure only one
condition kwarg exists on the static_tf_map_to_odom Node to restore valid launch
file syntax.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 00862f77-0187-4d32-8292-dec8e39708d2
📒 Files selected for processing (4)
src/hangar_sim/launch/sim/localization_launch.pysrc/hangar_sim/launch/sim/robot_drivers_to_persist_sim.launch.pysrc/hangar_sim/package.xmlsrc/hangar_sim/params/nav2_params.yaml
| container_name = LaunchConfiguration("container_name") | ||
| container_name_full = (namespace, "/", container_name) | ||
| use_respawn = LaunchConfiguration("use_respawn") | ||
| log_level = LaunchConfiguration("log_level") |
There was a problem hiding this comment.
Remove the unused log_level LaunchConfiguration assignment.
Line 60 is assigned but never used, matching the reported F841 and likely failing lint CI.
Suggested fix
- log_level = LaunchConfiguration("log_level")📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| log_level = LaunchConfiguration("log_level") |
🧰 Tools
🪛 Flake8 (7.3.0)
[error] 60-60: local variable 'log_level' is assigned to but never used
(F841)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/hangar_sim/launch/sim/localization_launch.py` at line 60, Remove the
unused LaunchConfiguration assignment by deleting the log_level =
LaunchConfiguration("log_level") line (remove the symbol log_level and its
LaunchConfiguration call) so the unused variable no longer triggers F841; ensure
no other references to log_level remain and run lint to confirm the warning is
resolved.
| if context.perform_substitution(localization) != "True": | ||
| return [] |
There was a problem hiding this comment.
Normalize the localization value before map-check gating.
Line 82 does an exact "True" comparison, so localization:=true skips validation while localization can still run. Make the gate boolean-safe.
Suggested fix
def check_map_exists(context):
- if context.perform_substitution(localization) != "True":
+ localization_enabled = (
+ context.perform_substitution(localization).strip().lower()
+ in ("true", "1", "yes", "on")
+ )
+ if not localization_enabled:
return []🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/hangar_sim/launch/sim/localization_launch.py` around lines 82 - 83, The
gate compares context.perform_substitution(localization) to the exact string
"True", which fails for "true"/" TRUE"/etc.; normalize the substituted
localization value before comparing (e.g., call .strip().lower() on the result)
so the check uses a boolean-safe comparison in the if statement that currently
references localization; update that condition in localization_launch.py to
compare the normalized string to "true".
|
|
|
here are initial videos with beluga integrated with ground truth odom but not tuning. first is a successful run, and the second is showing failure with getting near the plane. particle_first-2026-06-09_09.52.29.mp4particle_fail-2026-06-09_09.47.02.mp4 |
|
Todo: fix reset of particles after failure, tune resampling weights. |
9c936bf to
1f0a472
Compare
|
1f0a472 to
781f710
Compare
|
Closes PickNikRobotics/moveit_pro#18065
Adds
beluga_amcllocalization to hangar_sim and makes the navigation Objectives recover cleanly between runs.What
beluga_amclas the AMCL localizer whenslam:=False(defaultlocalization:=True), replacing the static identitymap → odomTF.map_server+beluga_amcl+lifecycle_managerload into the existingnav2_container; an initial pose is published 3 s after launch so the filter seeds at the sim spawn without a manual estimate./initialpose, then clears the global/local costmaps.joint_trajectory_controlleron failure — fixes "objective fails → can't run anything until restart."Why
The old setup had no real localization (a static identity TF stood in for
map → odom). beluga estimates the pose from laser scans; the reset + controller-restore make failed runs recoverable in place.Depends on
PickNikRobotics/moveit_pro#19710 — adds the
SetInitialPoseandClearCostmapBehaviors these Objectives use. CI here fails until that merges.Release notes
Enhancement: Added
beluga_amcllocalization tohangar_sim, replacing the staticmap → odomidentity TF with laser-scan-based localization, with automatic localization + costmap reset and controller recovery on each navigation run.Claude agent checks
code-reviewertest-runnerplatform-architect-bot