Skip to content

Commit 1638564

Browse files
remove movable objects in LIO
1 parent d52277a commit 1638564

4 files changed

Lines changed: 65 additions & 5 deletions

File tree

‎apps/lidar_odometry_step_1/lidar_odometry_gui.cpp‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ bool step_1_done = false;
154154
bool step_2_done = false;
155155
bool step_3_done = false;
156156
bool calculations_failed = false;
157+
bool show_without_filtered_buckets = false;
157158

158159
int lastPar = 1;
159160

@@ -1754,7 +1755,7 @@ void progress_window()
17541755
ImGui::Checkbox("Show trajectory as axes", &show_trajectory_as_axes);
17551756
ImGui::Checkbox("Show prediction vectors", &show_prediction_vectors);
17561757
ImGui::Checkbox("Show intermediate trajectory prediction axes", &intermediate_trajectory_prediction_axes);
1757-
1758+
ImGui::Checkbox("Show without filtered buckets", &show_without_filtered_buckets);
17581759
// ImGui::Checkbox("Show covs indoor", &show_covs_indoor);
17591760
// ImGui::Checkbox("Show covs outdoor", &show_covs_outdoor);
17601761

@@ -2071,7 +2072,13 @@ void display()
20712072
{
20722073
glColor3f(1, 0, 0);
20732074
}
2074-
glVertex3f(b.second.mean.x(), b.second.mean.y(), b.second.mean.z());
2075+
if (!show_without_filtered_buckets){
2076+
glVertex3f(b.second.mean.x(), b.second.mean.y(), b.second.mean.z());
2077+
}else{
2078+
if (b.second.number_of_hits < 20){
2079+
glVertex3f(b.second.mean.x(), b.second.mean.y(), b.second.mean.z());
2080+
}
2081+
}
20752082
}
20762083
glEnd();
20772084
}
@@ -2091,7 +2098,14 @@ void display()
20912098
{
20922099
glColor3f(0, 0, 1);
20932100
}
2094-
glVertex3f(b.second.mean.x(), b.second.mean.y(), b.second.mean.z());
2101+
//glVertex3f(b.second.mean.x(), b.second.mean.y(), b.second.mean.z());
2102+
if (!show_without_filtered_buckets){
2103+
glVertex3f(b.second.mean.x(), b.second.mean.y(), b.second.mean.z());
2104+
}else{
2105+
if (b.second.number_of_hits < 20){
2106+
glVertex3f(b.second.mean.x(), b.second.mean.y(), b.second.mean.z());
2107+
}
2108+
}
20952109
}
20962110
glEnd();
20972111
}

‎apps/lidar_odometry_step_1/lidar_odometry_utils.cpp‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,46 @@ void update_rgd(
237237
if (lookup_count)
238238
++(*lookup_count);*/
239239
}
240+
241+
/////////
242+
//number_of_hits
243+
//Eigen::Vector3d direction = points_global[i].point - viewport;
244+
//direction.normalize();
245+
//double bucket_norm = b.norm();
246+
247+
Eigen::Vector3d direction = viewport - points_global[i].point;
248+
double distance = direction.norm();
249+
double b_norm = b.norm();
250+
int steps = static_cast<int>(std::ceil(distance / b_norm));
251+
252+
direction.normalize();
253+
254+
steps -= 5;
255+
256+
if (steps > 5)
257+
{
258+
for(int j = 2; j < steps; ++j){
259+
260+
Eigen::Vector3d b_front = points_global[i].point + direction * (b_norm * (j + 1));
261+
262+
auto index_of_bucket = get_rgd_index_3d(b_front, b);
263+
264+
auto bucket_it = buckets.find(index_of_bucket);
265+
266+
if (bucket_it != buckets.end()){
267+
auto& this_bucket = bucket_it->second;
268+
char noh = this_bucket.number_of_hits;
269+
270+
if(noh < 30){
271+
this_bucket.number_of_hits++;
272+
273+
//std::cout << "bucket: " << index_of_bucket << " number_of_hits: " << static_cast<int>(this_bucket.number_of_hits) << std::endl;
274+
}
275+
}
276+
}
277+
}
278+
279+
/////////
240280
}
241281
}
242282

‎apps/lidar_odometry_step_1/lidar_odometry_utils_optimizers.cpp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,7 @@ static void compute_hessian(
17161716

17171717
if (indoor_it != buckets_indoor.end())
17181718
{
1719-
if (indoor_it->second.number_of_points != -1)
1719+
if (indoor_it->second.number_of_points != -1 && indoor_it->second.number_of_hits < 20)
17201720
{
17211721
add_indoor_hessian_contribution(
17221722
indoor_it->second,
@@ -1756,7 +1756,7 @@ static void compute_hessian(
17561756

17571757
if (outdoor_it != buckets_outdoor.end())
17581758
{
1759-
if (outdoor_it->second.number_of_points != -1)
1759+
if (outdoor_it->second.number_of_points != -1 && outdoor_it->second.number_of_hits < 20)
17601760
{
17611761
add_outdoor_hessian_contribution(
17621762
outdoor_it->second,
@@ -3323,6 +3323,8 @@ void Consistency(std::vector<WorkerData>& worker_data, const LidarOdometryParams
33233323
if (intermediate_points_i.point.norm() < 1.0)
33243324
return;
33253325

3326+
3327+
33263328
Eigen::Vector3d point_global = trajectory[intermediate_points_i.index_pose] * intermediate_points_i.point;
33273329
auto index_of_bucket = get_rgd_index_3d(point_global, b);
33283330

‎core/include/Core/ndt.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ class NDT
4444
uint64_t number_of_points = 0;
4545
uint64_t index_begin = 0;
4646
uint64_t index_end = 0;
47+
48+
char number_of_hits = 0;
4749
};
4850

4951
struct BucketCoef
@@ -53,6 +55,8 @@ class NDT
5355
Eigen::Vector3d normal_vector = Eigen::Vector3d::Zero();
5456
std::vector<uint64_t> point_indexes;
5557
bool valid = false;
58+
59+
char number_of_hits = 0;
5660
};
5761

5862
struct Bucket2

0 commit comments

Comments
 (0)