Skip to content

Tuning navigation - Great improvements#115

Merged
ErikCald merged 2 commits into
mainfrom
erik-nav2-working
May 13, 2026
Merged

Tuning navigation - Great improvements#115
ErikCald merged 2 commits into
mainfrom
erik-nav2-working

Conversation

@ErikCald
Copy link
Copy Markdown
Contributor

This pull request introduces several important changes across navigation, localization, and visualization configurations, with the main goals of improving navigation behavior, updating GPS handling, and enhancing system robustness. The changes include updates to launch files for better velocity command remapping, adjustments to EKF localization parameters, improvements to mission cancellation handling to avoid deadlocks, and tuning of path planning parameters for better path quality and safety.

Navigation and Velocity Command Handling:

  • Updated nav2.launch.py to explicitly remap cmd_vel and cmd_vel_smoothed topics for the navigation stack and velocity smoother, ensuring correct topic flow and compatibility with other components. [1] [2] [3] [4]

Localization and EKF Configuration:

  • Modified both global and local EKF configurations to adjust which position and velocity components are fused from GPS and wheel odometry, improving localization accuracy and consistency. [1] [2] [3] [4] [5] [6]

Mission Handling and Deadlock Prevention:

  • Refactored mission cancellation and update logic in cprt_commander.py to run potentially blocking operations like navigator.cancelTask() in background threads, preventing deadlocks in the ROS 2 executor and improving reliability during mission updates and target detection. [1] [2] [3] [4]

GPS and Launch Configuration:

  • Changed the GPS base station launch to use a new node (gps_base_pub_node), updated device path and baudrate, and revised survey-in parameters for improved RTK base station operation.
  • Added known GPS coordinates for edc_grass1 and edc_home locations. [1] [2]

Navigation Parameter Tuning:

  • Tuned Hybrid-A* planner parameters: decreased max_planning_time, increased minimum_turning_radius, and raised non-straight and cost penalties to favor safer, more predictable paths.

Additional Improvements:

  • Updated RViz visualization configuration to add new frames (utm), remove unused links, and adjust camera and view settings for better visualization. [1] [2] [3] [4] [5] [6]
  • Fixed behavior tree path resolution in cprt_commander.py to use a static install path, improving deployment reliability.
  • Improved logging and debugging output in navigation dispatch logic.

These changes collectively improve the system's navigation robustness, localization accuracy, and operational reliability, especially in mission-critical scenarios.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tunes Nav2 planning/control/smoothing parameters, updates launch-time cmd_vel remapping behavior, adjusts robot_localization EKF sensor fusion settings for GPS/wheel/IMU inputs, and refactors mission cancellation/update flow in the nav commander to avoid executor deadlocks.

Changes:

  • Retuned Nav2 planner/smoother/controller and velocity smoother limits for improved path quality and outdoor swerve behavior.
  • Updated Nav2 launch to explicitly remap cmd_vel / cmd_vel_smoothed topic flow.
  • Modified mission cancellation/update handling and updated GPS base station launch + added known GPS coordinate files.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Nav/navigation/params/nav2.yaml Planner/smoother/controller tuning and velocity smoother limit changes.
src/Nav/navigation/launch/nav2.launch.py Cmd_vel and cmd_vel_smoothed remapping adjustments for composed and non-composed bringup.
src/Nav/nav_commanders/nav_commanders/cprt_commander.py Mission cancellation/update logic refactor and BT path resolution changes.
src/Nav/nav_commanders/known_gps_coords/edc_home.yaml Adds a named lat/lon coordinate.
src/Nav/nav_commanders/known_gps_coords/edc_grass1.yaml Adds a named lat/lon coordinate.
src/Nav/localization/config/ekf/gps_ekf_local.yaml Updates local EKF fusion configuration for GPS/wheel odom/IMU inputs.
src/Nav/localization/config/ekf/gps_ekf_global.yaml Updates global EKF fusion configuration for GPS/wheel odom/IMU inputs.
src/Nav/gps/launch/basestation.launch.py Switches to new base station node and updates serial/survey-in parameters.
src/Nav/compressed_telemetry_cpp/rviz/compressed_nav2.rviz RViz frame/display updates (e.g., add utm, remove unused links, view tweaks).
Comments suppressed due to low confidence (5)

src/Nav/navigation/launch/nav2.launch.py:249

  • This node no longer uses the shared remappings list, which drops the /tf and /tf_static remaps and bypasses the cmd_vel_topic launch argument. It also introduces cmd_vel remaps that should likely be added on top of the common remappings for consistency. Consider composing remappings (common + cmd_vel/cmd_vel_smoothed) instead of replacing them.
            Node(
                package="nav2_velocity_smoother",
                executable="velocity_smoother",
                name="velocity_smoother",
                output="screen",
                namespace=namespace,
                respawn=use_respawn,
                respawn_delay=2.0,
                parameters=[configured_params],
                remappings=[
                    ("cmd_vel", "cmd_vel_nav"),
                    ("cmd_vel_smoothed", "cmd_vel"),
                ],
            ),

src/Nav/navigation/launch/nav2.launch.py:291

  • The composed controller_server also replaces the shared remappings list, dropping /tf and /tf_static remaps and ignoring the cmd_vel_topic launch argument. For consistency with the non-composed path and other nodes, consider appending the cmd_vel remap to the existing remappings list instead.
            ComposableNode(
                package="nav2_controller",
                plugin="nav2_controller::ControllerServer",
                name="controller_server",
                parameters=[configured_params],
                remappings=[("cmd_vel", "cmd_vel_nav")],
            ),

src/Nav/navigation/launch/nav2.launch.py:348

  • The composed velocity_smoother also replaces the shared remappings list, dropping /tf and /tf_static remaps and ignoring the cmd_vel_topic launch argument. Consider composing remappings (common + cmd_vel/cmd_vel_smoothed) to keep TF/topic remapping behavior consistent across all nav2 nodes.
            ComposableNode(
                package="nav2_velocity_smoother",
                plugin="nav2_velocity_smoother::VelocitySmoother",
                name="velocity_smoother",
                parameters=[configured_params],
                remappings=[
                    ("cmd_vel", "cmd_vel_nav"),
                    ("cmd_vel_smoothed", "cmd_vel"),
                ],

src/Nav/navigation/params/nav2.yaml:211

  • The optimizer.max_iterations comment says "reduced from 70 for faster convergence" but the value is now 80, and the tolerance-related comments were removed while values changed substantially. Please update the comment to reflect the current intent (higher iterations vs. convergence criteria) to avoid confusion when tuning.
      optimizer:
        max_iterations: 80            # max iterations of smoother (reduced from 70 for faster convergence)
        debug_optimizer: false        # print debug info
        gradient_tol: 5000.0
        fn_tol: 1.0e-15
        param_tol: 1.0e-20

src/Nav/nav_commanders/nav_commanders/cprt_commander.py:131

  • Behavior tree paths are now hard-coded to /rover/install/..., which will fail in non-container setups, local dev workspaces, or when the install prefix changes. Prefer resolving via get_package_share_directory('navigation') (or a launch/parameter override) and only fall back to a fixed path if needed.
        # Dynamically resolve BT paths
        # nav_pkg_share = get_package_share_directory("navigation")
        nav_pkg_share = "/rover/install/navigation/share/navigation"
        self.nav_bt_path = os.path.join(
            nav_pkg_share, "behavior_trees", self.nav_bt_file
        )
        self.search_bt_path = os.path.join(
            nav_pkg_share, "behavior_trees", self.search_bt_file
        )

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +32 to +33
{"SvinMindur": 300}, # Survey in time (s)
{"SvinMinAccDur": 10_000}, # Survey in accuracy (mm)
Comment thread src/Nav/navigation/launch/nav2.launch.py
Comment thread src/Nav/navigation/params/nav2.yaml
Comment thread src/Nav/navigation/params/nav2.yaml
Comment thread src/Nav/nav_commanders/nav_commanders/cprt_commander.py
@ErikCald ErikCald merged commit a840249 into main May 13, 2026
6 checks passed
@ErikCald ErikCald deleted the erik-nav2-working branch May 13, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants