Skip to content

Commit

Permalink
Add weights as param
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafakurban committed Jan 30, 2024
1 parent d84a347 commit 6c48787
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions aruco_opencv/src/aruco_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class ArucoTracker : public rclcpp_lifecycle::LifecycleNode
std::string image_transport_;
std::string board_descriptions_path_;
int min_board_id_for_mapping;
double translation_weight_;
double rotation_weight_;

// ROS
OnSetParametersCallbackHandle::SharedPtr on_set_parameter_callback_handle_;
Expand Down Expand Up @@ -254,6 +256,8 @@ class ArucoTracker : public rclcpp_lifecycle::LifecycleNode
declare_param(*this, "marker_size", 0.15, true);
declare_param(*this, "board_descriptions_path", "");
declare_param(*this, "min_board_id_for_mapping", 40);
declare_param(*this, "translation_weight", 1.0);
declare_param(*this, "rotation_weight", 1.0);

declare_aruco_parameters(*this);
}
Expand Down Expand Up @@ -290,6 +294,8 @@ class ArucoTracker : public rclcpp_lifecycle::LifecycleNode

get_parameter("board_descriptions_path", board_descriptions_path_);
get_parameter("min_board_id_for_mapping", min_board_id_for_mapping);
get_parameter("translation_weight", translation_weight_);
get_parameter("rotation_weight", rotation_weight_);

RCLCPP_INFO(get_logger(), "Aruco Parameters:");
retrieve_aruco_parameters(*this, detector_parameters_, true);
Expand Down Expand Up @@ -554,9 +560,9 @@ class ArucoTracker : public rclcpp_lifecycle::LifecycleNode
continue;
}
landmark.tracking_from_landmark_transform = marker_pose.pose;
landmark.translation_weight = 1.0;
landmark.rotation_weight = 1.0;
landmark_list.landmarks.push_back(landmark);
landmark.translation_weight = translation_weight_;
landmark.rotation_weight = rotation_weight_;
landmark_list.landmarks.push_back(landmark);
}


Expand Down

0 comments on commit 6c48787

Please sign in to comment.