Skip to content

Beluga ML localization demo#23

Open
Lobotuerk wants to merge 2 commits intomainfrom
lobotuerk/pre-ML-sensormodel
Open

Beluga ML localization demo#23
Lobotuerk wants to merge 2 commits intomainfrom
lobotuerk/pre-ML-sensormodel

Conversation

@Lobotuerk
Copy link
Member

DISCLAIMER: It does not localise, adds support for inference as a sensor model

@Lobotuerk Lobotuerk requested a review from hidmic January 9, 2026 20:52
Copy link
Collaborator

@hidmic hidmic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I take it's WIP.

@@ -0,0 +1,52 @@
frame_id: map
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lobotuerk can we bomb the atic? I don't think we'll need it.

@@ -0,0 +1,51 @@
#!/usr/bin/python3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lobotuerk I don't think we need this either.

RCLCPP_INFO(rclcpp::get_logger("DGENode"), "Loading dense grid from %s", dense_grid_path.c_str());
torch::jit::Module dense_grid_module = torch::jit::load(dense_grid_path);
bool found = false;
for (const auto& buffer : dense_grid_module.named_buffers()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lobotuerk should it assert there's only one buffer in the module?

Comment on lines +100 to +112
bool device_found = false;
for (const auto& param : image_encoder_.parameters()) {
device = param.device();
device_found = true;
break;
}
if (!device_found) {
for (const auto& buffer : image_encoder_.named_buffers()) {
device = buffer.value.device();
device_found = true;
break;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lobotuerk meta: this could be a separate utility, torch::Device infer_device(const torch::jit::Module&). I'm actually surprised it doesn't exist already.

Comment on lines +134 to +147
torch::Device device = torch::kCPU;
bool device_found = false;
for (const auto& param : image_encoder_.parameters()) {
device = param.device();
device_found = true;
break;
}
if (!device_found) {
for (const auto& buffer : image_encoder_.named_buffers()) {
device = buffer.value.device();
device_found = true;
break;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lobotuerk meta: why do this on every call and not just once on initialization?

void initialize_grid_parameters() {
X_size_ = dense_grid_tensor_.size(0);
Y_size_ = dense_grid_tensor_.size(1);
F_size_ = dense_grid_tensor_.size(2);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lobotuerk F_size? What does F stand for?


// Rotate the pose feature to match the orientation of the pose
// double theta = pose.so2().log();
// auto rotated_pose_feature = rotate_circular_feature(pose_embedding_tensor, theta);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lobotuerk should this be commented out?


{
feature_detections_sub_ =
std::make_unique<message_filters::Subscriber<FeatureDetections>>(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lobotuerk meta: you may as well drop the feature_detections naming and switch to image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants