Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/hangar_sim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ if(BUILD_TESTING)
find_package(ament_cmake_pytest REQUIRED)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
ament_add_pytest_test(
nav2_params_distro_parity_test test/nav2_params_distro_parity_test.py
TIMEOUT 60)
# Redirect ROS node logs into the test_results tree so the test-results CI
# artifact ships them back too. Default would be ~/.ros/log/, which lives
# on the doomed container filesystem and never gets uploaded -- making
Expand Down
34 changes: 33 additions & 1 deletion src/hangar_sim/launch/sim/robot_drivers_to_persist_sim.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
DeclareLaunchArgument,
GroupAction,
IncludeLaunchDescription,
LogInfo,
SetEnvironmentVariable,
)
from launch.conditions import IfCondition
Expand Down Expand Up @@ -142,9 +143,39 @@ def generate_launch_description():
description="Use simulation clock if true",
)

# Nav2's pluginlib lookup names differ by distro: Humble exports `pkg/Class`,
# Jazzy exports `pkg::Class`, and the two are mutually exclusive. Jazzy's
# bt_navigator also loads its default BT plugin libraries implicitly, so
# listing them again double-registers every node. Each distro therefore gets
# its own parameter file. This is the only place the choice is made: every
# nav2 consumer below -- the slam, localization and navigation includes, and
# the nav2_container node -- takes it from the `params_file` argument.
# Anything that is not Jazzy gets the Humble file, which is correct for the
# two distros the 9.4 line publishes; a future distro must be added here
# explicitly rather than inheriting the Humble form by default.
ros_distro = os.environ.get("ROS_DISTRO", "")
nav2_params_file = (
"nav2_params_jazzy.yaml" if ros_distro == "jazzy" else "nav2_params.yaml"
)
# The wrong branch reproduces the bug this selection exists to avoid, and the
# only symptom is nav2_container aborting, so name the choice in the log.
nav2_params_log = LogInfo(
msg=(
[f"nav2 params (ROS_DISTRO={ros_distro}): ", params_file]
if ros_distro in ("humble", "jazzy")
else [
f"WARNING: ROS_DISTRO={ros_distro or 'unset'} is not a distro "
f"hangar_sim ships nav2 parameters for; defaulting to "
f"{nav2_params_file}, which is only correct for Humble. "
"nav2 params: ",
params_file,
]
)
)

declare_params_file_cmd = DeclareLaunchArgument(
"params_file",
default_value=os.path.join(config_dir, "params", "nav2_params.yaml"),
default_value=os.path.join(config_dir, "params", nav2_params_file),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
description="Full path to the ROS2 parameters file to use for all launched nodes",
)

Expand Down Expand Up @@ -371,6 +402,7 @@ def generate_launch_description():
ld.add_action(declare_map_yaml_cmd)
ld.add_action(declare_use_sim_time_cmd)
ld.add_action(declare_params_file_cmd)
ld.add_action(nav2_params_log)
ld.add_action(declare_autostart_cmd)
ld.add_action(declare_use_composition_cmd)
ld.add_action(declare_use_respawn_cmd)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@
user_pose="{goal}"
view_name="Visualization"
/>
<!-- Empty makes nav2 use its own default_nav_to_pose_bt_xml, which keeps this
objective free of a distro-specific path. Note the default tree is not
identical across distros: Jazzy's backs up faster and gates recovery on
error codes. Pin default_nav_to_pose_bt_xml in the params files if the
recovery behavior ever needs to match exactly. -->
<Action
ID="NavigateToPoseAction"
action_name="/navigate_to_pose"
behavior_tree_path="/opt/ros/humble/share/nav2_bt_navigator/behavior_trees/navigate_to_pose_w_replanning_and_recovery.xml"
behavior_tree_path=""
pose_stamped="{goal}"
/>
<Action
Expand Down
3 changes: 3 additions & 0 deletions src/hangar_sim/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
<exec_depend>moveit_pro_sam2</exec_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_cmake_pytest</test_depend>
<test_depend>python3-pytest</test_depend>
<test_depend>python3-yaml</test_depend>

<test_depend>ament_clang_format</test_depend>
<test_depend>ament_clang_tidy</test_depend>
Expand Down
Loading
Loading