Skip to content

Commit

Permalink
#2202 Move default mapping values to class
Browse files Browse the repository at this point in the history
The default motion model mapping values were specified in the ROS
parameter declarations, but this meant the MotionModelMapper instance
never got them. Its values wouldn't be updated unless a user changed
them. Now, the default values are stored in the class instance, and the
ROS parameter declarations get their default values from the instance.
  • Loading branch information
adamlm committed Nov 30, 2023
1 parent a2a63cf commit 8077443
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ auto to_detection_list_msg(const carma_v2x_msgs::msg::SensorDataSharingMessage &

struct MotionModelMapping
{
std::uint8_t small_vehicle_model;
std::uint8_t large_vehicle_model;
std::uint8_t motorcycle_model;
std::uint8_t pedestrian_model;
std::uint8_t unknown_model;
std::uint8_t small_vehicle_model{carma_cooperative_perception_interfaces::msg::Detection::MOTION_MODEL_CTRV};
std::uint8_t large_vehicle_model{carma_cooperative_perception_interfaces::msg::Detection::MOTION_MODEL_CTRV};
std::uint8_t motorcycle_model{carma_cooperative_perception_interfaces::msg::Detection::MOTION_MODEL_CTRA};
std::uint8_t pedestrian_model{carma_cooperative_perception_interfaces::msg::Detection::MOTION_MODEL_CV};
std::uint8_t unknown_model{carma_cooperative_perception_interfaces::msg::Detection::MOTION_MODEL_CV};
};

auto to_detection_msg(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,11 @@ auto ExternalObjectListToDetectionListNode::handle_on_configure(
}
});

declare_parameter(
"small_vehicle_motion_model",
carma_cooperative_perception_interfaces::msg::Detection::MOTION_MODEL_CTRV);

declare_parameter(
"large_vehicle_motion_model",
carma_cooperative_perception_interfaces::msg::Detection::MOTION_MODEL_CTRV);

declare_parameter(
"motorcycle_motion_model",
carma_cooperative_perception_interfaces::msg::Detection::MOTION_MODEL_CTRA);

declare_parameter(
"pedestrian_motion_model",
carma_cooperative_perception_interfaces::msg::Detection::MOTION_MODEL_CV);

declare_parameter(
"unknown_motion_model",
carma_cooperative_perception_interfaces::msg::Detection::MOTION_MODEL_CV);
declare_parameter("small_vehicle_motion_model", motion_model_mapping_.small_vehicle_model);
declare_parameter("large_vehicle_motion_model", motion_model_mapping_.large_vehicle_model);
declare_parameter("motorcycle_motion_model", motion_model_mapping_.motorcycle_model);
declare_parameter("pedestrian_motion_model", motion_model_mapping_.pedestrian_model);
declare_parameter("unknown_motion_model", motion_model_mapping_.unknown_model);

on_set_parameters_callback_ =
add_on_set_parameters_callback([this](const std::vector<rclcpp::Parameter> & parameters) {
Expand Down

0 comments on commit 8077443

Please sign in to comment.