Skip to content

Commit

Permalink
updated localization node
Browse files Browse the repository at this point in the history
  • Loading branch information
rsoussan committed Jul 22, 2024
1 parent 7e16023 commit c627c79
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ class Localizer {
bool ReadParams(config_reader::ConfigReader& config, bool fatal_failure = true);
bool Localize(cv_bridge::CvImageConstPtr image_ptr, ff_msgs::VisualLandmarks* vl,
Eigen::Matrix2Xd* image_keypoints = NULL);
const camera::CameraParameters& camera_params() const { return *cam_params_; }
private:
void AdjustThresholds();

sparse_mapping::SparseMap* map_;
std::shared_ptr camera::CameraParameters cam_params_;
std::shared_ptr<camera::CameraParameters> cam_params_;
// Success params for adjusting keypoint thresholds
std::deque<int> successes_;
ThresholdParams params_;
Expand Down
2 changes: 1 addition & 1 deletion localization/localization_node/src/localization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace localization_node {
Localizer::Localizer(sparse_mapping::SparseMap* map): map_(map) {}

bool Localizer::ReadParams(config_reader::ConfigReader& config, bool fatal_failure) {
cam_params_.reset(camera::CameraParameters(&config, "nav_cam"));
cam_params_ = std::make_shared<camera::CameraParameters>(&config, "nav_cam");
std::string prefix;
const auto detector_name = map_->GetDetectorName();
if (detector_name == "ORGBRISK") {
Expand Down
4 changes: 2 additions & 2 deletions localization/localization_node/src/localization_nodelet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ void LocalizationNodelet::Localize(void) {
Eigen::Vector2d undistorted, distorted;
undistorted[0] = vl.landmarks[i].u;
undistorted[1] = vl.landmarks[i].v;
(map_->GetCameraParameters()).Convert<camera::UNDISTORTED_C, camera::DISTORTED>(undistorted, &distorted);
(inst_->camera_params()).Convert<camera::UNDISTORTED_C, camera::DISTORTED>(undistorted, &distorted);
cv::circle(used_image->image, cv::Point(distorted[0], distorted[1]), 10, CV_RGB(255, 255, 255), 3, 8);
cv::circle(used_image->image, cv::Point(distorted[0], distorted[1]), 6, CV_RGB(0, 0, 0), 3, 8);
}
Expand All @@ -261,7 +261,7 @@ void LocalizationNodelet::Localize(void) {
Eigen::Vector2d undistorted, distorted;
undistorted[0] = image_keypoints.col(i)[0];
undistorted[1] = image_keypoints.col(i)[1];
(map_->GetCameraParameters()).Convert<camera::UNDISTORTED_C, camera::DISTORTED>(undistorted, &distorted);
(inst_->camera_params()).Convert<camera::UNDISTORTED_C, camera::DISTORTED>(undistorted, &distorted);
cv::circle(detected_image->image, cv::Point(distorted[0], distorted[1]), 10, CV_RGB(255, 255, 255), 3, 8);
cv::circle(detected_image->image, cv::Point(distorted[0], distorted[1]), 6, CV_RGB(0, 0, 0), 2, 8);
}
Expand Down

0 comments on commit c627c79

Please sign in to comment.