Skip to content

Commit 88de9ac

Browse files
committed
Separation works
1 parent d1919ed commit 88de9ac

File tree

4 files changed

+22
-192
lines changed

4 files changed

+22
-192
lines changed

include/Headers/Objects.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
extern struct Params Config;
2+
13
template <typename ContentType>
24
class Buffer {
35
public:
@@ -118,11 +120,9 @@ class State {
118120

119121
State();
120122
State(double time);
123+
State(const state_ikfom& s, const IMU& imu, double time);
121124
State(const state_ikfom& s, double time);
122125

123-
// Return a state with initial values (from the Accumulator)
124-
static State Initial();
125-
126126
RotTransl I_Rt_L() const;
127127
RotTransl inv() const;
128128

src/Objects/State.cpp

+18-19
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,37 @@
1313

1414
extern struct Params Config;
1515

16-
// class State {
16+
// class State
1717
// public:
18-
State::State() {
19-
// Read from YAML
18+
19+
State::State() : State::State (0.) {
20+
// Read YAML parameters
2021
this->g = Eigen::Map<Eigen::Vector3f>(Config.initial_gravity.data(), 3);
2122
this->tLI = Eigen::Map<Eigen::Vector3f>(Config.I_Translation_L.data(), 3);
2223
this->RLI = Eigen::Map<Eigen::Matrix3f>(Config.I_Rotation_L.data(), 3, 3).transpose();
2324

24-
// Assume object is static at the begging
25+
// State
26+
this->pos = Eigen::Vector3f::Zero();
27+
this->R = Eigen::Matrix3f::Identity();
2528
this->vel = Eigen::Vector3f::Zero();
2629

27-
// Assume biases and noises zero as a first estimation
30+
// Biases
2831
this->bw = Eigen::Vector3f::Zero();
2932
this->ba = Eigen::Vector3f::Zero();
3033

34+
// Noise
3135
this->nw = Eigen::Vector3f::Zero();
3236
this->na = Eigen::Vector3f::Zero();
3337
this->nbw = Eigen::Vector3f::Zero();
3438
this->nba = Eigen::Vector3f::Zero();
35-
36-
// Assume vehicle at origin
37-
this->pos = Eigen::Vector3f::Zero();
38-
this->R = Eigen::Matrix3f::Identity();
3939
}
4040

41-
State::State(double time) : State::State() {
42-
this->time = time;
41+
State::State(const state_ikfom& s, const IMU& imu, double time) : State::State(s, time) {
42+
this->a = imu.a;
43+
this->w = imu.w;
4344
}
4445

45-
State::State(const state_ikfom& s, double time) : State () {
46-
// Export state_ikfom parameters
46+
State::State(const state_ikfom& s, double time) : State::State (time) {
4747
this->R = s.rot.toRotationMatrix().cast<float>();
4848
this->pos = s.pos.cast<float>();
4949
this->vel = s.vel.cast<float>();
@@ -53,13 +53,12 @@ extern struct Params Config;
5353

5454
this->RLI = s.offset_R_L_I.toRotationMatrix().cast<float>();
5555
this->tLI = s.offset_T_L_I.cast<float>();
56-
57-
// Get closest IMU to time
58-
IMU imu = Accumulator::getInstance().get_next_imu(time);
59-
this->a = imu.a;
60-
this->w = imu.w;
56+
}
6157

58+
State::State(double time) {
6259
this->time = time;
60+
this->a = -this->g;
61+
this->w = Eigen::Vector3f::Zero();
6362
}
6463

6564
RotTransl State::I_Rt_L() const {
@@ -119,4 +118,4 @@ extern struct Params Config;
119118
this->time = imu.time;
120119
this->a = 0.5*this->a + 0.5*imu.a; // Exponential mean (noisy inputs)
121120
this->w = 0.5*this->w + 0.5*imu.w; // Exponential mean (noisy inputs)
122-
}
121+
}

src/Utils/Objects.cpp

-169
This file was deleted.

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.correct(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)