Skip to content

Commit ca7ec13

Browse files
committed
Detach IMU integration and LiDAR correction
2 parents d454939 + bf8c92c commit ca7ec13

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

include/Headers/Localizator.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Localizator {
2121

2222
public:
2323
Localizator();
24-
void localize(const Points&, double time);
24+
void correct(const Points&, double time);
2525
void calculate_H(const state_ikfom&, const Matches&, Eigen::MatrixXd& H, Eigen::VectorXd& h);
2626

2727
void propagate_to(double t);

src/Modules/Localizator.cpp

+13-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extern struct Params Config;
2020
}
2121

2222
// Given points, find new position
23-
void Localizator::localize(const Points& points, double time) {
23+
void Localizator::correct(const Points& points, double time) {
2424
if (not Mapper::getInstance().exists()) return;
2525
this->IKFoM_update(points);
2626
this->last_time_updated = time;
@@ -80,10 +80,19 @@ extern struct Params Config;
8080
}
8181

8282
State Localizator::latest_state() {
83-
// If no updates, return empty state
83+
// If no integrated, return empty state
84+
if (this->last_time_integrated < 0)
85+
return State (Accumulator::getInstance().initial_time);
86+
87+
// If no updates, return integrated state
8488
if (this->last_time_updated < 0)
85-
return State (this->last_time_integrated);
86-
89+
return State (
90+
this->get_x(),
91+
Accumulator::getInstance().get_next_imu(this->last_time_integrated),
92+
this->last_time_integrated
93+
);
94+
95+
// Otherwise, return corrected state
8796
return State(
8897
this->get_x(),
8998
Accumulator::getInstance().get_next_imu(this->last_time_updated),

src/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ int main(int argc, char** argv) {
8181
if (ds_compensated.size() < Config.MAX_POINTS2MATCH) break;
8282

8383
// Localize points in map
84-
loc.localize(ds_compensated, t2);
84+
loc.correct(ds_compensated, t2);
8585
State Xt2 = loc.latest_state();
8686
accum.add(Xt2, t2);
8787
publish.state(Xt2, false);

0 commit comments

Comments
 (0)