feat(localization): integrate LIO ROS TF, replay and validated AMCL replacement
GCC 15.2 C++23 clean rebuild: zero warnings. All 11 xmake test suites pass. Independent 120 s Gazebo replay: ATE 0.005279 m / 0.191335 deg; 1 s RPE 0.005358 m / 0.099086 deg. Both startup entry points validate Nav2 activation, no AMCL, and a single map-to-odom publisher.
This commit is contained in:
1 parent
55e9456e4a
commit
b833e6f658
30 files changed
+1314
-329
No files matched your search
@@ -0,0 +1,34 @@
|
||||
#include "field_localization/core/dataset.hpp"
|
||||
#include "test_util.hpp"
|
||||
#include <fstream>
|
||||
#include <limits>
|
||||
using namespace field_localization::core;
|
||||
int main() {
|
||||
const auto dir=std::filesystem::temp_directory_path()/"field_lio_dataset_tests";
|
||||
std::filesystem::create_directories(dir);
|
||||
PointCloud cloud; cloud.timestamp_sec=1;
|
||||
PointXYZI p; p.timestamp_sec=0.99; p.position={0.01F,-2,3}; p.intensity=4; cloud.points.push_back(p);
|
||||
p.position.x()=std::numeric_limits<float>::infinity(); cloud.points.push_back(p);
|
||||
write_cloud(cloud,dir/"scan.flpc"); const auto read=read_cloud(dir/"scan.flpc");
|
||||
CHECK(read.points.size()==2); CHECK_NEAR(read.timestamp_sec,1,1e-12);
|
||||
CHECK_NEAR(read.points[0].timestamp_sec,0.99,1e-12); CHECK(read.points[0].position==cloud.points[0].position);
|
||||
CHECK(!read.points[1].position.allFinite());
|
||||
CoreOptions options; options.initial_pose.translation={-5,3,0}; options.deskew.imu_from_sensor.translation={-0.0935,-0.1512,0.2552};
|
||||
write_dataset_config(options,dir/"config.txt"); const auto config=read_dataset_config(dir/"config.txt");
|
||||
CHECK(config.initial_pose.translation==options.initial_pose.translation);
|
||||
CHECK(config.deskew.imu_from_sensor.translation==options.deskew.imu_from_sensor.translation);
|
||||
std::vector<TrajectorySample> truth,estimate;
|
||||
for (int i=0;i<=200;++i) {
|
||||
const double t=0.01*i; Pose3D pose{exp_so3({0.01*t,-0.03*t,0.1*t}),Eigen::Vector3d{t,0.2*t,0.1*t*t}};
|
||||
truth.push_back({t,pose}); pose.translation.x()+=0.1; estimate.push_back({t,pose});
|
||||
}
|
||||
const auto metric=evaluate(estimate,truth);
|
||||
CHECK(metric.matched==estimate.size()); CHECK(metric.relative_pairs>0);
|
||||
CHECK_NEAR(metric.ate_translation,0.1,1e-12); CHECK_NEAR(metric.ate_rotation_rad,0,1e-12);
|
||||
CHECK(metric.rpe_translation<1e-12); CHECK(metric.rpe_rotation_rad<1e-12);
|
||||
const std::vector<TrajectorySample> sparse{{0,{}},{1,{}}}; CHECK(!trajectory_pose(sparse,0.5));
|
||||
{ std::ofstream out(dir/"broken"); out<<"FLPC0001"; }
|
||||
bool rejected=false; try { (void)read_cloud(dir/"broken"); } catch (const std::exception &) { rejected=true; }
|
||||
CHECK(rejected); std::filesystem::remove_all(dir);
|
||||
return sentry_nav_test::Summary("DatasetAndMetrics");
|
||||
}
|
||||
Reference in new issue
Block a user