From d877e6b3f11c7556c67b2f209c8e3981d7c689fb Mon Sep 17 00:00:00 2001 From: Aaron Ray Date: Fri, 17 Jan 2025 20:22:09 +0000 Subject: [PATCH] Place descriptor ros node works --- extra/ouroboros_ros/CMakeLists.txt | 5 +++++ .../ouroboros_ros/nodes/place_matching_example.py | 15 +++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/extra/ouroboros_ros/CMakeLists.txt b/extra/ouroboros_ros/CMakeLists.txt index dfffafa..f436860 100644 --- a/extra/ouroboros_ros/CMakeLists.txt +++ b/extra/ouroboros_ros/CMakeLists.txt @@ -3,6 +3,11 @@ project(ouroboros_ros) find_package(catkin REQUIRED COMPONENTS rospy + dynamic_reconfigure +) + +generate_dynamic_reconfigure_options( + cfg/PlaceDescriptorDebugging.cfg ) catkin_package( diff --git a/extra/ouroboros_ros/nodes/place_matching_example.py b/extra/ouroboros_ros/nodes/place_matching_example.py index 2bade25..65321ea 100755 --- a/extra/ouroboros_ros/nodes/place_matching_example.py +++ b/extra/ouroboros_ros/nodes/place_matching_example.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import rospy from dynamic_reconfigure.server import Server @@ -7,7 +8,7 @@ import numpy as np from ouroboros import VlcDb, SparkImage -from ouroboros_salad import get_salad_model +from ouroboros_salad.salad_model import get_salad_model from ouroboros_ros.cfg import PlaceDescriptorDebuggingConfig @@ -62,17 +63,19 @@ def image_cb(self, msg): embedding = self.embedding_model(image) image_matches, similarities = self.vlc_db.query_embeddings_max_time( - embedding, 1, msg.header.stamp.to_nsec() - self.lc_lockout + embedding, 1, msg.header.stamp.to_nsec() - self.lc_lockout * 1e9 ) self.vlc_db.update_embedding(uid, embedding) - if similarities[0] < self.place_match_threshold: - image_match = None + if len(similarities) == 0 or similarities[0] < self.place_match_threshold: + right = None else: - image_match = image_matches[0] + right = image_matches[0].image.rgb - display_image_pair(current_image, image_match) + left = current_image.image.rgb + + display_image_pair(left, right) if __name__ == "__main__":