Skip to content

Commit

Permalink
#2243 Relocate MultipleObjectTrackerNode params (#2244)
Browse files Browse the repository at this point in the history
Relocate parameter declarations to after the on_set_parameters
callback declaration. This is needed because declaring parameters will
trigger the callback, which needs to be set in order for the parameter
changes to take effect.
  • Loading branch information
adamlm authored Jan 2, 2024
1 parent 50f51fb commit 8717de2
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,6 @@ auto MultipleObjectTrackerNode::handle_on_configure(
}
});

declare_parameter(
"execution_frequency_hz", mot::remove_units(units::frequency::hertz_t{1 / execution_period_}));

declare_parameter(
"track_promotion_threshold", static_cast<int>(track_manager_.get_promotion_threshold().value));

declare_parameter(
"track_removal_threshold", static_cast<int>(track_manager_.get_promotion_threshold().value));

on_set_parameters_callback_ =
add_on_set_parameters_callback([this](const std::vector<rclcpp::Parameter> & parameters) {
rcl_interfaces::msg::SetParametersResult result;
Expand Down Expand Up @@ -338,6 +329,15 @@ auto MultipleObjectTrackerNode::handle_on_configure(
return result;
});

declare_parameter(
"execution_frequency_hz", mot::remove_units(units::frequency::hertz_t{1 / execution_period_}));

declare_parameter(
"track_promotion_threshold", static_cast<int>(track_manager_.get_promotion_threshold().value));

declare_parameter(
"track_removal_threshold", static_cast<int>(track_manager_.get_promotion_threshold().value));

RCLCPP_INFO(get_logger(), "Lifecycle transition: successfully configured");

return carma_ros2_utils::CallbackReturn::SUCCESS;
Expand Down

0 comments on commit 8717de2

Please sign in to comment.