-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start integrating GNSS observation. Added a new CLI program mola-navs…
…tate-cli for testing state fusion
- Loading branch information
Showing
7 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* ------------------------------------------------------------------------- | ||
* A Modular Optimization framework for Localization and mApping (MOLA) | ||
* Copyright (C) 2018-2024 Jose Luis Blanco, University of Almeria | ||
* See LICENSE for license information. | ||
* ------------------------------------------------------------------------- */ | ||
|
||
#include <mola_navstate_fg/NavStateFG.h> | ||
#include <mrpt/core/exceptions.h> | ||
#include <mrpt/obs/CObservationGPS.h> | ||
#include <mrpt/obs/CObservationIMU.h> | ||
#include <mrpt/obs/CObservationRobotPose.h> | ||
#include <mrpt/obs/CRawlog.h> | ||
|
||
#include <iostream> | ||
|
||
namespace | ||
{ | ||
void run_navstate(const std::string& paramsFile, const std::string& rawlogFile) | ||
{ | ||
using mrpt::obs::CObservationGPS; | ||
using mrpt::obs::CObservationIMU; | ||
using mrpt::obs::CObservationRobotPose; | ||
|
||
mola::NavStateFG nav; | ||
|
||
std::cout << "Initalizing from: " << paramsFile << std::endl; | ||
|
||
const auto cfg = mrpt::containers::yaml::FromFile(paramsFile); | ||
nav.initialize(cfg); | ||
|
||
std::cout << "Reading dataset from: " << rawlogFile << std::endl; | ||
|
||
mrpt::obs::CRawlog dataset; | ||
dataset.loadFromRawLogFile(rawlogFile); | ||
|
||
const std::string frame_id = "map"; | ||
|
||
std::cout << "Read entries: " << dataset.size() << std::endl; | ||
|
||
for (size_t i = 0; i < dataset.size(); i++) | ||
{ | ||
const auto o = dataset.getAsObservation(i); | ||
if (!o) continue; | ||
|
||
if (auto oGPS = std::dynamic_pointer_cast<CObservationGPS>(o); oGPS) | ||
{ | ||
nav.fuse_gnss(*oGPS); | ||
} | ||
else if (auto oPose = | ||
std::dynamic_pointer_cast<CObservationRobotPose>(o); | ||
oPose) | ||
{ | ||
nav.fuse_pose(oPose->timestamp, oPose->pose, frame_id); | ||
} | ||
else if (auto oImu = std::dynamic_pointer_cast<CObservationIMU>(o); | ||
oImu) | ||
{ | ||
nav.fuse_imu(*oImu); | ||
} | ||
else | ||
{ | ||
std::cout << "[Warning] Ignoring observation #" << i << ": '" | ||
<< o->sensorLabel | ||
<< "' of type: " << o->GetRuntimeClass()->className | ||
<< "\n"; | ||
} | ||
|
||
} // for each entry | ||
} | ||
|
||
} // namespace | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
try | ||
{ | ||
if (argc != 3) | ||
{ | ||
std::cerr << "Usage: " << argv[0] << " params.yaml dataset.rawlog" | ||
<< std::endl; | ||
return 1; | ||
} | ||
|
||
run_navstate(argv[1], argv[2]); | ||
|
||
return 0; | ||
} | ||
catch (const std::exception& e) | ||
{ | ||
std::cerr << "Exception: " << e.what() << std::endl; | ||
return 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Config for NavStateFGParams | ||
sliding_window_length: 5.0 # [s] | ||
max_time_to_use_velocity_model: 2.0 # [s] | ||
time_between_frames_to_warning: 2.0 # [s] | ||
sigma_random_walk_acceleration_linear: 1.0 # [m/s²] | ||
sigma_random_walk_acceleration_angular: 1.0 # [rad/s²] | ||
sigma_integrator_position: 0.10 # [m] | ||
sigma_integrator_orientation: 0.10 # [rad] | ||
robust_param: 0 | ||
max_rmse: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters