Skip to content

Unify ROS params: replace C++ PARAM_ macros with YAML-based config structs (vision filter + planning)#2499

Closed
Copilot wants to merge 8 commits intoros2from
copilot/unify-ros-params-across-files
Closed

Unify ROS params: replace C++ PARAM_ macros with YAML-based config structs (vision filter + planning)#2499
Copilot wants to merge 8 commits intoros2from
copilot/unify-ros-params-across-files

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 23, 2026

Description

Replaces the custom DEFINE_*/DECLARE_*/PARAM_ macro-based parameter system with plain config structs populated from YAML via this->get_parameter(). This eliminates the indirection of global static variables and aligns with standard ROS2 parameter patterns.

Vision Filter module (~33 files):

  • New VisionFilterConfig struct in params.hpp holds all vision filter parameters
  • VisionFilter node loads params from YAML in load_config(), passes config down the class hierarchy: World → Camera → KalmanBall/KalmanRobot → KalmanFilter2D/3D, kick detectors, bounce, world ball/robot
  • Removed all DEFINE_NS_FLOAT64, DECLARE_*, using PARAM_* from vision filter sources
  • Removed global_params.hpp and LocalROS2ParamProvider dependencies from vision filter

Planning module (~28 files):

  • New PlanningConfig struct with all planner parameters (constraints, RRT, replanner, collect, settle, escape, pivot, intermediate)
  • PlannerNode loads config and threads it through PlannerForRobot → PathPlanner subclasses via PlanRequest
  • Updated MotionConstraints/RotationConstraints to use hardcoded defaults instead of PARAM_ references
  • Updated all path planners: collect, settle, escape, pivot, line_pivot, rotate, plus replanner, create_path, rrt_util

Example — before:

#include <rj_param_utils/vision/vision_params.hpp>
DEFINE_NS_FLOAT64(kVisionFilterParamModule, ball, init_covariance, 100.0, "...")
// usage:
double p = ball::PARAM_init_covariance;

Example — after:

// VisionFilter node:
this->get_parameter("ball.init_covariance", cfg.ball.init_covariance);
// Non-node class receives config in constructor:
double p = config_.ball.init_covariance;

Not yet addressed (follow-up work):

  • Control module (motion_control.cpp)
  • Common module (world_state.cpp, packet_convert.cpp)
  • Radio and joystick modules
  • Removal of now-unused rj_param_utils infrastructure (param.hpp macros, global_params.cpp/hpp, planning_params.cpp/hpp, vision_params.cpp/hpp)
  • YAML file consolidation

Associated Issue

Unify ROS params across all files for consistent YAML-based access.

Design Documents

Pattern follows ROS2 Global Parameters — nodes load params from YAML, pass values to non-node classes via config structs.

Steps to test

Test Case 1

  1. Build with make
  2. Run vision filter and planning tests
  3. Launch soccer.launch.py with sim_params.yaml — verify vision filter and planner initialize with correct parameter values

Expected result: All parameters load from YAML identically to previous macro-based behavior. No functional change.

(Optional) Sub-issues (for drafts)

  • Vision filter module: config struct + all source/test files updated
  • Planning module: config struct + all planner/primitive files updated
  • Control module (motion_control)
  • Common module (world_state, packet_convert)
  • Radio + joystick modules
  • Remove unused rj_param_utils macro infrastructure
  • Consolidate/deduplicate YAML parameter files

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 23, 2026 01:31
Refactor the vision filter module to remove DEFINE_*/DECLARE_*/PARAM_ macro-based
parameter system and replace it with a config struct approach. The VisionFilterConfig
struct (already created in params.hpp) is now passed through the class hierarchy:

- KalmanFilter2D/KalmanFilter3D: Accept config in parameterized constructors
- KalmanBall/KalmanRobot: Accept and store config reference, use for filter
  health params, kick detector hist length, and max time outside vision
- WorldBall/WorldRobot: Accept config parameter for merger power settings
- BallBounce: Accept config parameter for bounce damping coefficients
- FastKickDetector/SlowKickDetector: Store config pointer for kick detection params
- Camera: Pass config through to KalmanBall/KalmanRobot/BallBounce
- World: Initialize kick detectors with config, pass config to world objects

All test files updated to create VisionFilterConfig instances and pass them
to the updated constructors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…d of PARAM_ macros

Co-authored-by: rishiso <52169818+rishiso@users.noreply.github.com>
…_planner

- Replace all collect::PARAM_* with plan_request.planning_config->collect.*
- Replace all settle::PARAM_* with plan_request.planning_config->settle.*
- Update Replanner::partial_replan_lead_time() call to pass config
- Add plan_request.planning_config to all Replanner::PlanParams constructions
- Update check_solution_validity header signature to accept PlanningConfig&

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…anner

- Replace all settle::PARAM_X accesses with plan_request.planning_config->settle.X
  in plan() and intercept() methods
- Add const PlanningConfig& config parameter to check_solution_validity() and
  calc_delta_pos_for_dir(), using config.settle.X internally
- Update call sites in plan() to pass *plan_request.planning_config
- Add planning_config to Replanner::PlanParams aggregate initializations
- Update header file with new #include and updated function signatures

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI and others added 2 commits February 23, 2026 02:01
…lanning pipeline

- PlannerNode: Add load_planning_config() to read params from ROS2 YAML
- PlanRequest: Add planning_config pointer member
- PlannerForRobot: Accept and pass PlanningConfig to PlanRequest
- Update all Replanner::PlanParams initializations to include config
- Pass PlanningConfig to CreatePath::intermediate calls in planners
- Remove global param provider from main.cpp
- Remove rj_param_utils includes from planner_node.hpp

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address code review feedback: use PlanningConfig{}.member instead of
magic numbers for fallback values in pivot planners and planner_for_robot.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI changed the title [WIP] Unify ROS parameters to use YAML files consistently Unify ROS params: replace C++ PARAM_ macros with YAML-based config structs (vision filter + planning) Feb 23, 2026
Copilot AI requested a review from rishiso February 23, 2026 02:06
automated style fixes

Co-authored-by: Copilot <Copilot@users.noreply.github.com>
@Squid5678 Squid5678 closed this Apr 14, 2026
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.

3 participants