test(localization): replay contact regressions and validate arena navigation

This commit is contained in:
mzx committed 2026-11-22 12:02:14 +08:00
1 parent 28ac7c488e
commit 0602144ac5
29 files changed
+762 -22

No files matched your search

+13
View File
@@ -115,3 +115,16 @@ Python 入口可用 `tools/verify_lio_stack.py --launcher python` 做同样的
导航时,车端转发节点仅接收碰撞监控器的最终 `/cmd_vel`。LIO 心跳失效或超时触发零速度与目标取消。速度命令自身超时也触发零速度,恢复行为中的正常等待可以继续。解除定位失效后需要重新发送已取消的目标。Shell 的 `NAV2=0` 和 Python 的 `nav2:=false` 都可通过 `MANUAL_CMD_VEL_TOPIC` 设置手动输入。
两个仿真入口启用点云可靠传输。独立运行定位节点时可用 `reliable_clouds` 匹配发布者。指定 `LIO_TRACE_PATH` 可记录每帧的预测、候选和最终状态、协方差、信息矩阵及拒绝原因,这会增加磁盘 I/O。已知初始位姿仍是连续跟踪的前提。动态障碍遮挡全部可用结构、场地退化或传感器断流时,导航将停止。
### 复现导航验收
两个入口都可运行相同的隔离验收。域编号可用 `--domain` 显式保留给并行测试;如域已有导航或定位节点,启动器会拒绝启动。
```bash
python3 tools/run_lio_matrix.py --launcher shell --map generated/field.flmap --output generated/lio_matrix_shell
python3 tools/run_lio_matrix.py --launcher python --map generated/field.flmap --output generated/lio_matrix_python
python3 tools/validate_lio_navigation.py --launcher shell --scenario lidar_loss --goal 0 0 \
--map generated/field.flmap --output generated/lio_lidar_loss
```
默认矩阵各跑三次空场和三次圆柱绕行,再跑一次堵塞。默认圆柱在 `(-4, -1.5)`,半径 0.22 m、高 0.8 m。每次保留启动与目标日志、录制数据、TF 发布者数、最小圆柱净距及无需轨迹对齐的 3D ATE 和 1 秒 RPE。堵塞场景要求 Nav2 返回明确中止。断流场景只停止试验自己创建的自滤节点,并用执行器收到的零速度测量停车延迟。实测位姿来自 Gazebo PosePublisher,只参与评估。
@@ -13,7 +13,7 @@ struct NoiseOptions {
double accel_bias_walk{1e-4};
double gravity_walk{0.0};
// Quadrature/model error for unresolved between-sample dynamics, separate from sensor noise.
double integration_error_scale{0.5};
double integration_error_scale{2.0};
double maximum_imu_gap{0.05};
};
struct FilterSnapshot {
@@ -21,6 +21,8 @@ struct FilterSnapshot {
// Error order: position, velocity, right attitude error, gyro bias, accel bias, gravity.
Matrix18 covariance{Matrix18::Identity()};
};
enum class InnovationCheck { FINAL, TRIAL };
class ErrorStateFilter {
public:
explicit ErrorStateFilter(const NoiseOptions &noise = {});
@@ -31,7 +33,8 @@ public:
// Fixed-prior iterated update. Hessian/gradient are from current point-plane residuals.
bool correct_information(const FilterSnapshot &prior, const MotionState &linearization,
const Matrix6 &information, const Vector6 &gradient,
const Matrix6 &projector, const Matrix6 &model_covariance = Matrix6::Zero());
const Matrix6 &projector, const Matrix6 &model_covariance = Matrix6::Zero(),
InnovationCheck check = InnovationCheck::FINAL);
double last_nis() const { return last_nis_; }
int measurement_rank() const { return measurement_rank_; }
const FilterSnapshot &snapshot() const { return estimate_; }
@@ -40,7 +43,8 @@ public:
static Vector18 difference(const MotionState &reference, const MotionState &state);
private:
bool update(const FilterSnapshot &prior, const Eigen::Matrix<double,6,18> &h,
const Vector6 &innovation, const Matrix6 &noise, const Matrix6 &projector);
const Vector6 &innovation, const Matrix6 &noise, const Matrix6 &projector,
InnovationCheck check = InnovationCheck::FINAL);
double last_nis_{0};
int measurement_rank_{0};
NoiseOptions noise_;
@@ -39,8 +39,8 @@ struct RegistrationOptions {
// Shared map/association uncertainty does not shrink with the number of scan points.
double map_translation_sigma{0.02};
double map_rotation_sigma{0.002};
double huber_threshold{0.05};
double max_plane_distance{0.2};
double huber_threshold{0.025};
double max_plane_distance{0.12};
double max_rmse{0.1};
double minimum_inlier_ratio{0.2};
std::size_t minimum_inliers{50};
@@ -12,7 +12,7 @@ inline Matrix6 base_pose_covariance(const LocalizationSnapshot &s,const Pose3D &
return j*s.filter.covariance*j.transpose();
}
struct HealthOptions {
double correction_timeout{0.3},imu_timeout{0.1},clock_tolerance{0.02};
double correction_timeout{0.3},imu_timeout{0.1},clock_tolerance{0.05};
double position_three_sigma{0.5},yaw_three_sigma{15*std::numbers::pi/180};
std::size_t recovery_scans{5};
};
+4 -4
View File
@@ -84,7 +84,7 @@ Vector18 ErrorStateFilter::difference(const MotionState &a,const MotionState &b)
return d;
}
bool ErrorStateFilter::update(const FilterSnapshot &prior,const Eigen::Matrix<double,6,18> &h,
const Vector6 &innovation,const Matrix6 &noise,const Matrix6 &projector) {
const Vector6 &innovation,const Matrix6 &noise,const Matrix6 &projector,InnovationCheck gate) {
if(!h.allFinite() || !innovation.allFinite() || !noise.allFinite() || !projector.allFinite()) return false;
const Eigen::SelfAdjointEigenSolver<Matrix6> spectrum(h*h.transpose());
if(spectrum.info()!=Eigen::Success) return false;
@@ -97,7 +97,7 @@ bool ErrorStateFilter::update(const FilterSnapshot &prior,const Eigen::Matrix<do
last_nis_=innovation.dot(solver.solve(innovation));
// Chi-square 99.9% bounds for the retained measurement rank, not always six DOF.
constexpr double gates[]{0,10.827566,13.815511,16.266236,18.466827,20.515006,22.457744};
if(!std::isfinite(last_nis_) || last_nis_>gates[measurement_rank_]) return false;
if(!std::isfinite(last_nis_) || (gate==InnovationCheck::FINAL && last_nis_>gates[measurement_rank_])) return false;
Eigen::Matrix<double,18,6> k=prior.covariance*h.transpose()*solver.solve(Matrix6::Identity());
const auto selector=pose_selector();
const Eigen::Matrix<double,6,6> pose_k=projector*(selector*k);
@@ -128,7 +128,7 @@ bool ErrorStateFilter::correct_pose(const Pose3D &measurement,const Matrix6 &noi
return update(estimate_,projector*pose_selector(),projector*innovation,r,projector);
}
bool ErrorStateFilter::correct_information(const FilterSnapshot &prior,const MotionState &linearization,
const Matrix6 &information,const Vector6 &gradient,const Matrix6 &projector,const Matrix6 &model_covariance) {
const Matrix6 &information,const Vector6 &gradient,const Matrix6 &projector,const Matrix6 &model_covariance,InnovationCheck gate) {
const Matrix6 retained_information=projector*information*projector.transpose();
const Vector6 retained_gradient=projector*gradient;
const Eigen::SelfAdjointEigenSolver<Matrix6> eig(retained_information);
@@ -151,6 +151,6 @@ bool ErrorStateFilter::correct_information(const FilterSnapshot &prior,const Mot
Matrix6 prior_projector=Matrix6::Zero();
for(int i=0;i<6;++i) if(observable.eigenvalues()[i]>1e-10*std::max(1.0,observable.eigenvalues().maxCoeff()))
prior_projector.noalias()+=observable.eigenvectors().col(i)*observable.eigenvectors().col(i).transpose();
return update(prior,h,innovation,Matrix6::Identity()+whitening*model_covariance*whitening.transpose(),prior_projector);
return update(prior,h,innovation,Matrix6::Identity()+whitening*model_covariance*whitening.transpose(),prior_projector,gate);
}
} // namespace field_localization::core
@@ -147,6 +147,9 @@ RegistrationResult scan_to_map(const PointCloud &cloud,const Pose3D &extrinsic,c
result.degeneracy=detect_degeneracy(l.h/std::max(1.0,static_cast<double>(l.inliers)),o);
result.estimate=filter.snapshot();
};
Matrix6 model_covariance=Matrix6::Zero();
model_covariance.topLeftCorner<3,3>().diagonal().setConstant(o.map_translation_sigma*o.map_translation_sigma);
model_covariance.bottomRightCorner<3,3>().diagonal().setConstant(o.map_rotation_sigma*o.map_rotation_sigma);
for (int iteration=0;iteration<o.maximum_iterations;++iteration) {
const auto before=filter.snapshot().state;
const auto l=linearize(scan,extrinsic,map,before,o);
@@ -154,21 +157,31 @@ RegistrationResult scan_to_map(const PointCloud &cloud,const Pose3D &extrinsic,c
if (l.inliers<o.minimum_inliers) return result;
const auto deg=detect_degeneracy(l.h/static_cast<double>(l.inliers),o);
if (deg.dimensions==6) { result.failure=RegistrationFailure::DEGENERATE; return result; }
const Matrix6 h=deg.projector*l.h*deg.projector;
const Vector6 gradient=deg.projector*l.gradient;
Matrix6 model_covariance=Matrix6::Zero();
model_covariance.topLeftCorner<3,3>().diagonal().setConstant(o.map_translation_sigma*o.map_translation_sigma);
model_covariance.bottomRightCorner<3,3>().diagonal().setConstant(o.map_rotation_sigma*o.map_rotation_sigma);
const bool updated=filter.correct_information(prediction,before,h,gradient,deg.projector,model_covariance);
// Trial iterates update correspondence geometry in this private filter.
// The innovation gate is evaluated against the original prior once those
// correspondences have settled, before the result can reach LocalizationCore.
const bool updated=filter.correct_information(prediction,before,l.h,l.gradient,
deg.projector,model_covariance,InnovationCheck::TRIAL);
result.nis=filter.last_nis(); result.measurement_rank=filter.measurement_rank();
if (!updated) { result.failure=RegistrationFailure::INNOVATION; return result; }
const auto trial=ErrorStateFilter::difference(prediction.state,filter.snapshot().state);
if (trial.head<3>().norm()>=0.5 || trial.segment<3>(6).norm()>=0.35) {
result.failure=RegistrationFailure::QUALITY; return result;
}
const auto step=ErrorStateFilter::difference(before,filter.snapshot().state);
if (step.segment<3>(0).norm()<1e-4 && step.segment<3>(6).norm()<1e-4) break;
}
const auto final=linearize(scan,extrinsic,map,filter.snapshot().state,o);
record(final);
if (result.inliers<o.minimum_inliers) return result;
if (result.degeneracy.dimensions==6) { result.failure=RegistrationFailure::DEGENERATE; return result; }
const bool fused=filter.correct_information(prediction,filter.snapshot().state,
final.h,final.gradient,result.degeneracy.projector,model_covariance);
result.nis=filter.last_nis(); result.measurement_rank=filter.measurement_rank();
if (!fused) { result.failure=RegistrationFailure::INNOVATION; return result; }
record(linearize(scan,extrinsic,map,filter.snapshot().state,o));
const auto change=ErrorStateFilter::difference(prediction.state,filter.snapshot().state);
result.success=final.inliers>=o.minimum_inliers && result.inlier_ratio>=o.minimum_inlier_ratio &&
result.success=result.inliers>=o.minimum_inliers && result.inlier_ratio>=o.minimum_inlier_ratio &&
result.rmse<=o.max_rmse && result.degeneracy.dimensions<6 &&
change.segment<3>(0).norm()<0.5 && change.segment<3>(6).norm()<0.35;
result.failure=result.success ? RegistrationFailure::NONE : RegistrationFailure::QUALITY;
@@ -26,7 +26,7 @@ LocalizationNode::LocalizationNode(const rclcpp::NodeOptions &options):Node("fie
core_options_.noise.gyro=declare_parameter<double>("gyro_noise_density",0.003);
core_options_.noise.accel=declare_parameter<double>("accel_noise_density",0.03);
core_options_.noise.gyro_bias_walk=declare_parameter<double>("gyro_bias_walk",1e-5);
core_options_.noise.integration_error_scale=declare_parameter<double>("integration_error_scale",0.5);
core_options_.noise.integration_error_scale=declare_parameter<double>("integration_error_scale",core_options_.noise.integration_error_scale);
core_options_.noise.accel_bias_walk=declare_parameter<double>("accel_bias_walk",1e-4);
core_options_.map_resolution=declare_parameter<double>("map_voxel_size",0.1);
core_options_.registration.map_translation_sigma=declare_parameter<double>("map_translation_sigma",0.02);
@@ -0,0 +1 @@
21.5 -4.9584264520627084 2.8312555285145069 0.066642701693339218 0.28925532856581104 -0.18381915008460603 -0.088000693255994411 -0.00067113795667528883 0.0020454012507826885 -0.59983425677615865 0.8001213847319415 0.00013545462743937917 -0.00011407959527293953 7.7473698313815906e-05 0.094527591711915243 -0.018654076254896023 0.0059506817166394832 0.09629720315366537 -0.0095379732857951496 -9.8076595698943176 5.4211970910770516e-05 -1.6913810010464369e-06 7.7093436287022919e-08 0.00019387688324965145 -3.9371910845080579e-05 -3.076733516773156e-09 -6.5879156639180102e-08 3.3594270298662e-08 -6.9256690960194507e-08 2.7813913824052845e-09 -3.9388948155551208e-09 2.7030692132274592e-09 6.7300085074034144e-05 -0.00014701238697221737 -3.6740275206857811e-07 6.7649803199897789e-05 -0.00014627685630574802 -4.5186245904610204e-07 -1.6913810010464369e-06 5.72793708146413e-05 2.8440372274030672e-07 -3.2377452257135454e-05 0.00025496896000278674 7.2995229948893227e-07 5.0336174808415647e-08 8.6199059252662469e-08 -5.8734582018920561e-09 -3.5968463297817861e-09 -4.8402498733582902e-09 1.616767127151391e-10 0.00012940623942249684 7.7784760250283177e-05 -6.2149350554646791e-08 0.00012864861059710134 7.8059097522582328e-05 6.5809483616306078e-08 7.7093436287022919e-08 2.8440372274030672e-07 4.4887792501138219e-05 1.6481005494312824e-07 3.3036051466097291e-07 9.4396205964828535e-05 1.0746546275263083e-07 7.1978980696136641e-08 -4.56926219074464e-09 -9.2063759574381534e-09 -2.9925456873137583e-09 1.0356849209793115e-10 4.1101855612585824e-08 8.5015802052718161e-08 -5.6829671521961278e-06 4.3297632733567627e-08 8.3966956861444471e-08 2.2914719948329354e-07 0.00019387688324965145 -3.2377452257135454e-05 1.6481005494312824e-07 0.0014059864076449847 -0.00060156667631372442 -1.4477134773688117e-06 -2.1823656182909228e-06 5.9188720608873556e-07 -1.4649709427784945e-07 1.3273493659769134e-07 -6.9244332841764212e-08 6.2740980664033955e-09 0.00089514847072110935 -0.0013394792725598911 -8.5265579403348356e-06 0.00089525610558024722 -0.0013328928842766964 -9.1617952588180192e-06 -3.9371910845080579e-05 0.00025496896000278674 3.3036051466097291e-07 -0.00060156667631372442 0.002463472591958255 3.5836619389065894e-06 -4.4575707601887398e-07 -1.1768510327073258e-06 9.9552288663074785e-08 4.6256335948957022e-08 7.1161172428782834e-08 -4.2102789712100902e-09 0.0011477879323172333 0.00065501652442554468 -1.9605052538671123e-06 0.0011427053782942492 0.00065527039106214242 -1.0098242081899217e-06 -3.076733516773156e-09 7.2995229948893227e-07 9.4396205964828535e-05 -1.4477134773688117e-06 3.5836619389065894e-06 0.00043323801298578271 4.7889351727371411e-07 -3.7836925694658505e-08 -6.0909800875255969e-09 -7.3782931566863936e-09 2.1482886014884101e-08 -8.1860284535393516e-11 2.4471929872239124e-06 1.5975125965650238e-06 -2.6141701453767846e-05 2.5003766573461859e-06 1.5647774043328547e-06 1.0714728784118976e-06 -6.5879156639180102e-08 5.0336174808415647e-08 1.0746546275263083e-07 -2.1823656182909228e-06 -4.4575707601887398e-07 4.7889351727371411e-07 1.8634814206817319e-06 -6.5406181501742526e-08 -5.9879319969574165e-09 -1.1308758845294002e-07 3.2875194268899705e-08 3.6605395830826769e-10 9.5395073951606776e-07 -1.2086054116854707e-06 -1.7791229708523751e-08 9.5805103233717334e-07 -1.1994805300485477e-06 4.4726135709942555e-10 3.3594270298662e-08 8.6199059252662469e-08 7.1978980696136641e-08 5.9188720608873556e-07 -1.1768510327073258e-06 -3.7836925694658505e-08 -6.5406181501742526e-08 1.6306204086006391e-06 -3.7659580115382053e-09 -1.9568111489965129e-08 -1.0266195435166226e-07 1.6962366071786955e-10 9.9466921733896439e-07 1.0447122421018458e-06 -3.3863971471289592e-09 9.8565734537631504e-07 1.0470045147292737e-06 1.4724984962219323e-09 -6.9256690960194507e-08 -5.8734582018920561e-09 -4.56926219074464e-09 -1.4649709427784945e-07 9.9552288663074785e-08 -6.0909800875255969e-09 -5.9879319969574165e-09 -3.7659580115382053e-09 1.738679824274879e-06 3.0547132036890773e-10 4.9222657173568789e-11 -7.974542467371376e-08 -9.6533208413801504e-08 1.1328959003903214e-07 3.6098490506195615e-10 -9.6748486948590507e-08 1.1239758479133494e-07 6.7324089562498283e-11 2.7813913824052845e-09 -3.5968463297817861e-09 -9.2063759574381534e-09 1.3273493659769134e-07 4.6256335948957022e-08 -7.3782931566863936e-09 -1.1308758845294002e-07 -1.9568111489965129e-08 3.0547132036890773e-10 6.0976535317072009e-07 -5.3356788860148487e-10 -1.3567694186530896e-10 -1.0852134915108957e-07 -8.0855594335962174e-08 -3.6660465634396378e-10 -1.0355841555197264e-07 -7.5482084479384465e-08 3.5358876726330169e-11 -3.9388948155551208e-09 -4.8402498733582902e-09 -2.9925456873137583e-09 -6.9244332841764212e-08 7.1161172428782834e-08 2.1482886014884101e-08 3.2875194268899705e-08 -1.0266195435166226e-07 4.9222657173568789e-11 -5.3356788860148487e-10 6.101867536363909e-07 3.7511965469393576e-11 7.998411272557813e-08 -1.39999752509837e-07 -1.7172385625784348e-09 7.6460470194792003e-08 -1.36667696931179Line truncated
@@ -0,0 +1,5 @@
FIELD_LIO_DATASET 1
initial_pose -5 3 0 0 0 0 1
base_from_imu 0 0 0.14999999999999999 0 0 0 1
imu_from_lidar -0.0935 -0.1512 0.25519999999999998 0 0 0 1
scan_timing 0 0.10000000000000001 -3.1415926535897931 1 1
@@ -0,0 +1,62 @@
timestamp,gx,gy,gz,ax,ay,az
21.5,0.027876815948866075,0.030751855940937323,-1.1842935700125712,-0.023111402382871217,-0.1395854844850429,9.8048196820867783
21.510000000000002,-0.017607971943273938,-0.019452753963797663,-1.0602135046058219,-1.8701885300232559,-4.8705061252712838,9.8492370134248119
21.52,-0.018846260953600025,-0.022937105492543533,-1.0885774106073516,1.7897503972716406,-0.52672997202580918,10.044685765383601
21.530000000000001,-0.016026186362089922,-0.020400366678482509,-1.0917241522243037,-0.62935551826196445,-0.1902268052569194,9.8327730329417005
21.539999999999999,-0.0039680052956488614,-0.0048802501128351631,-1.0654810805867481,-0.44032183352333709,-0.87969651611324595,9.7995619192456243
21.550000000000001,0.003925853378591285,0.0043237549583911806,-1.050994136270337,-0.44419549879966652,-0.97063770692490714,9.7865771166979361
21.559999999999999,0.015521072951268861,0.018556156846335888,-1.0353119198407827,-0.44966512255833768,-1.1168820870323035,9.7662886848858701
21.57,-0.010713980836765676,-0.013782805389494718,-0.94648142161182514,1.0499207329160547,-1.5307281829738353,9.8558645017074973
21.579999999999998,0.0031908795850543073,0.0035817993979718257,-0.92877659759056419,-0.4049306552659751,-1.4212029132690633,9.753489507374999
21.59,-0.021896214870731016,-0.027220937407084374,-1.046273171064463,-0.019080772620131286,-0.6706677557942925,9.8494812269271783
21.600000000000001,-0.0066984038660593166,-0.011113690260045382,-1.0149032364140909,-0.57963659076810203,-0.72547828545723159,9.7982242770199388
21.609999999999999,-0.039158333081591237,-0.052117197217750884,-0.89957843673794069,3.139885509588999,-1.5781583695599466,9.9983700160178195
21.620000000000001,-0.027351924574812329,-0.031862753564538271,-0.88420699018074034,0.69448039315213117,-1.6305374543474735,9.2340980561444557
21.629999999999999,-0.015742222043143166,-0.016493939663926746,-0.88981339413502702,0.13150673202177771,-1.1306170708571193,9.7647431139790921
21.640000000000001,-0.004022699885873662,-0.001259569669767647,-0.89551123337432403,0.13599635495643095,-1.1261639413381019,9.7647800516600576
21.649999999999999,0.0053353662239785616,0.010725575725301893,-0.90942875157974634,0.15789610004821517,-1.0530705154987865,9.7628617078795266
21.66,0.016491250498544736,0.024609379686451945,-0.91558626730855419,0.13365907581890527,-1.0429172980073094,9.7708766453126117
21.670000000000002,-0.021584399663932677,-0.024912300322534046,-0.76095815345993478,6.334705400986917,-1.9226497375982048,10.16362673678579
21.68,-0.024613197565842172,-0.028395976761316468,-0.72376627351450273,0.16010078508940159,-1.1232093770948182,9.7658992604965018
21.690000000000001,-0.01332931734631751,-0.01358980859023368,-0.72760711502275677,0.16465795448040937,-1.120516879442744,9.7659457879414191
21.699999999999999,-0.0019575192421991657,0.0011106136969861063,-0.73150418485493418,0.16801879382850354,-1.1169314917879238,9.7659654174605368
21.710000000000001,-0.044054573922724313,-0.053285716147205384,-0.61035702732550567,6.0602938776630646,-1.7233623359755605,10.128535591728884
21.719999999999999,-0.033182538192041783,-0.038747817964841308,-0.61310117399133168,0.18427679543960218,-1.1232537058471808,9.7662459312502019
21.73,0.0065937579963648487,0.01220371761027326,-0.61819333204270599,0.42320660850550007,-1.1077954778840988,9.7787270047329358
21.739999999999998,0.017743748619107744,0.026227702779281103,-0.62109178345466298,0.17964983435637935,-1.07910404731498,9.7687556248026848
21.75,0.032070966256201157,0.044123934778049302,-0.6215635501503658,0.84781519798736116,-1.1424853289040711,9.8052938196326451
21.760000000000002,0.04323159084711134,0.05774811074414956,-0.62595909325220001,0.17881946371284294,-1.0776411109044441,9.7676732379160764
21.77,0.014565654737886168,0.020141041915345721,-0.51962271077133859,3.5985100821990623,-1.301336010579152,9.9755222340616978
21.780000000000001,0.025801767523406849,0.034196267656947055,-0.52176828690226362,0.18271536293139218,-1.0746575281330528,9.768878610689395
21.789999999999999,0.037193714362879646,0.048275107001682457,-0.52410013243946096,0.1837758742603682,-1.0694389692875366,9.7691355126248602
21.800000000000001,0.01223316024587217,0.019170210150084323,-0.45087651659991557,-0.0016956389731149143,-0.025951705650085775,9.8096683309132633
21.809999999999999,-0.00014021699382744945,0.087350461521265688,-0.35560102149335326,-12.017207426083699,12.525109252441553,17.022397415679425
21.82,-0.00018166526363231261,-0.0010756693194457732,-0.22095831438709318,-6.0427967228584052,0.88698691055288525,8.3850437959484463
21.829999999999998,-0.00040895771439254658,-0.086090056130199294,-0.21465058401431397,-6.0590794225276614,0.020058605902515955,8.397829504956416
21.84,-0.00026355398198325039,9.7904213798260322e-05,-4.2769962500452402e-07,-9.8707398799650079,-1.5965914924433029,9.8098653716609068
21.850000000000001,-0.00025050049702286293,9.3204854111866273e-05,-1.4542927798134628e-08,-9.8061290208515803,0.2527329127215982,9.8097768235231264
21.859999999999999,-0.00023879590816752226,8.7332624985708365e-05,-1.1593175628075952e-08,-0.001764775913125201,0.00036811344182996567,9.8095835903475646
21.870000000000001,-0.00022709254981645351,8.3052230814051822e-05,-1.0502390166897367e-08,9.9535930503896199e-05,0.00026561050962938242,9.8096475330243074
21.879999999999999,-0.00021596264222375556,7.8981892437700638e-05,-9.4969272472534689e-09,9.4713541093136591e-05,0.00025242575083570602,9.8096648083568869
21.890000000000001,-0.00020537820496690276,7.5111043850616314e-05,-8.5876661972860452e-09,9.0127483839020159e-05,0.000239887096402082,9.8096812369447548
21.899999999999999,-0.00019531250426390155,7.1429908199846623e-05,-7.7654053039581541e-09,8.5766177110097508e-05,0.00022796288931141036,9.8096968602951602
21.91,-0.00018574011653788892,6.7929187801640416e-05,-7.0218228570528799e-09,8.1618606354085882e-05,0.00021662302360277895,9.8097117178802993
21.920000000000002,-0.00017663686420234747,6.4600040662224806e-05,-6.3493930202361042e-09,7.7674297127672986e-05,0.00020583886784211096,9.8097258472369333
21.93,-0.00016797975459500661,6.1434058138850052e-05,-5.7413096683436485e-09,7.3923288085381996e-05,0.00019558319324319956,9.8097392840616973
21.940000000000001,-0.00015974692190305937,5.8423243706815917e-05,-5.1914176625325811e-09,7.035610602655997e-05,0.00018583010503157816,9.8097520623012606
21.949999999999999,-0.00015191757193588139,5.5559992759625349e-05,-4.6941504767884928e-09,6.6963741937274546e-05,0.00017655497694641463,9.8097642142377186
21.960000000000001,-0.00014447192960282323,5.2837073402874852e-05,-4.244473988010895e-09,6.3737628363540714e-05,0.0001677343891905942,9.8097757705710382
21.969999999999999,-0.00013739118896762418,5.0247608185847667e-05,-3.8378355327169014e-09,6.0669617530851912e-05,0.00015934606945459698,9.8097867604958644
21.98,-0.00013065746574668732,4.7785056735067413e-05,-3.470117895178189e-09,5.775196114331094e-05,0.00015136883648773686,9.8097972117756687
21.989999999999998,-0.00012425375213870804,4.5443199230114358e-05,-3.1375976145222629e-09,5.4977290465550821e-05,0.00014378254678249264,9.8098071508129543
22,-0.00011816387386841682,4.3216120697468507e-05,-2.8369073533752963e-09,5.2338597750746862e-05,0.00013656804408554844,9.809816602716035
22.010000000000002,-0.0001123724493311345,4.1098196068081264e-05,-2.5650018791755717e-09,4.9829218857646998e-05,0.00012970711036944108,9.8098255913621486
22.02,-0.00010686485074289968,3.9084075973122962e-05,-2.3191271625440211e-09,4.7442816148963473e-05,0.00012318242028306969,9.8098341394582906
22.030000000000001,-0.00010162716719666886,3.7168673228841246e-05,-2.0967926695168354e-09,4.5173362454866423e-05,0.00011697749758873088,9.8098422685983877
22.039999999999999,-9.6646169523062264e-05,3.534714999127065e-05,-1.895746026129816e-09,4.3015126098136043e-05,0.00011107667321795587,9.8098499993176098
22.050000000000001,-9.1909276878162586e-05,3.3614905535276057e-05,-1.7139503102811479e-09,4.0962656144982116e-05,0.0001054650458994324,9.8098573511448244
22.059999999999999,-8.7404524966776096e-05,3.1967564634825251e-05,-1.5495634754864029e-09,3.9010768977033052e-05,0.00010012844451797148,9.8098643426515846
22.07,-8.3120535823239054e-05,3.040096651154403e-05,-1.4009196137885638e-09,3.715453465619199e-05,9.5053392424021405e-05,9.80987099149886
22.079999999999998,-7.90464890723387e-05,2.8911154327071686e-05,-1.2665122120811435e-09,3.538926515309853e-05,9.0227073343135129e-05,9.809877314482172
22.09,-7.5172094600004836e-05,2.7494365189110178e-05,-1.1449788632454963e-09,3.3710502056849816e-05,8.5637298907652895e-05,9.8098833275738873
22.100000000000001,-7.1487566562624332e-05,2.6147020645983372e-05,-1.0350874626715972e-09,3.211400534500572e-05,8.1272478241284333e-05,9.8098890459632262
1 timestamp gx gy gz ax ay az
2 21.5 0.027876815948866075 0.030751855940937323 -1.1842935700125712 -0.023111402382871217 -0.1395854844850429 9.8048196820867783
3 21.510000000000002 -0.017607971943273938 -0.019452753963797663 -1.0602135046058219 -1.8701885300232559 -4.8705061252712838 9.8492370134248119
4 21.52 -0.018846260953600025 -0.022937105492543533 -1.0885774106073516 1.7897503972716406 -0.52672997202580918 10.044685765383601
5 21.530000000000001 -0.016026186362089922 -0.020400366678482509 -1.0917241522243037 -0.62935551826196445 -0.1902268052569194 9.8327730329417005
6 21.539999999999999 -0.0039680052956488614 -0.0048802501128351631 -1.0654810805867481 -0.44032183352333709 -0.87969651611324595 9.7995619192456243
7 21.550000000000001 0.003925853378591285 0.0043237549583911806 -1.050994136270337 -0.44419549879966652 -0.97063770692490714 9.7865771166979361
8 21.559999999999999 0.015521072951268861 0.018556156846335888 -1.0353119198407827 -0.44966512255833768 -1.1168820870323035 9.7662886848858701
9 21.57 -0.010713980836765676 -0.013782805389494718 -0.94648142161182514 1.0499207329160547 -1.5307281829738353 9.8558645017074973
10 21.579999999999998 0.0031908795850543073 0.0035817993979718257 -0.92877659759056419 -0.4049306552659751 -1.4212029132690633 9.753489507374999
11 21.59 -0.021896214870731016 -0.027220937407084374 -1.046273171064463 -0.019080772620131286 -0.6706677557942925 9.8494812269271783
12 21.600000000000001 -0.0066984038660593166 -0.011113690260045382 -1.0149032364140909 -0.57963659076810203 -0.72547828545723159 9.7982242770199388
13 21.609999999999999 -0.039158333081591237 -0.052117197217750884 -0.89957843673794069 3.139885509588999 -1.5781583695599466 9.9983700160178195
14 21.620000000000001 -0.027351924574812329 -0.031862753564538271 -0.88420699018074034 0.69448039315213117 -1.6305374543474735 9.2340980561444557
15 21.629999999999999 -0.015742222043143166 -0.016493939663926746 -0.88981339413502702 0.13150673202177771 -1.1306170708571193 9.7647431139790921
16 21.640000000000001 -0.004022699885873662 -0.001259569669767647 -0.89551123337432403 0.13599635495643095 -1.1261639413381019 9.7647800516600576
17 21.649999999999999 0.0053353662239785616 0.010725575725301893 -0.90942875157974634 0.15789610004821517 -1.0530705154987865 9.7628617078795266
18 21.66 0.016491250498544736 0.024609379686451945 -0.91558626730855419 0.13365907581890527 -1.0429172980073094 9.7708766453126117
19 21.670000000000002 -0.021584399663932677 -0.024912300322534046 -0.76095815345993478 6.334705400986917 -1.9226497375982048 10.16362673678579
20 21.68 -0.024613197565842172 -0.028395976761316468 -0.72376627351450273 0.16010078508940159 -1.1232093770948182 9.7658992604965018
21 21.690000000000001 -0.01332931734631751 -0.01358980859023368 -0.72760711502275677 0.16465795448040937 -1.120516879442744 9.7659457879414191
22 21.699999999999999 -0.0019575192421991657 0.0011106136969861063 -0.73150418485493418 0.16801879382850354 -1.1169314917879238 9.7659654174605368
23 21.710000000000001 -0.044054573922724313 -0.053285716147205384 -0.61035702732550567 6.0602938776630646 -1.7233623359755605 10.128535591728884
24 21.719999999999999 -0.033182538192041783 -0.038747817964841308 -0.61310117399133168 0.18427679543960218 -1.1232537058471808 9.7662459312502019
25 21.73 0.0065937579963648487 0.01220371761027326 -0.61819333204270599 0.42320660850550007 -1.1077954778840988 9.7787270047329358
26 21.739999999999998 0.017743748619107744 0.026227702779281103 -0.62109178345466298 0.17964983435637935 -1.07910404731498 9.7687556248026848
27 21.75 0.032070966256201157 0.044123934778049302 -0.6215635501503658 0.84781519798736116 -1.1424853289040711 9.8052938196326451
28 21.760000000000002 0.04323159084711134 0.05774811074414956 -0.62595909325220001 0.17881946371284294 -1.0776411109044441 9.7676732379160764
29 21.77 0.014565654737886168 0.020141041915345721 -0.51962271077133859 3.5985100821990623 -1.301336010579152 9.9755222340616978
30 21.780000000000001 0.025801767523406849 0.034196267656947055 -0.52176828690226362 0.18271536293139218 -1.0746575281330528 9.768878610689395
31 21.789999999999999 0.037193714362879646 0.048275107001682457 -0.52410013243946096 0.1837758742603682 -1.0694389692875366 9.7691355126248602
32 21.800000000000001 0.01223316024587217 0.019170210150084323 -0.45087651659991557 -0.0016956389731149143 -0.025951705650085775 9.8096683309132633
33 21.809999999999999 -0.00014021699382744945 0.087350461521265688 -0.35560102149335326 -12.017207426083699 12.525109252441553 17.022397415679425
34 21.82 -0.00018166526363231261 -0.0010756693194457732 -0.22095831438709318 -6.0427967228584052 0.88698691055288525 8.3850437959484463
35 21.829999999999998 -0.00040895771439254658 -0.086090056130199294 -0.21465058401431397 -6.0590794225276614 0.020058605902515955 8.397829504956416
36 21.84 -0.00026355398198325039 9.7904213798260322e-05 -4.2769962500452402e-07 -9.8707398799650079 -1.5965914924433029 9.8098653716609068
37 21.850000000000001 -0.00025050049702286293 9.3204854111866273e-05 -1.4542927798134628e-08 -9.8061290208515803 0.2527329127215982 9.8097768235231264
38 21.859999999999999 -0.00023879590816752226 8.7332624985708365e-05 -1.1593175628075952e-08 -0.001764775913125201 0.00036811344182996567 9.8095835903475646
39 21.870000000000001 -0.00022709254981645351 8.3052230814051822e-05 -1.0502390166897367e-08 9.9535930503896199e-05 0.00026561050962938242 9.8096475330243074
40 21.879999999999999 -0.00021596264222375556 7.8981892437700638e-05 -9.4969272472534689e-09 9.4713541093136591e-05 0.00025242575083570602 9.8096648083568869
41 21.890000000000001 -0.00020537820496690276 7.5111043850616314e-05 -8.5876661972860452e-09 9.0127483839020159e-05 0.000239887096402082 9.8096812369447548
42 21.899999999999999 -0.00019531250426390155 7.1429908199846623e-05 -7.7654053039581541e-09 8.5766177110097508e-05 0.00022796288931141036 9.8096968602951602
43 21.91 -0.00018574011653788892 6.7929187801640416e-05 -7.0218228570528799e-09 8.1618606354085882e-05 0.00021662302360277895 9.8097117178802993
44 21.920000000000002 -0.00017663686420234747 6.4600040662224806e-05 -6.3493930202361042e-09 7.7674297127672986e-05 0.00020583886784211096 9.8097258472369333
45 21.93 -0.00016797975459500661 6.1434058138850052e-05 -5.7413096683436485e-09 7.3923288085381996e-05 0.00019558319324319956 9.8097392840616973
46 21.940000000000001 -0.00015974692190305937 5.8423243706815917e-05 -5.1914176625325811e-09 7.035610602655997e-05 0.00018583010503157816 9.8097520623012606
47 21.949999999999999 -0.00015191757193588139 5.5559992759625349e-05 -4.6941504767884928e-09 6.6963741937274546e-05 0.00017655497694641463 9.8097642142377186
48 21.960000000000001 -0.00014447192960282323 5.2837073402874852e-05 -4.244473988010895e-09 6.3737628363540714e-05 0.0001677343891905942 9.8097757705710382
49 21.969999999999999 -0.00013739118896762418 5.0247608185847667e-05 -3.8378355327169014e-09 6.0669617530851912e-05 0.00015934606945459698 9.8097867604958644
50 21.98 -0.00013065746574668732 4.7785056735067413e-05 -3.470117895178189e-09 5.775196114331094e-05 0.00015136883648773686 9.8097972117756687
51 21.989999999999998 -0.00012425375213870804 4.5443199230114358e-05 -3.1375976145222629e-09 5.4977290465550821e-05 0.00014378254678249264 9.8098071508129543
52 22 -0.00011816387386841682 4.3216120697468507e-05 -2.8369073533752963e-09 5.2338597750746862e-05 0.00013656804408554844 9.809816602716035
53 22.010000000000002 -0.0001123724493311345 4.1098196068081264e-05 -2.5650018791755717e-09 4.9829218857646998e-05 0.00012970711036944108 9.8098255913621486
54 22.02 -0.00010686485074289968 3.9084075973122962e-05 -2.3191271625440211e-09 4.7442816148963473e-05 0.00012318242028306969 9.8098341394582906
55 22.030000000000001 -0.00010162716719666886 3.7168673228841246e-05 -2.0967926695168354e-09 4.5173362454866423e-05 0.00011697749758873088 9.8098422685983877
56 22.039999999999999 -9.6646169523062264e-05 3.534714999127065e-05 -1.895746026129816e-09 4.3015126098136043e-05 0.00011107667321795587 9.8098499993176098
57 22.050000000000001 -9.1909276878162586e-05 3.3614905535276057e-05 -1.7139503102811479e-09 4.0962656144982116e-05 0.0001054650458994324 9.8098573511448244
58 22.059999999999999 -8.7404524966776096e-05 3.1967564634825251e-05 -1.5495634754864029e-09 3.9010768977033052e-05 0.00010012844451797148 9.8098643426515846
59 22.07 -8.3120535823239054e-05 3.040096651154403e-05 -1.4009196137885638e-09 3.715453465619199e-05 9.5053392424021405e-05 9.80987099149886
60 22.079999999999998 -7.90464890723387e-05 2.8911154327071686e-05 -1.2665122120811435e-09 3.538926515309853e-05 9.0227073343135129e-05 9.809877314482172
61 22.09 -7.5172094600004836e-05 2.7494365189110178e-05 -1.1449788632454963e-09 3.3710502056849816e-05 8.5637298907652895e-05 9.8098833275738873
62 22.100000000000001 -7.1487566562624332e-05 2.6147020645983372e-05 -1.0350874626715972e-09 3.211400534500572e-05 8.1272478241284333e-05 9.8098890459632262
@@ -0,0 +1,8 @@
Gazebo isolated Python launch, cylinder at (-4,-1.5), radius .22 m, height .8 m.
Input acceleration/gyro are sensor-noise-free; finite-rate dynamics are not zero.
Checkpoint is the prior accepted estimate at sim 21.5 s from the pre-final-model run.
Five real scans 21.6--22.0 s and corresponding IMU samples reproduce the innovation
rejection cascade (NIS 31.6 then 35.1...) with an overconfident map model.
This is a recorded regression for a discovered failure during repair, not a claim
that the user's unrecorded original divergence has been reproduced exactly.
Ground truth is evaluation-only and never supplied to the filter.
@@ -0,0 +1,6 @@
timestamp,file
21.600000000000001,152.flpc
21.699999999999999,153.flpc
21.800000000000001,154.flpc
21.899999999999999,155.flpc
22,156.flpc
1 timestamp file
2 21.600000000000001 152.flpc
3 21.699999999999999 153.flpc
4 21.800000000000001 154.flpc
5 21.899999999999999 155.flpc
6 22 156.flpc
@@ -0,0 +1,5 @@
21.6 -4.938314134624523 2.796687470553623 0.0030149441445529064 -0.0007754419507424783 -0.00012456097725818525 -0.6408927062560147 0.7676300686152059
21.7 -4.925609698330944 2.7637372767944877 0.0030671789615293672 -0.0015214828458520557 -0.000254778602981217 -0.6729537584402829 0.7396829450372034
21.8 -4.923934087982928 2.7224593206086922 0.002981906031251714 -0.000194014824747835 -7.274393365116528e-05 -0.6945213952429082 0.719472020732156
21.9 -4.923427531970908 2.7076583973333985 0.002987579905231361 9.171974543353667e-06 -1.9365968979289335e-05 -0.6979490977997831 0.7161473706027992
22.0 -4.923427531952121 2.7076583973504693 0.0029924332530261426 5.532422580515229e-06 -1.1786157218031994e-05 -0.6979490980902097 0.7161473705219769
@@ -0,0 +1,64 @@
#include "field_localization/core/tracking_health.hpp"
#include "test_util.hpp"
#include <limits>
#include <numbers>
#include <random>
#include <cstdio>
using namespace field_localization::core;
namespace {
Pose3D truth(double t) {
return {exp_so3({0,0,0.15*std::sin(0.3*t)}),{-2+0.3*std::sin(0.4*t),-1+0.2*std::sin(0.5*t),0}};
}
}
int main() {
std::vector<Eigen::Vector3d> map;
for(int x=-30;x<=30;++x) for(int y=-20;y<=20;++y) map.emplace_back(0.2*x,0.2*y,0);
for(int i=-60;i<=60;++i) for(int z=0;z<=4;++z) {
map.emplace_back(0.1*i,-4,0.1*z);map.emplace_back(0.1*i,4,0.1*z);
if(std::abs(i)<=40) { map.emplace_back(-6,0.1*i,0.1*z);map.emplace_back(6,0.1*i,0.1*z); }
}
for(int x=0;x<=10;++x) for(int y=-5;y<=5;++y) map.emplace_back(0.1*x,0.1*y,0.42);
for(bool noisy:{false,true}) {
CoreOptions options;options.initial_pose=truth(0);
options.deskew.imu_from_sensor.translation={-0.0935,-0.1512,0.2552};
LocalizationCore core(options);core.set_map_points(map);TrackingHealth health;
std::mt19937 random(42);std::normal_distribution<double> normal;
double maximum_error=0;int full=0;bool stopped=false,recovered=false;
for(int i=0;i<=2000;++i) {
const double t=0.01*i;const auto pose=truth(t);
ImuData imu;imu.timestamp_sec=t;imu.angular_velocity={0,0,0.045*std::cos(0.3*t)};
const Eigen::Vector3d acceleration{-0.048*std::sin(0.4*t),-0.05*std::sin(0.5*t),9.81};
imu.linear_acceleration=pose.rotation.conjugate()*acceleration;
if(noisy) for(int j=0;j<3;++j) { imu.angular_velocity[j]+=0.003*normal(random)+0.002;imu.linear_acceleration[j]+=0.03*normal(random)+0.02; }
CHECK(core.process_imu(imu));
if(i==0 || i%10) continue;
PointCloud scan;scan.timestamp_sec=t;
const auto lidar=compose(compose(pose,options.base_from_imu),options.deskew.imu_from_sensor);
auto add=[&](const Eigen::Vector3d &world) {
Eigen::Vector3d p=lidar.rotation.conjugate()*(world-lidar.translation);
const double range=p.norm(),elevation=std::atan2(p.z(),p.head<2>().norm());
if(range>12 || elevation < -7*std::numbers::pi/180 || elevation>52*std::numbers::pi/180) return;
if(noisy) for(int j=0;j<3;++j) p[j]+=0.005*normal(random);
PointXYZI point;point.timestamp_sec=t;point.position=p.cast<float>();scan.points.push_back(point);
};
for(const auto &p:map) add(p);
// Previously unmapped object, taller than the static 0.42 m field.
if(t>=4 && t<=14) for(int angle=0;angle<48;++angle) for(int z=1;z<=8;++z)
add({-1.3+0.22*std::cos(angle*2*std::numbers::pi/48),-1+0.22*std::sin(angle*2*std::numbers::pi/48),0.1*z});
if(t>=8 && t<8.8) scan.points.clear(); // complete observation failure
PointXYZI invalid;invalid.timestamp_sec=t;invalid.position.setConstant(std::numeric_limits<float>::infinity());
scan.points.push_back(invalid);
const bool accepted=core.process_point_cloud(scan);
CHECK(accepted==(t<8 || t>=8.8));
const auto snapshot=core.get_snapshot();const bool valid=health.update(snapshot,options.base_from_imu,t);
if(t>=8.4 && t<8.8) { CHECK(!valid);stopped=true; }
if(t>10 && valid) recovered=true;
if(snapshot.status.mode==TrackingMode::FULL) ++full;
maximum_error=std::max(maximum_error,(snapshot.pose.translation-pose.translation).norm());
CHECK(snapshot.pose.translation.allFinite());CHECK(snapshot.filter.covariance.allFinite());
}
std::printf("2.5D noisy=%d FULL=%d/200 maximum_position_error=%.9gm stopped=%d recovered=%d\n",noisy,full,maximum_error,stopped,recovered);
CHECK(full>=180);CHECK(maximum_error<0.15);CHECK(stopped);CHECK(recovered);
}
return sentry_nav_test::Summary("FieldTracking");
}
@@ -0,0 +1,50 @@
#include "field_localization/core/dataset.hpp"
#include "test_util.hpp"
#include <Eigen/Eigenvalues>
#include <fstream>
#include <sstream>
#include <cstdio>
using namespace field_localization::core;
int main(int argc,char **argv) {
CHECK(argc==2);if(argc!=2) return 1;
const std::filesystem::path directory=argv[1];
auto options=read_dataset_config(directory/"config.txt");
FilterSnapshot checkpoint;auto &s=checkpoint.state;std::ifstream input(directory/"checkpoint.txt");
input>>s.timestamp_sec;
for(auto *v:{&s.pose.translation,&s.velocity}) for(int i=0;i<3;++i) input>>(*v)[i];
for(int i=0;i<4;++i) input>>s.pose.rotation.coeffs()[i];
for(auto *v:{&s.gyro_bias,&s.accel_bias,&s.gravity}) for(int i=0;i<3;++i) input>>(*v)[i];
for(int i=0;i<18;++i) for(int j=0;j<18;++j) input>>checkpoint.covariance(i,j);
CHECK(static_cast<bool>(input));
std::string error;const auto map=read_map(directory/"map.flmap",error);CHECK(map.has_value());if(!map) return 1;
ErrorStateFilter filter;filter.restore(checkpoint);
std::vector<ImuData> samples;std::ifstream imu(directory/"imu.csv");std::string line;std::getline(imu,line);
while(std::getline(imu,line)) {
std::replace(line.begin(),line.end(),',',' ');std::istringstream row(line);ImuData value;
row>>value.timestamp_sec>>value.angular_velocity.x()>>value.angular_velocity.y()>>value.angular_velocity.z()
>>value.linear_acceleration.x()>>value.linear_acceleration.y()>>value.linear_acceleration.z();
CHECK(static_cast<bool>(row));samples.push_back(value);
}
const auto truth=read_trajectory(directory/"truth.tum");
std::ifstream scans(directory/"scans.csv");std::getline(scans,line);int full=0;double maximum=0;
while(std::getline(scans,line)) {
const auto cloud=read_cloud(directory/line.substr(line.find(',')+1));
auto a=interpolate_imu(samples,filter.snapshot().state.timestamp_sec);CHECK(a.has_value());if(!a) return 1;
for(const auto &b:samples) if(b.timestamp_sec>a->timestamp_sec && b.timestamp_sec<cloud.timestamp_sec) {
CHECK(filter.propagate(*a,b));a=b;
}
const auto finish=interpolate_imu(samples,cloud.timestamp_sec);CHECK(finish.has_value());if(!finish) return 1;
if(finish->timestamp_sec>a->timestamp_sec) CHECK(filter.propagate(*a,*finish));
const auto result=scan_to_map(cloud,options.deskew.imu_from_sensor,*map,filter.snapshot());
CHECK(result.success);if(result.success) {filter.restore(result.estimate);++full;}
const auto base=compose(filter.snapshot().state.pose,inverse(options.base_from_imu));
const auto gt=trajectory_pose(truth,cloud.timestamp_sec);CHECK(gt.has_value());if(!gt) return 1;
maximum=std::max(maximum,(base.translation-gt->translation).norm());
CHECK(log_so3(gt->rotation.conjugate()*base.rotation).norm()<0.02);
const Eigen::SelfAdjointEigenSolver<Matrix18> eigen(filter.snapshot().covariance);
CHECK(eigen.info()==Eigen::Success);CHECK(eigen.eigenvalues().minCoeff()>-1e-10);
}
std::printf("recorded transition: FULL=%d/5 maximum_position_error=%.9g m\n",full,maximum);
CHECK(full==5);CHECK(maximum<0.10);
return sentry_nav_test::Summary("RecordedUpdate");
}
@@ -40,6 +40,19 @@ int main() {
CHECK(plane.degeneracy.projector.col(1).norm()<1e-8);
CHECK(plane.degeneracy.projector.col(5).norm()<1e-8);
CHECK_NEAR(plane.estimate.covariance(0,0),filter.snapshot().covariance(0,0),1e-12);
// An offset plane yields plenty of inliers but disagrees with a confident
// prediction. Trial re-association still has to pass the final innovation gate.
PointCloud shifted=planar;
for (auto &point:shifted.points) point.position.z()+=0.09F;
FilterSnapshot confident;
confident.covariance=1e-6*Matrix18::Identity();
RegistrationOptions strict;
strict.map_translation_sigma=0.01;
const auto rejected=scan_to_map(shifted,{},floor,confident,{},strict);
CHECK(!rejected.success);
CHECK(rejected.failure==RegistrationFailure::INNOVATION);
CHECK(rejected.inliers>100);
CHECK(rejected.measurement_rank==3);
// Rotate the whole plane; verify its null space rather than an axis label.
Matrix6 transform=Matrix6::Identity();
const Eigen::Matrix3d rotation=exp_so3({0.4,-0.3,0.1}).toRotationMatrix();
@@ -13,7 +13,7 @@ int main() {
CHECK(health.update(s,{},0.1*i)==(i==5));
for(int j=0;j<20;++j) CHECK(health.update(s,{},0.1*i)==(i==5));
}
CHECK(health.update(s,{},s.status.state_timestamp-0.002)); // sensor callback can precede /clock by one tick
CHECK(health.update(s,{},s.status.state_timestamp-0.022)); // measured /clock delivery skew
s.status.mode=TrackingMode::IMU_ONLY;s.status.state_timestamp=0.7;
CHECK(health.update(s,{},0.7)); // bounded short IMU-only grace period
s.status.state_timestamp=0.81;CHECK(!health.update(s,{},0.81));
@@ -0,0 +1,27 @@
Arena validation, 2026-11-22
GCC 15.2 / C++23, xmake release, zero compiler warnings; 15/15 test suites.
Five-frame contact fixture: all scan corrections accepted; maximum 3D error
below 0.10 m. A separate shifted-plane case was rejected by the final NIS
gate despite plenty of inliers.
Isolated Shell and Python launchers used the same map, start (-5,3) and
goal (0,0). The added cylinder was centered at (-4,-1.5), radius 0.22 m
and height 0.8 m. Acceptance requires Nav2 success, truth goal error <=0.30 m,
3D ATE <0.10 m, maximum 3D position error <0.25 m, and nonnegative clearance.
The final parameter file has SHA-256
ba353622d65e94628689842cbc55052420e529d9cba46cb9aee5742b28a16e9d.
Cylinder acceptance: Shell 2/3; Python 0/3 (2/3 reached the goal).
The two passing runs had cylinder clearances 0.1441 and 0.1215 m and
maximum position errors 0.0855 and 0.0798 m. Other runs either exhausted
recovery near the cylinder or exceeded the 3D position error criterion.
The vertical error reached 0.652 m in a weakly observed direction in one
run. The horizontal/yaw interlock does not guarantee vertical accuracy.
Replay of the passing Shell cylinder: 369/369 corrections, 100% matched
truth samples; translation/rotation ATE 0.01992 m / 0.3233 degrees,
translation/rotation 1 s RPE 0.01746 m / 0.1919 degrees. No trajectory alignment.
Lidar loss in the final Python configuration: first measured zero output
310 ms after injection, active goal canceled. No competing AMCL or map-to-odom
publisher was present. The original user failure lacks a synchronized recording,
and full navigation acceptance remains open.
+19
View File
@@ -393,6 +393,14 @@ target("test_tracking_safety")
add_deps("field_localization_core")
add_tests("default", {group = "unit"})
target("test_field_tracking")
set_targetdir("$(builddir)/bin")
set_kind("binary")
set_languages("c++23")
add_files("tests/test_field_tracking.cpp")
add_deps("field_localization_core")
add_tests("default", {group = "unit"})
target("test_filter_consistency")
set_targetdir("$(builddir)/bin")
set_kind("binary")
@@ -400,3 +408,14 @@ target("test_filter_consistency")
add_files("tests/test_filter_consistency.cpp")
add_deps("field_localization_core")
add_tests("default", {group = "unit"})
target("test_recorded_update")
set_targetdir("$(builddir)/bin")
set_kind("binary")
set_languages("c++23")
add_files("tests/test_recorded_update.cpp")
add_deps("field_localization_core")
on_load(function(target)
target:set("runargs", {path.join(os.projectdir(), "src/field_localization/tests/data/turn_contact")})
end)
add_tests("default", {group = "unit"})
+4 -3
View File
@@ -278,7 +278,8 @@ local_costmap:
footprint: "[[0.325, 0.270], [0.325, -0.270], [-0.325, -0.270], [-0.325, 0.270]]"
# MID-360 的 3D 点云已接入(/scan/points,PointCloud2)
# MID-360 点云经 sentry_nav/self_filter 自滤(剔除车身包围盒内的点)后接入
plugins: ["voxel_layer", "inflation_layer"]
# Retain known thin/occluded geometry when the live cloud sparsely samples it.
plugins: ["static_layer", "voxel_layer", "inflation_layer"]
voxel_layer:
plugin: "nav2_costmap_2d::VoxelLayer"
enabled: True
@@ -310,7 +311,7 @@ local_costmap:
inflation_layer:
plugin: "nav2_costmap_2d::InflationLayer"
cost_scaling_factor: 2.0
inflation_radius: 0.45
inflation_radius: 0.60 # Give the rectangular base room to turn around dynamic obstacles.
static_layer:
plugin: "nav2_costmap_2d::StaticLayer"
map_subscribe_transient_local: true
@@ -361,7 +362,7 @@ global_costmap:
inflation_layer:
plugin: "nav2_costmap_2d::InflationLayer"
cost_scaling_factor: 2.0
inflation_radius: 0.45
inflation_radius: 0.60 # Give the rectangular base room to turn around dynamic obstacles.
always_send_full_costmap: true
introspection_mode: "disabled"