Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.
For a while now I have been trying to get the google cartographer 3D map with no ros/anything. I am using Unitree 3D lidar. At the moment the way I am getting my map is with this function:
std::vector<std::vector<float>> CartographerModule3D::paintMap() {
pthread_mutex_lock(&mutex);
std::vector<std::vector<float>> point_cloud;
auto submapList = map_builder->pose_graph()->GetAllSubmapData();
//std::cout << "submap count: " << submapList.size() << std::endl;
for (const auto &sub : map_builder->pose_graph()->GetAllSubmapData()) {
const auto &submap_proto = sub.data.submap->ToProto(true).submap_3d();
const auto &hybrid_grid = submap_proto.high_resolution_hybrid_grid();
//const auto vecPos = CreatePointPointCloudFromHybridGrid(hybrid_grid, 0.0);
double min_probability = 0;
double resolution = hybrid_grid.resolution();
std::cout << "resolution: " << resolution << std::endl;
for (int i = 0; i < hybrid_grid.x_indices_size(); i++) {
//int value = hybrid_grid.values(i);
int x, y, z;
x = hybrid_grid.x_indices(i);
y = hybrid_grid.y_indices(i);
z = hybrid_grid.z_indices(i);
// Transform the cell indices to an actual voxel center point
Eigen::Vector3f point = Eigen::Vector3f(x * resolution + resolution / 2,
y * resolution + resolution / 2,
z * resolution + resolution / 2);
int prob_int = hybrid_grid.values(i);
point_cloud.push_back({point.x(), point.y(), point.z(),
static_cast<float>(prob_int / 32767.0)});
/*if (value > 32767 * min_probability) {
}*/
}
}
pthread_mutex_unlock(&mutex);
return point_cloud;
};
Hi!
For a while now I have been trying to get the google cartographer 3D map with no ros/anything. I am using Unitree 3D lidar. At the moment the way I am getting my map is with this function:
This is the before cartographer pointcloud: https://streamable.com/l80io7
however the output is extremely weird since it just does not make sense at all: https://streamable.com/u5xm4n
My configurations are:
Not really sure what I am doing wrong. Help?