Skip to content

Commit f21bed8

Browse files
put back adding of weights and poses for particles
was incorrectly deleted in 0ca93b5
1 parent 885a0c5 commit f21bed8

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

nav2_amcl/src/amcl_node.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,14 @@ AmclNode::publishParticleCloud(const pf_sample_set_t * set)
865865
cloud_with_weights_msg->header.frame_id = global_frame_id_;
866866
cloud_with_weights_msg->particles.resize(set->sample_count);
867867

868+
for (int i = 0; i < set->sample_count; i++) {
869+
cloud_with_weights_msg->particles[i].pose.position.x = set->samples[i].pose.v[0];
870+
cloud_with_weights_msg->particles[i].pose.position.y = set->samples[i].pose.v[1];
871+
cloud_with_weights_msg->particles[i].pose.position.z = 0;
872+
cloud_with_weights_msg->particles[i].pose.orientation = orientationAroundZAxis(set->samples[i].pose.v[2]);
873+
cloud_with_weights_msg->particles[i].weight = set->samples[i].weight;
874+
}
875+
868876
particle_cloud_pub_->publish(std::move(cloud_with_weights_msg));
869877
}
870878

0 commit comments

Comments
 (0)