Skip to content

Commit

Permalink
Place descriptor ros node works
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldenZephyr committed Jan 17, 2025
1 parent cb59b61 commit d877e6b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
5 changes: 5 additions & 0 deletions extra/ouroboros_ros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ project(ouroboros_ros)

find_package(catkin REQUIRED COMPONENTS
rospy
dynamic_reconfigure
)

generate_dynamic_reconfigure_options(
cfg/PlaceDescriptorDebugging.cfg
)

catkin_package(
Expand Down
15 changes: 9 additions & 6 deletions extra/ouroboros_ros/nodes/place_matching_example.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
import rospy

from dynamic_reconfigure.server import Server
Expand All @@ -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


Expand Down Expand Up @@ -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__":
Expand Down

0 comments on commit d877e6b

Please sign in to comment.