对tools进行了整理,Xmake也改为相对路径,在线 LiDAR-IMU 定位器实现

This commit is contained in:
mzx committed 2026-11-23 14:32:42 +08:00
1 parent 0602144ac5
commit 4502296915
70 files changed
+2652 -1298

No files matched your search

+46 -16
View File
@@ -18,23 +18,23 @@ xmake test
## 建图、保存与只读定位
先显式建图,再启动只读地图定位:
当前 Gazebo 场地可直接用 `scripts/sentry_up.sh` 启动。两个入口默认只读加载 `src/sentry_sim/maps/field_full.flmap`。需要自建地图时可单独写入新路径:
```bash
LIO_MODE=mapping LIO_MAP="$PWD/generated/field.flmap" scripts/sentry_up.sh
LIO_MODE=mapping scripts/sentry_up.sh
# 在机器人处于已知初始位姿后开始移动;保存当前地图:
ros2 service call /field_localization/save_map std_srvs/srv/Trigger '{}'
# 停止上一套进程;正常退出也会执行最终地图导出。
LIO_MAP="$PWD/generated/field.flmap" scripts/sentry_up.sh
LIO_MAP="$PWD/generated/field_mapping.flmap" scripts/sentry_up.sh
```
Shell 默认 `LOCALIZATION=lio`、`LIO_MODE=localization`,缺失地图立即报错。可显式用 `LOCALIZATION=amcl` 选择旧方案;不自动回退。两个分支都保留 Nav2 的 2D map_server,但只有 AMCL 分支启动 AMCL。`NAV2=0` 不启动导航,仍可运行 LIO 建图。
Shell 默认 `LOCALIZATION=lio`、`LIO_MODE=localization`,缺失地图立即报错。建图模式默认写入 `generated/field_mapping.flmap`。可显式用 `LOCALIZATION=amcl` 选择旧方案;不自动回退。两个分支都保留 Nav2 的 2D map_server,但只有 AMCL 分支启动 AMCL。`NAV2=0` 不启动导航,仍可运行 LIO 建图。
Python 启动入口在仿真时钟和 odom/base/lidar TF 就绪后,通过与 shell 相同的独立启动进程运行 Nav2,具有对应参数:
```bash
ros2 launch src/sentry_sim/launch/sentry_arena.launch.py lio_mode:=mapping lio_map:="$PWD/generated/field.flmap"
ros2 launch src/sentry_sim/launch/sentry_arena.launch.py lio_map:="$PWD/generated/field.flmap"
ros2 launch src/sentry_sim/launch/sentry_arena.launch.py lio_mode:=mapping
ros2 launch src/sentry_sim/launch/sentry_arena.launch.py lio_map:="$PWD/generated/field_mapping.flmap"
ros2 launch src/sentry_sim/launch/sentry_arena.launch.py localization:=amcl
```
@@ -42,9 +42,20 @@ ros2 launch src/sentry_sim/launch/sentry_arena.launch.py localization:=amcl
只读定位绝不往地图插点。建图只在无退化、质量门槛通过后插入关键帧,位移必须严格大于 0.5 m,或旋转严格大于 10°。初始化种子帧是唯一例外。配准失败不写图。
### 单独生成全场 Gazebo 地图
```bash
python3 tools/capture_lio.py --profile mapping --full-field \
--output generated/full_survey --map generated/field_full.flmap
python3 tools/validation/validate_lio_navigation.py --full-field --launcher shell \
--map generated/field_full.flmap --lio-cloud-topic /scan/points_lio --output generated/full_shell
```
该模式在隔离的 Gazebo 空场沿重叠测站采集实际雷达扫描。测站坐标由命令指定,Gazebo 真值只核对到位误差。全场图包含南走廊的地面回波,为 LIO 提供垂直方向约束。避障用的 `/scan/points_filtered` 和 `/scan2d` 继续沿用原有的地面滤除规则。全场图对应当前仿真模型和雷达外参,改场地或更换外参后应重新采集和验收。
## ROS 接口与坐标约定
- 默认输入:`point_cloud_topic=/scan/points`、`imu_topic=/imu`。完整启动器显式选择 `/scan/points_filtered`。
- 默认输入:`point_cloud_topic=/scan/points`、`imu_topic=/imu`。Shell、Python 启动和录制工具均使用 `/scan/points_lio`。旧版地图可配合 `LIO_POINT_CLOUD_TOPIC=/scan/points_filtered` 显式录制或启动,Python 也可传 `lio_point_cloud_topic:=/scan/points_filtered`。
- 原始云在 `lidar_link`,自滤云在 `base_link`;适配器使用固定 TF 统一到 LiDAR 系。方位角时间估计也在 LiDAR 系完成,不重复施加安装外参。
- 默认固定帧:`map/odom/base_link/imu_link/lidar_link`,均可通过同名 frame 参数配置。外参从现有固定 TF 读取;缺失时等待,禁止假设为恒等变换。
- 内部状态原点为 IMU,`q` 将 IMU 坐标旋转到 map,`v/g` 在 map 系。误差顺序为 `p,v,theta,bg,ba,g`,右扰动态度误差。
@@ -69,9 +80,9 @@ Gazebo 的 IMU 传感器配置无噪声;正式回放使用原始数据,不
## 离线数据、回放与独立真值
```bash
python3 tools/capture_lio.py --profile mapping --output generated/lio_mapping --map generated/field.flmap --duration 120
python3 tools/capture_lio.py --profile evaluation --output generated/lio_evaluation --map generated/field.flmap --duration 120
build/bin/field_localization_replay --dataset generated/lio_evaluation --mode localization --map generated/field.flmap --output generated/lio_metrics
python3 tools/capture_lio.py --profile mapping --output generated/lio_mapping --map generated/field_mapping.flmap --duration 120
python3 tools/capture_lio.py --profile evaluation --output generated/lio_evaluation --map src/sentry_sim/maps/field_full.flmap --duration 120
build/bin/field_localization_replay --dataset generated/lio_evaluation --mode localization --map src/sentry_sim/maps/field_full.flmap --output generated/lio_metrics
```
采集前需要已有 ROS Python 环境。脚本使用独立 Gazebo partition 和 ROS domain,只清理由自己创建的进程树;创建输出目录中的 `STOP` 文件可请求停止。控制器仅用轮速里程计走西北走廊路线,真值只进入记录器。两次采集使用不同路线,地图与定位序列分开。
@@ -101,12 +112,12 @@ GCC 15.2 清洁重构建零警告,11 套 xmake 测试通过。五组带噪合
完整 Nav2 启动检查命令:
```bash
python3 tools/verify_lio_stack.py --map generated/field.flmap --output generated/lio_stack_check
python3 tools/validation/verify_lio_stack.py --map src/sentry_sim/maps/field_full.flmap --output generated/lio_stack_check
```
实测 9 个所需生命周期节点均 ACTIVE,AMCL 不存在,map→odom 仅一个发布者,没有 map→base_link 发布。交付数据中附带原始序列、收敛曲线 CSV、轨迹、逐帧状态、TF/生命周期检查 JSON 与构建日志。
Python 入口可用 `tools/verify_lio_stack.py --launcher python` 做同样的完整启动检查;验证器等待生命周期管理器报告激活完成,并继续观察稳定状态,避免在 bond 握手结束前退出。
Python 入口可用 `tools/validation/verify_lio_stack.py --launcher python` 做同样的完整启动检查;验证器等待生命周期管理器报告激活完成,并继续观察稳定状态,避免在 bond 握手结束前退出。
### 导航有效性与失效保护
@@ -121,10 +132,29 @@ Python 入口可用 `tools/verify_lio_stack.py --launcher python` 做同样的
两个入口都可运行相同的隔离验收。域编号可用 `--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
python3 tools/validation/run_lio_matrix.py --launcher shell --map src/sentry_sim/maps/field_full.flmap --output generated/lio_matrix_shell
python3 tools/validation/run_lio_matrix.py --launcher python --map src/sentry_sim/maps/field_full.flmap --output generated/lio_matrix_python
python3 tools/validation/validate_lio_navigation.py --launcher shell --scenario lidar_loss --goal 0 0 \
--map src/sentry_sim/maps/field_full.flmap --output generated/lio_lidar_loss
```
默认矩阵各跑三次空场和三次圆柱绕行,再跑一次堵塞。默认圆柱在 `(-4, -1.5)`,半径 0.22 m、高 0.8 m。每次保留启动与目标日志、录制数据、TF 发布者数、最小圆柱净距及无需轨迹对齐的 3D ATE 和 1 秒 RPE。堵塞场景要求 Nav2 返回明确中止。断流场景只停止试验自己创建的自滤节点,并用执行器收到的零速度测量停车延迟。实测位姿来自 Gazebo PosePublisher,只参与评估。
### 复现连续往返失效
`--round-trip-regression` 在同一个仿真实例中连续发送五个目标,复现中间停留的时间。支持 `clear` 和 `cylinder`,每段保存单独的目标日志、真值终点误差和轨迹指标。总报告包含停留期间的定位误差和首次定位失效时间。
```bash
python3 tools/validation/validate_lio_navigation.py --launcher shell --scenario clear \
--map generated/field.flmap --output generated/lio_round_trip_clear --round-trip-regression
```
用 `--launcher python` 切换入口。每次使用新的输出目录。跟踪 CSV 在原有字段后附加配准阶段和拒绝原因,以及初始与末次匹配的候选平面、支撑范围拒绝、面距离拒绝和内点数。可对同一条瞬时扫描离线比较预测位姿和独立真值附近的地图支持。
```bash
build/bin/field_localization_replay --dataset generated/lio_round_trip_clear/dataset \
--mode localization --map generated/field.flmap --output generated/lio_inspect \
--inspect-scan 108.7
```
将 108.7 替换为数据集 scans.csv 中要检查的时间戳。回放继续使用估计位姿运行滤波器。真值只用于对照匹配和评估轨迹。
@@ -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{2.0};
double integration_error_scale{1.4};
double maximum_imu_gap{0.05};
};
struct FilterSnapshot {
@@ -37,7 +37,7 @@ struct RegistrationOptions {
double neighborhood_radius{0.5};
double measurement_sigma{0.02};
// Shared map/association uncertainty does not shrink with the number of scan points.
double map_translation_sigma{0.02};
double map_translation_sigma{0.03};
double map_rotation_sigma{0.002};
double huber_threshold{0.025};
double max_plane_distance{0.12};
@@ -56,6 +56,17 @@ struct Degeneracy {
};
Degeneracy detect_degeneracy(const Matrix6 &normalized_information,const RegistrationOptions &options={});
enum class RegistrationFailure { NONE, NO_CORRESPONDENCES, DEGENERATE, INNOVATION, QUALITY };
enum class RegistrationStage { NOT_RUN, INITIAL_MATCH, ITERATION, FINAL_FUSION, COMPLETE };
struct AssociationCounts {
std::size_t sampled{0};
std::size_t candidate_planes{0};
std::size_t outside_support{0};
std::size_t plane_distance_rejected{0};
std::size_t inliers{0};
};
const char *registration_stage_name(RegistrationStage stage);
const char *registration_failure_name(RegistrationFailure failure);
struct RegistrationResult {
bool success{false};
FilterSnapshot estimate;
@@ -69,7 +80,12 @@ struct RegistrationResult {
std::size_t inliers{0};
double inlier_ratio{0};
Degeneracy degeneracy;
RegistrationStage stage{RegistrationStage::NOT_RUN};
AssociationCounts initial_associations;
AssociationCounts last_associations;
};
AssociationCounts inspect_scan_support(const PointCloud &cloud,const Pose3D &imu_from_sensor,
const VoxelMap &map,const Pose3D &map_from_imu,const RegistrationOptions &options={});
RegistrationResult scan_to_map(const PointCloud &cloud,const Pose3D &imu_from_sensor,
const VoxelMap &map,const FilterSnapshot &prediction,const NoiseOptions &noise={},
const RegistrationOptions &options={});
@@ -129,6 +129,11 @@ void write_filter_trace_header(std::ostream &out) {
for(int i=0;i<6;++i) for(int j=0;j<6;++j) out<<",H"<<i<<"_"<<j;
for(int i=0;i<6;++i) out<<",gradient"<<i;
for(int i=0;i<6;++i) out<<",singular"<<i;
out<<",registration_stage,registration_failure_name";
for (const char *phase:{"initial","last"}) {
for (const char *field:{"sampled","planes","outside_support","distance_rejected","inliers"})
out<<','<<phase<<'_'<<field;
}
out<<'\n';
}
void write_filter_trace(std::ostream &out,double time,const char *phase,const FilterSnapshot &f,const LocalizationStatus &status) {
@@ -143,6 +148,11 @@ void write_filter_trace(std::ostream &out,double time,const char *phase,const Fi
for(int i=0;i<6;++i) for(int j=0;j<6;++j) out<<','<<status.registration.information(i,j);
for(int i=0;i<6;++i) out<<','<<status.registration.gradient[i];
for(int i=0;i<6;++i) out<<','<<status.information_singular_values[i];
const auto &reg=status.registration;
out<<','<<registration_stage_name(reg.stage)<<','<<registration_failure_name(reg.failure);
for (const auto &counts:{reg.initial_associations,reg.last_associations})
out<<','<<counts.sampled<<','<<counts.candidate_planes<<','<<counts.outside_support
<<','<<counts.plane_distance_rejected<<','<<counts.inliers;
out<<'\n';
}
const char *mode_name(TrackingMode mode) { return mode==TrackingMode::FULL ? "FULL" : "IMU_ONLY"; }
@@ -109,42 +109,81 @@ Degeneracy detect_degeneracy(const Matrix6 &h,const RegistrationOptions &o) {
namespace {
struct Linearization {
Matrix6 h{Matrix6::Zero()}; Vector6 gradient{Vector6::Zero()};
double squared_error{0}; std::size_t inliers{0};
double squared_error{0}; AssociationCounts counts;
};
Linearization linearize(const PointCloud &cloud,const Pose3D &extrinsic,const VoxelMap &map,
const MotionState &state,const RegistrationOptions &o) {
Linearization out;
out.counts.sampled=cloud.points.size();
for (const auto &point:cloud.points) {
const Eigen::Vector3d body=extrinsic.rotation*point.position.cast<double>()+extrinsic.translation;
const Eigen::Vector3d world=state.pose.rotation*body+state.pose.translation;
const auto plane=map.plane(world,o.neighborhood_radius);
if (!plane.valid) continue;
++out.counts.candidate_planes;
const Eigen::Vector3d offset=world-plane.center;
const double residual=plane.normal.dot(offset);
if((offset-plane.normal*residual).norm()>plane.support_radius+map.resolution()) continue;
if (std::abs(residual)>o.max_plane_distance) continue;
if ((offset-plane.normal*residual).norm()>plane.support_radius+map.resolution()) {
++out.counts.outside_support;
continue;
}
if (std::abs(residual)>o.max_plane_distance) {
++out.counts.plane_distance_rejected;
continue;
}
Vector6 j; j.head<3>()=plane.normal;
j.tail<3>()=(-state.pose.rotation.toRotationMatrix()*skew(body)).transpose()*plane.normal;
const double weight=std::min(1.0,o.huber_threshold/std::max(1e-12,std::abs(residual)))/
(o.measurement_sigma*o.measurement_sigma);
out.h.noalias()+=weight*j*j.transpose(); out.gradient.noalias()+=weight*j*residual;
out.squared_error+=residual*residual; ++out.inliers;
out.squared_error+=residual*residual; ++out.counts.inliers;
}
return out;
}
}
AssociationCounts inspect_scan_support(const PointCloud &cloud,const Pose3D &extrinsic,
const VoxelMap &map,const Pose3D &map_from_imu,const RegistrationOptions &options) {
MotionState state; state.pose=map_from_imu;
return linearize(voxel_downsample(cloud,options.scan_voxel),extrinsic,map,state,options).counts;
}
const char *registration_stage_name(RegistrationStage stage) {
switch (stage) {
case RegistrationStage::NOT_RUN:return "NOT_RUN";
case RegistrationStage::INITIAL_MATCH:return "INITIAL_MATCH";
case RegistrationStage::ITERATION:return "ITERATION";
case RegistrationStage::FINAL_FUSION:return "FINAL_FUSION";
case RegistrationStage::COMPLETE:return "COMPLETE";
}
return "UNKNOWN";
}
const char *registration_failure_name(RegistrationFailure failure) {
switch (failure) {
case RegistrationFailure::NONE:return "NONE";
case RegistrationFailure::NO_CORRESPONDENCES:return "NO_CORRESPONDENCES";
case RegistrationFailure::DEGENERATE:return "DEGENERATE";
case RegistrationFailure::INNOVATION:return "INNOVATION";
case RegistrationFailure::QUALITY:return "QUALITY";
}
return "UNKNOWN";
}
RegistrationResult scan_to_map(const PointCloud &cloud,const Pose3D &extrinsic,const VoxelMap &map,
const FilterSnapshot &prediction,const NoiseOptions &noise,const RegistrationOptions &o) {
RegistrationResult result; result.estimate=prediction;
const auto scan=voxel_downsample(cloud,o.scan_voxel);
result.stage=RegistrationStage::INITIAL_MATCH;
result.initial_associations.sampled=scan.points.size();
result.last_associations=result.initial_associations;
if (scan.points.empty() || map.size()<5) return result;
ErrorStateFilter filter(noise); filter.restore(prediction);
auto record=[&](const Linearization &l) {
result.inliers=l.inliers; result.inlier_ratio=static_cast<double>(l.inliers)/scan.points.size();
result.residual_available=l.inliers>0;
result.rmse=l.inliers ? std::sqrt(l.squared_error/l.inliers) : 0;
result.last_associations=l.counts;
result.inliers=l.counts.inliers; result.inlier_ratio=static_cast<double>(l.counts.inliers)/scan.points.size();
result.residual_available=l.counts.inliers>0;
result.rmse=l.counts.inliers ? std::sqrt(l.squared_error/l.counts.inliers) : 0;
result.information=l.h; result.gradient=l.gradient;
result.degeneracy=detect_degeneracy(l.h/std::max(1.0,static_cast<double>(l.inliers)),o);
result.degeneracy=detect_degeneracy(l.h/std::max(1.0,static_cast<double>(l.counts.inliers)),o);
result.estimate=filter.snapshot();
};
Matrix6 model_covariance=Matrix6::Zero();
@@ -154,12 +193,14 @@ RegistrationResult scan_to_map(const PointCloud &cloud,const Pose3D &extrinsic,c
const auto before=filter.snapshot().state;
const auto l=linearize(scan,extrinsic,map,before,o);
record(l);
if (l.inliers<o.minimum_inliers) return result;
const auto deg=detect_degeneracy(l.h/static_cast<double>(l.inliers),o);
if (iteration==0) result.initial_associations=l.counts;
if (l.counts.inliers<o.minimum_inliers) return result;
const auto &deg=result.degeneracy;
if (deg.dimensions==6) { result.failure=RegistrationFailure::DEGENERATE; return result; }
// 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.
result.stage=RegistrationStage::ITERATION;
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();
@@ -171,6 +212,7 @@ RegistrationResult scan_to_map(const PointCloud &cloud,const Pose3D &extrinsic,c
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;
}
result.stage=RegistrationStage::FINAL_FUSION;
const auto final=linearize(scan,extrinsic,map,filter.snapshot().state,o);
record(final);
if (result.inliers<o.minimum_inliers) return result;
@@ -185,6 +227,7 @@ RegistrationResult scan_to_map(const PointCloud &cloud,const Pose3D &extrinsic,c
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;
if (result.success) result.stage=RegistrationStage::COMPLETE;
return result;
}
} // namespace field_localization::core
@@ -29,7 +29,7 @@ LocalizationNode::LocalizationNode(const rclcpp::NodeOptions &options):Node("fie
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);
core_options_.registration.map_translation_sigma=declare_parameter<double>("map_translation_sigma",core_options_.registration.map_translation_sigma);
core_options_.registration.map_rotation_sigma=declare_parameter<double>("map_rotation_sigma",0.002);
if(!std::isfinite(core_options_.registration.map_translation_sigma) || core_options_.registration.map_translation_sigma<0 ||
!std::isfinite(core_options_.registration.map_rotation_sigma) || core_options_.registration.map_rotation_sigma<0)
@@ -202,6 +202,16 @@ void LocalizationNode::publish_health(bool heartbeat) {
RCLCPP_ERROR(get_logger(),"localization no longer valid for navigation; TF halted: state_age=%.6f correction_age=%.6f position_3sigma=%.6f yaw_3sigma_deg=%.6f reason=%s",
now().seconds()-s.state_timestamp,now().seconds()-s.last_correction_timestamp,
health_.position_three_sigma(),health_.yaw_three_sigma()*180/std::numbers::pi,core::reason_name(s.reason));
if (s.reason==core::FailureReason::REGISTRATION_FAILED) {
const auto &reg=s.registration;
const auto &initial=reg.initial_associations;
const auto &last=reg.last_associations;
RCLCPP_ERROR(get_logger(),"registration stage=%s failure=%s scan=%.9f initial(inliers=%zu planes=%zu outside_support=%zu distance_rejected=%zu) last(inliers=%zu planes=%zu outside_support=%zu distance_rejected=%zu)",
core::registration_stage_name(reg.stage),core::registration_failure_name(reg.failure),
s.last_point_cloud_timestamp,initial.inliers,initial.candidate_planes,initial.outside_support,
initial.plane_distance_rejected,last.inliers,last.candidate_planes,last.outside_support,
last.plane_distance_rejected);
}
}
last_health_=valid;
}
+1 -1
View File
@@ -22,7 +22,7 @@ public:
imu_.exceptions(std::ios::badbit|std::ios::failbit); scans_.exceptions(std::ios::badbit|std::ios::failbit); truth_.exceptions(std::ios::badbit|std::ios::failbit);
imu_<<std::setprecision(17)<<"timestamp,gx,gy,gz,ax,ay,az\n"; scans_<<std::setprecision(17)<<"timestamp,file\n";
buffer_=std::make_unique<tf2_ros::Buffer>(get_clock()); listener_=std::make_unique<tf2_ros::TransformListener>(*buffer_);
cloud_sub_=create_subscription<sensor_msgs::msg::PointCloud2>(declare_parameter<std::string>("point_cloud_topic","/scan/points_filtered"),
cloud_sub_=create_subscription<sensor_msgs::msg::PointCloud2>(declare_parameter<std::string>("point_cloud_topic","/scan/points_lio"),
rclcpp::QoS(20).reliable(),[this](sensor_msgs::msg::PointCloud2::ConstSharedPtr msg) {
if (!ready_ || done_) return;
auto cloud=ros::convert_cloud(*msg);
+50 -3
View File
@@ -1,4 +1,5 @@
#include "field_localization/core/dataset.hpp"
#include <array>
#include <chrono>
#include <fstream>
#include <iomanip>
@@ -8,6 +9,13 @@
#include <stdexcept>
#include <unordered_map>
using namespace field_localization::core;
namespace {
void print_support(const char *label,const AssociationCounts &counts) {
std::cout<<label<<" sampled="<<counts.sampled<<" planes="<<counts.candidate_planes
<<" outside_support="<<counts.outside_support
<<" distance_rejected="<<counts.plane_distance_rejected<<" inliers="<<counts.inliers<<'\n';
}
} // namespace
int main(int argc,char **argv) {
try {
std::unordered_map<std::string,std::string> args;
@@ -16,7 +24,7 @@ int main(int argc,char **argv) {
args[argv[i]]=argv[i+1];
}
if (!args.contains("--dataset") || !args.contains("--mode") || !args.contains("--map") || !args.contains("--output"))
throw std::runtime_error("usage: field_localization_replay --dataset DIR --mode mapping|localization --map FILE --output DIR");
throw std::runtime_error("usage: field_localization_replay --dataset DIR --mode mapping|localization --map FILE --output DIR [--inspect-scan SIM_SECONDS]");
const std::filesystem::path dataset=args.at("--dataset"),output=args.at("--output");
auto options=read_dataset_config(dataset/"config.txt");
if (args.at("--mode")!="mapping" && args.at("--mode")!="localization") throw std::runtime_error("invalid mode");
@@ -25,6 +33,20 @@ int main(int argc,char **argv) {
if(args.contains("--integration-error-scale")) options.noise.integration_error_scale=std::stod(args.at("--integration-error-scale"));
LocalizationCore core(options); std::string error;
if (options.map_mode==MapMode::LOCALIZATION && !core.load_map(args.at("--map"),error)) throw std::runtime_error(error);
const auto truth_path=dataset/"truth.tum";
const bool have_truth=std::filesystem::exists(truth_path);
const auto truth=have_truth ? read_trajectory(truth_path) : std::vector<TrajectorySample>{};
std::optional<double> inspect_time;
std::optional<VoxelMap> inspect_map;
if (args.contains("--inspect-scan")) {
if (options.map_mode!=MapMode::LOCALIZATION || options.deskew.timing!=ScanTiming::INSTANTANEOUS || !have_truth)
throw std::runtime_error("--inspect-scan requires localization with instantaneous scans and truth.tum");
inspect_time=std::stod(args.at("--inspect-scan"));
if (!std::isfinite(*inspect_time)) throw std::runtime_error("invalid scan timestamp");
inspect_map=read_map(args.at("--map"),error);
if (!inspect_map) throw std::runtime_error(error);
}
bool inspected=false;
std::ifstream input(dataset/"imu.csv"); if (!input) throw std::runtime_error("missing imu.csv");
std::vector<ImuData> imu; std::string line; std::getline(input,line);
while (std::getline(input,line)) {
@@ -52,6 +74,30 @@ int main(int argc,char **argv) {
const auto begin=std::chrono::steady_clock::now(); core.process_point_cloud(cloud);
const auto diagnostic=core.get_snapshot();
if (inspect_time && std::abs(cloud.timestamp_sec-*inspect_time)<1e-8) {
const auto truth_base=trajectory_pose(truth,end);
const auto &reg=diagnostic.status.registration;
if (!truth_base || reg.stage==RegistrationStage::NOT_RUN)
throw std::runtime_error("scan has no aligned truth or registration prediction");
const auto map_from_imu=compose(*truth_base,options.base_from_imu);
const auto &prediction=diagnostic.status.registration_prediction.state;
const auto corrected=deskew(cloud,std::array{prediction},options.deskew);
if (!corrected) throw std::runtime_error("failed to prepare instantaneous scan");
const auto truth_support=inspect_scan_support(*corrected,options.deskew.imu_from_sensor,*inspect_map,
map_from_imu,options.registration);
const auto error_xyz=prediction.pose.translation-map_from_imu.translation;
std::cout<<std::setprecision(12)<<"scan="<<cloud.timestamp_sec
<<" stage="<<registration_stage_name(reg.stage)
<<" failure="<<registration_failure_name(reg.failure)
<<" prediction_minus_truth_xyz_m="<<error_xyz.transpose()
<<" rotation_error_deg="
<<log_so3(map_from_imu.rotation.conjugate()*prediction.pose.rotation).norm()*180/std::numbers::pi
<<'\n';
print_support("prediction",reg.initial_associations);
print_support("last",reg.last_associations);
print_support("truth",truth_support);
inspected=true;
}
write_filter_trace(trace,cloud.timestamp_sec,"prediction",diagnostic.status.registration_prediction,diagnostic.status);
write_filter_trace(trace,cloud.timestamp_sec,"candidate",diagnostic.status.registration.estimate,diagnostic.status);
write_filter_trace(trace,cloud.timestamp_sec,"posterior",diagnostic.filter,diagnostic.status);
@@ -66,13 +112,14 @@ int main(int argc,char **argv) {
<<','<<s.status.registration_rmse<<','<<s.status.inlier_count<<','<<s.status.inlier_ratio<<','<<s.status.degenerate_dimensions<<','
<<state.gyro_bias.x()<<','<<state.gyro_bias.y()<<','<<state.gyro_bias.z()<<','<<state.accel_bias.x()<<','<<state.accel_bias.y()<<','<<state.accel_bias.z()<<','<<s.status.registration_residual_available<<','<<s.status.registration.nis<<','<<s.status.registration.measurement_rank<<','<<static_cast<int>(s.status.registration.failure)<<','<<ms<<'\n';
}
if (inspect_time && !inspected) throw std::runtime_error("requested scan not in dataset");
if (options.map_mode==MapMode::MAPPING && !core.export_map(args.at("--map"),error)) throw std::runtime_error(error);
if (total==0) throw std::runtime_error("empty replay");
std::sort(latency.begin(),latency.end());
std::ostringstream report; report<<std::setprecision(9)<<"scans="<<total<<" FULL="<<full<<" FULL_ratio="<<double(full)/total
<<" scan_p95_ms="<<latency[static_cast<std::size_t>(0.95*(latency.size()-1))]<<'\n';
if (std::filesystem::exists(dataset/"truth.tum")) {
const auto truth=read_trajectory(dataset/"truth.tum"); const auto metric=evaluate(estimated,truth);
if (have_truth) {
const auto metric=evaluate(estimated,truth);
if (metric.matched==0 || metric.relative_pairs==0) throw std::runtime_error("insufficient matching ground truth");
report<<"matched="<<metric.matched<<'/'<<metric.total<<" coverage="<<double(metric.matched)/metric.total<<" RPE_pairs="<<metric.relative_pairs<<'\n'
<<"ATE_translation_RMSE_m="<<metric.ate_translation<<" ATE_rotation_RMSE_deg="<<metric.ate_rotation_rad*180/std::numbers::pi<<'\n'
@@ -0,0 +1 @@
108.5 -4.9021935418437943 2.9320217193133793 0.1557928922336535 0.11953694764680566 0.19908177120751999 0.045965043312493209 -0.00086052905380611946 3.8835947097606263e-05 -0.55033851439645454 -0.83494118209214019 3.8119482349976081e-05 -4.76556171027656e-05 -1.0893553551394554e-05 -0.0076579611075292681 -0.001573404450170669 0.062223414195409221 -0.020740954303261897 0.047091173245459049 -9.7476220442384385 0.00032180030162672231 -3.3109679715980393e-06 -1.4134561776379964e-07 0.00128395026095998 -1.6746730317314658e-05 -8.4886017517825797e-07 4.1240730271156636e-07 2.1418971002544343e-07 -2.8876581180948139e-07 -4.3422373923642243e-09 -5.1748223345340147e-10 9.9958077796484632e-10 3.3266378490022887e-07 1.0028474513103997e-06 1.0691009716774382e-06 1.1444559866337746e-06 3.7771093654250646e-07 1.0691201494343238e-06 -3.3109679715980393e-06 0.00030135439567193314 -1.7703924751834215e-07 -1.6662850139947176e-05 0.0011985416218993159 3.8619545898588747e-07 -2.6147583384228565e-07 5.5485281955242264e-07 -3.657478893010278e-07 4.2797428049573721e-10 -5.5219694040548798e-09 1.2780944746782657e-09 -1.6542624247824321e-06 8.9990442499691803e-08 -3.7854466338783015e-06 -8.0172810695956697e-07 1.1298994983796557e-06 -3.7801386121655004e-06 -1.4134561776379964e-07 -1.7703924751834215e-07 0.00023484235692365681 7.7976930255511676e-07 -1.5315893762949035e-06 0.00072374316475533275 8.0054833699954886e-07 -3.7983349382611144e-07 4.7014732995790377e-08 -6.6169668059266572e-09 5.1662907401548531e-09 -2.0922013649704161e-10 -2.7197868772262445e-09 4.3794454248856465e-10 -7.2241387348460554e-07 -3.4340629368096118e-09 4.8637981713538916e-09 2.0170234401260474e-08 0.00128395026095998 -1.6662850139947176e-05 7.7976930255511676e-07 0.016671016339951206 0.00028959121918970378 -3.798955913976945e-06 4.2882917579726604e-06 1.8958563347564645e-06 -8.2652501644825307e-08 -4.4522500494586826e-08 -8.0812241942467223e-09 3.0057389155497851e-10 1.8752153113102324e-06 6.3682456726758585e-06 6.5733340033091501e-06 7.1989659236711069e-06 2.4250924065566434e-06 6.5747187554529147e-06 -1.6746730317314658e-05 0.0011985416218993159 -1.5315893762949035e-06 0.00028959121918970378 0.017016380591946909 4.1421284919585015e-06 -2.2637764100331944e-06 5.1619542058896502e-06 -4.0037244977777193e-07 8.6781637833258431e-09 -5.2328110182931958e-08 1.58419438820848e-09 -9.7135882093019719e-06 2.9077145220395079e-07 -2.1870543798192066e-05 -4.6791391025785722e-06 6.6544502227089111e-06 -2.1840445337136608e-05 -8.4886017517825797e-07 3.8619545898588747e-07 0.00072374316475533275 -3.798955913976945e-06 4.1421284919585015e-06 0.012275672165360777 8.4060340358083866e-07 -3.7510481928876981e-07 6.8149456965885298e-08 -6.8844559369381303e-09 4.0437621421826469e-09 -3.4178005968171159e-10 -1.5153987088700559e-08 2.4507827427223861e-09 -4.2341934360751864e-06 -1.889941795210489e-08 2.6848198981890525e-08 1.244230272814858e-07 4.1240730271156636e-07 -2.6147583384228565e-07 8.0054833699954886e-07 4.2882917579726604e-06 -2.2637764100331944e-06 8.4060340358083866e-07 2.8207167738484057e-06 -9.6336778435724137e-08 1.3781317221426031e-08 -2.6440380244751873e-08 4.0522447969181831e-09 -5.8201390497764061e-11 -8.0099878941585013e-10 -7.872340442403864e-10 -3.4323625809851157e-09 -1.0303682108364948e-09 4.8412100509677764e-12 -2.0828522750049064e-09 2.1418971002544343e-07 5.5485281955242264e-07 -3.7983349382611144e-07 1.8958563347564645e-06 5.1619542058896502e-06 -3.7510481928876981e-07 -9.6336778435724137e-08 3.0510260124192839e-06 -8.5184113912824024e-09 -2.5010269657606956e-09 -2.8533187359619162e-08 1.6596970762816415e-11 1.0235809829900821e-09 -4.1617052782586423e-10 3.4166161706316234e-09 2.8897888828753661e-10 -9.6927714973496483e-10 2.9900252507395201e-09 -2.8876581180948139e-07 -3.657478893010278e-07 4.7014732995790377e-08 -8.2652501644825307e-08 -4.0037244977777193e-07 6.8149456965885298e-08 1.3781317221426031e-08 -8.5184113912824024e-09 4.9531797132419396e-06 -1.0899538712701036e-10 1.012607157604397e-10 -2.1846203888502755e-08 6.4585465639471621e-10 -3.8025781452778024e-10 1.3770155571674219e-09 1.3125030002545032e-11 -6.4473039908968704e-10 1.4534369723133827e-09 -4.3422373923642243e-09 4.2797428049573721e-10 -6.6169668059266572e-09 -4.4522500494586826e-08 8.6781637833258431e-09 -6.8844559369381303e-09 -2.6440380244751873e-08 -2.5010269657606956e-09 -1.0899538712701036e-10 9.5243509910712323e-08 -1.2449932005997435e-10 -5.3657067385421009e-12 -1.1880921854779703e-10 2.755054987508737e-10 5.021226678365264e-10 -4.1880538357733795e-10 1.4253390980595335e-10 3.58472159966974e-10 -5.1748223345340147e-10 -5.5219694040548798e-09 5.1662907401548531e-09 -8.0812241942467223e-09 -5.2328110182931958e-08 4.0437621421826469e-09 4.0522447969181831e-09 -2.8533187359619162e-08 1.012607157604397e-10 -1.2449932005997435e-10 9.6602785462132596e-08 7.2250758694789384e-12 2.5951113791785858e-10 -1.9493442618219454e-10 -1.044466662172168e-09 -1.771308527273993e-10 -1.558599068747Line 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,46 @@
timestamp,gx,gy,gz,ax,ay,az
108.48,-0.00027579711156923295,-9.6228164683447422e-05,-0.56779033555889469,-1.0530966798405577,-2.6010947767770594,9.8095553816565157
108.48999999999999,-0.00025615782747161729,-0.00010587090718420355,-0.55785202563478387,-1.7876666177385214,-1.0631781169629055,9.8094280629193058
108.5,-0.00023825784714968831,-0.00011711104903238535,-0.58693848212030686,-1.9043254046636544,-1.139065472424273,9.8094578216037966
108.51000000000001,-0.0038630553244536035,-0.0038254066591876645,-0.68517701957796229,1.1061646030349155,-2.5481938512545188,9.7882127819939981
108.52,-0.012606909063535997,0.016247733271579818,-0.78297260155929282,-2.4583754036013685,-1.7038647361881609,11.839716492099672
108.53,-0.061277268073585023,0.079820328714736447,-0.95872965467934201,-4.2708544673441109,-0.84812091026555592,9.9852964166452605
108.54000000000001,-0.076112960000572827,0.10118717039092451,-1.0492460237459966,-0.95334847078538454,0.71509630025199966,9.7244760393909324
108.55,-0.067641209642736802,0.092385150361106574,-1.0531247188783339,-0.96299303923260471,0.70118110999445338,9.7257429713406207
108.56,0.0033595937551803329,0.0020697239466177832,-1.0235049120000919,-8.3456600758072401,-2.6104502542668877,9.1893792949826683
108.56999999999999,0.02633565443321674,-0.027770362691463782,-1.0327068282495309,-0.86663841190981339,0.59485616933232788,9.7503275368400892
108.58,0.044817131676968228,-0.052668601183060743,-1.0250939063161346,-0.87108193784216637,0.59289071702653651,9.7503813880634009
108.59,0.027626257433854592,-0.031687748948603475,-0.97521425042473509,12.881843216107459,71.50407345556205,10.073106197385915
108.59999999999999,-0.036474759445082425,0.051364487006142587,-0.96049966667821285,-4.4324684565237389,1.8562481433950828,9.8677515940224332
108.61,-0.04134819767885773,0.05920975956051068,-1.030264108649404,-0.99297521928374843,0.65187845641134368,9.7303549205617799
108.62,0.01295842388313628,-0.0039726626729746648,-1.0139150953741738,0.19457236107968115,-0.55040386338858716,9.7250152706423183
108.63,0.034377204593879558,-0.033473846614123254,-0.99454322329474421,0.2959840955286403,-0.63552909536554569,9.7783991319795742
108.64,0.050820131406794901,-0.055549240334301773,-0.97760185137247102,-1.9641378332748467,2.153826777994603,14.191482820845833
108.65000000000001,0.061042066837415115,-0.04419677239597361,-0.96473456396457447,-0.18272266438283608,-0.26120167792698396,9.294572520726657
108.66,0.089517043233146909,-0.060374879806683657,-0.9403871801458199,-0.15826475289053657,-0.24363012237265588,9.3217861415882517
108.67,0.00075568636684762713,0.083573010739332126,-0.91678558238484609,4.0341898535273764,-4.6884496196539844,7.7014957643994784
108.68000000000001,0.0021557033600065473,0.12707896757705958,-1.0486907811541184,4.0785371406202495,-4.6392205782611713,7.7203149932024022
108.69,0.0020433518921272572,0.0020166876327267751,-0.9054452167476853,2.5840014331377761,-3.0474611788932653,9.7424379876060367
108.7,0.0018146512053483586,0.033385534243483068,-0.75254006007709262,2.9177303958871978,-0.9347762921025552,9.2265301165200722
108.70999999999999,-0.0071175103038246743,2.2653503118359557e-06,-0.79580071923165763,1.5862332837852466,1.7892895525491757,8.5117099060340156
108.72,0.0018226364070514966,-0.00047441621740520361,-0.64959146474622242,-2.5218861545502262,-4.5195339577395215,9.8019501144738008
108.73,0.00061213745480492821,0.00064759022433580143,-0.23765205614659146,-2.1891152862620129,-4.6163027052355474,9.7575703912375431
108.73999999999999,-8.5173882333780833e-05,-0.00040036893615584556,0.0001979938570819452,-0.029016022025761215,-0.0004040832591799702,9.8094296040077413
108.75,-8.2351569187941569e-05,-0.0003822955018146262,0.00018844413837782267,-0.029031520889687464,-0.00034444352750586152,9.8094544409425399
108.76000000000001,-7.8845306342528189e-05,-0.00036413257485318955,0.0001793636084983912,-0.028968714585963447,-0.000346458398696414,9.8094811772970907
108.77,-7.4880532471881042e-05,-0.00034611221051486372,0.00017072867345419888,-0.028935081983888621,-0.00032672658632929149,9.809505062753086
108.78,-7.1115196251946727e-05,-0.00032899306246744709,0.00016251599600637965,-0.02890308134415694,-0.00030795031942689192,9.8095277389049578
108.79000000000001,-6.7539261185498663e-05,-0.00031272916713399293,0.00015470497749903061,-0.028872634220905094,-0.00029008367401124532,9.8095492684904784
108.8,-6.4222286693821823e-05,-0.00029725638885302771,0.00014727580938687338,-0.02884335197079773,-0.00027185352010715869,9.809571495474632
108.81,-6.1074528905443468e-05,-0.00028255450086174305,0.00014021005859313153,-0.02881582584481648,-0.00025581286497402487,9.8095907279037284
108.81999999999999,-5.8081104455341283e-05,-0.00026858606364358782,0.00013348999987412524,-0.028789638923466501,-0.00024055457626561674,9.8096089957348145
108.83,-5.5234443560975581e-05,-0.00025531389037077289,0.00012709875209389966,-0.028764726530231797,-0.00022604070858204839,9.8096263483606254
108.84,-5.2527348000840473e-05,-0.00024270273620216737,0.00012102025508831105,-0.028741027063309946,-0.00021223512807402926,9.8096428325524521
108.84999999999999,-4.9952972850119343e-05,-0.00023071919154618757,0.00011523923010331233,-0.028718481854024532,-0.00019910343697915361,9.8096584926023418
108.86,-4.7504809118585898e-05,-0.00021933158168783681,0.00010974114210159096,-0.028697035031996648,-0.00018661288834960618,9.8096733704656565
108.87,-4.5176667237112169e-05,-0.00020850987238039211,0.00010451216386677535,-0.028676633395378699,-0.00017473231118386127,9.8096875058901745
108.88,-4.2962661368461969e-05,-0.00019822558091676793,9.9539141778251435e-05,-0.02865722628771946,-0.00016343203616670909,9.8097009365388317
108.89,-4.0857194480294721e-05,-0.00018845169243943518,9.4809563240037353e-05,-0.028638765478787489,-0.00015268382383709634,9.8097136981062469
108.90000000000001,-3.8854944159717922e-05,-0.00017916258107389583,9.0311525646290502e-05,-0.028621205051879525,-0.00014246079525618113,9.8097258244280425
108.91,-3.6950849126026176e-05,-0.00017033393556493636,8.6033706814335204e-05,-0.028604501294363802,-0.00013273737693193267,9.8097373475763607
108.92,-3.5140096402690625e-05,-0.00016194268924257522,8.1965336865759034e-05,-0.028588612596438932,-0.0001234892242220093,9.8097482979663546
1 timestamp gx gy gz ax ay az
2 108.48 -0.00027579711156923295 -9.6228164683447422e-05 -0.56779033555889469 -1.0530966798405577 -2.6010947767770594 9.8095553816565157
3 108.48999999999999 -0.00025615782747161729 -0.00010587090718420355 -0.55785202563478387 -1.7876666177385214 -1.0631781169629055 9.8094280629193058
4 108.5 -0.00023825784714968831 -0.00011711104903238535 -0.58693848212030686 -1.9043254046636544 -1.139065472424273 9.8094578216037966
5 108.51000000000001 -0.0038630553244536035 -0.0038254066591876645 -0.68517701957796229 1.1061646030349155 -2.5481938512545188 9.7882127819939981
6 108.52 -0.012606909063535997 0.016247733271579818 -0.78297260155929282 -2.4583754036013685 -1.7038647361881609 11.839716492099672
7 108.53 -0.061277268073585023 0.079820328714736447 -0.95872965467934201 -4.2708544673441109 -0.84812091026555592 9.9852964166452605
8 108.54000000000001 -0.076112960000572827 0.10118717039092451 -1.0492460237459966 -0.95334847078538454 0.71509630025199966 9.7244760393909324
9 108.55 -0.067641209642736802 0.092385150361106574 -1.0531247188783339 -0.96299303923260471 0.70118110999445338 9.7257429713406207
10 108.56 0.0033595937551803329 0.0020697239466177832 -1.0235049120000919 -8.3456600758072401 -2.6104502542668877 9.1893792949826683
11 108.56999999999999 0.02633565443321674 -0.027770362691463782 -1.0327068282495309 -0.86663841190981339 0.59485616933232788 9.7503275368400892
12 108.58 0.044817131676968228 -0.052668601183060743 -1.0250939063161346 -0.87108193784216637 0.59289071702653651 9.7503813880634009
13 108.59 0.027626257433854592 -0.031687748948603475 -0.97521425042473509 12.881843216107459 71.50407345556205 10.073106197385915
14 108.59999999999999 -0.036474759445082425 0.051364487006142587 -0.96049966667821285 -4.4324684565237389 1.8562481433950828 9.8677515940224332
15 108.61 -0.04134819767885773 0.05920975956051068 -1.030264108649404 -0.99297521928374843 0.65187845641134368 9.7303549205617799
16 108.62 0.01295842388313628 -0.0039726626729746648 -1.0139150953741738 0.19457236107968115 -0.55040386338858716 9.7250152706423183
17 108.63 0.034377204593879558 -0.033473846614123254 -0.99454322329474421 0.2959840955286403 -0.63552909536554569 9.7783991319795742
18 108.64 0.050820131406794901 -0.055549240334301773 -0.97760185137247102 -1.9641378332748467 2.153826777994603 14.191482820845833
19 108.65000000000001 0.061042066837415115 -0.04419677239597361 -0.96473456396457447 -0.18272266438283608 -0.26120167792698396 9.294572520726657
20 108.66 0.089517043233146909 -0.060374879806683657 -0.9403871801458199 -0.15826475289053657 -0.24363012237265588 9.3217861415882517
21 108.67 0.00075568636684762713 0.083573010739332126 -0.91678558238484609 4.0341898535273764 -4.6884496196539844 7.7014957643994784
22 108.68000000000001 0.0021557033600065473 0.12707896757705958 -1.0486907811541184 4.0785371406202495 -4.6392205782611713 7.7203149932024022
23 108.69 0.0020433518921272572 0.0020166876327267751 -0.9054452167476853 2.5840014331377761 -3.0474611788932653 9.7424379876060367
24 108.7 0.0018146512053483586 0.033385534243483068 -0.75254006007709262 2.9177303958871978 -0.9347762921025552 9.2265301165200722
25 108.70999999999999 -0.0071175103038246743 2.2653503118359557e-06 -0.79580071923165763 1.5862332837852466 1.7892895525491757 8.5117099060340156
26 108.72 0.0018226364070514966 -0.00047441621740520361 -0.64959146474622242 -2.5218861545502262 -4.5195339577395215 9.8019501144738008
27 108.73 0.00061213745480492821 0.00064759022433580143 -0.23765205614659146 -2.1891152862620129 -4.6163027052355474 9.7575703912375431
28 108.73999999999999 -8.5173882333780833e-05 -0.00040036893615584556 0.0001979938570819452 -0.029016022025761215 -0.0004040832591799702 9.8094296040077413
29 108.75 -8.2351569187941569e-05 -0.0003822955018146262 0.00018844413837782267 -0.029031520889687464 -0.00034444352750586152 9.8094544409425399
30 108.76000000000001 -7.8845306342528189e-05 -0.00036413257485318955 0.0001793636084983912 -0.028968714585963447 -0.000346458398696414 9.8094811772970907
31 108.77 -7.4880532471881042e-05 -0.00034611221051486372 0.00017072867345419888 -0.028935081983888621 -0.00032672658632929149 9.809505062753086
32 108.78 -7.1115196251946727e-05 -0.00032899306246744709 0.00016251599600637965 -0.02890308134415694 -0.00030795031942689192 9.8095277389049578
33 108.79000000000001 -6.7539261185498663e-05 -0.00031272916713399293 0.00015470497749903061 -0.028872634220905094 -0.00029008367401124532 9.8095492684904784
34 108.8 -6.4222286693821823e-05 -0.00029725638885302771 0.00014727580938687338 -0.02884335197079773 -0.00027185352010715869 9.809571495474632
35 108.81 -6.1074528905443468e-05 -0.00028255450086174305 0.00014021005859313153 -0.02881582584481648 -0.00025581286497402487 9.8095907279037284
36 108.81999999999999 -5.8081104455341283e-05 -0.00026858606364358782 0.00013348999987412524 -0.028789638923466501 -0.00024055457626561674 9.8096089957348145
37 108.83 -5.5234443560975581e-05 -0.00025531389037077289 0.00012709875209389966 -0.028764726530231797 -0.00022604070858204839 9.8096263483606254
38 108.84 -5.2527348000840473e-05 -0.00024270273620216737 0.00012102025508831105 -0.028741027063309946 -0.00021223512807402926 9.8096428325524521
39 108.84999999999999 -4.9952972850119343e-05 -0.00023071919154618757 0.00011523923010331233 -0.028718481854024532 -0.00019910343697915361 9.8096584926023418
40 108.86 -4.7504809118585898e-05 -0.00021933158168783681 0.00010974114210159096 -0.028697035031996648 -0.00018661288834960618 9.8096733704656565
41 108.87 -4.5176667237112169e-05 -0.00020850987238039211 0.00010451216386677535 -0.028676633395378699 -0.00017473231118386127 9.8096875058901745
42 108.88 -4.2962661368461969e-05 -0.00019822558091676793 9.9539141778251435e-05 -0.02865722628771946 -0.00016343203616670909 9.8097009365388317
43 108.89 -4.0857194480294721e-05 -0.00018845169243943518 9.4809563240037353e-05 -0.028638765478787489 -0.00015268382383709634 9.8097136981062469
44 108.90000000000001 -3.8854944159717922e-05 -0.00017916258107389583 9.0311525646290502e-05 -0.028621205051879525 -0.00014246079525618113 9.8097258244280425
45 108.91 -3.6950849126026176e-05 -0.00017033393556493636 8.6033706814335204e-05 -0.028604501294363802 -0.00013273737693193267 9.8097373475763607
46 108.92 -3.5140096402690625e-05 -0.00016194268924257522 8.1965336865759034e-05 -0.028588612596438932 -0.0001234892242220093 9.8097482979663546
@@ -0,0 +1,9 @@
Isolated Gazebo Shell launch, clear scene, second leg from (0,0) back to (-5,3).
The checkpoint is the original filter prediction at simulated time 108.5 s.
Scans at 108.5--108.9 s, IMU samples and independent truth are from the same run.
Acceleration changed by 72.23 m/s^2 at 108.59 s, then by 71.77 m/s^2 at 108.60 s.
The old integration scale 2.0 crossed the horizontal position 3-sigma threshold
(0.5 m) at 108.7 s and the drive interlock stopped the goal. Map matching continued.
The test compares the prior before each scan at both scales and checks corrections
and truth error. Truth only scores the output. This is separate from the
unrecorded failure that had no correspondences.
@@ -0,0 +1,6 @@
timestamp,file
108.5,1070.flpc
108.59999999999999,1071.flpc
108.7,1072.flpc
108.8,1073.flpc
108.90000000000001,1074.flpc
1 timestamp file
2 108.5 1070.flpc
3 108.59999999999999 1071.flpc
4 108.7 1072.flpc
5 108.8 1073.flpc
6 108.90000000000001 1074.flpc
@@ -0,0 +1,45 @@
108.48 -4.9071026036118548 2.9233913230750783 0.0029858126403290871 7.2250798166288425e-06 2.8442624406782508e-05 0.55507890540450322 0.83179769650664104
108.48999999999999 -4.9062642203379969 2.9255680970807725 0.0029865468907930271 6.3291191353360092e-06 2.7307813742419122e-05 0.55276430081705308 0.83333764282939971
108.5 -4.9053972077996111 2.9275282001593639 0.0029872286798281614 5.5399981504607552e-06 2.6178129603476733e-05 0.55036534252022395 0.83492394206694698
108.51000000000001 -4.9046646886830549 2.9292729227331513 0.0029936313785604166 -4.736127786470753e-06 3.3049173620555536e-05 0.54761911569906785 0.83672773529164923
108.52 -4.9038096193174239 2.9308242408481151 0.0029844753027834731 -4.9230391904278006e-05 2.243576255743785e-05 0.54461563620190612 0.83868576110328608
108.53 -4.9029951128170328 2.9319089098101028 0.0030006080810971733 -0.00037185933427108623 0.00013601574900552754 0.5408852167529149 0.84109632356734498
108.54000000000001 -4.9022632148810406 2.9325382215656548 0.0030306202514057898 -0.00098584198609175241 0.00035761968065051636 0.53652427507351241 0.84388423523643596
108.55 -4.9016446671925502 2.9330504405569773 0.0030581468303319923 -0.001544564748203659 0.00056650094536240755 0.53207935443970145 0.8466928923614796
108.56 -4.9012232035425685 2.9335773095391842 0.0030746075327204988 -0.0018251026007992592 0.00068374173436587299 0.52766200432833754 0.84945218269537615
108.56999999999999 -4.9010350946153922 2.9340649288436951 0.0030712408664604692 -0.0017346514287665561 0.0006601243266040756 0.5232426619061783 0.85218171300587708
108.58 -4.9009513477400262 2.9345809755178025 0.0030603042691265932 -0.0014667422006025576 0.00056709949674644926 0.5188551578902586 0.8548607209342074
108.59 -4.9011856833308274 2.9351716379965223 0.0030486176107153568 -0.0011813940203852925 0.00046400831990277692 0.51448633770426766 0.85749763691808378
108.59999999999999 -4.9025325962781743 2.9358826277467109 0.0030583004600324795 -0.0013722337617795045 0.00054506094092712603 0.51048467726222702 0.85988558201865073
108.61 -4.9042171088724684 2.9362391277319615 0.0030755562493143384 -0.0017189437160433187 0.0006910657880021667 0.50611596493250299 0.86246344716806356
108.62 -4.9059845880932338 2.9365916184328378 0.0030726120932165349 -0.0017579433845956738 0.00072700441405718129 0.50162314016042819 0.86508416142895017
108.63 -4.9077037294256938 2.9369549108499187 0.0030549526657664824 -0.0015906492030189677 0.00068766861934978067 0.49727550118258251 0.86759095942188935
108.64 -4.9093583297663042 2.9373585080073492 0.0030191847395952794 -0.0012747314821810044 0.00060554175097587125 0.49300634869296989 0.87002456777223369
108.65000000000001 -4.9110518183553697 2.9377027711543717 0.0029664317860478985 -0.0009074190385914881 0.00052551606818008632 0.48878714497942805 0.87240244573614656
108.66 -4.9127338187093921 2.9380444130606538 0.0028672150785611118 -0.00042283910851417572 0.00046832055697665017 0.48466240927990606 0.87470106374346035
108.67 -4.9141628840969114 2.9381489038979098 0.0027565590016154378 -0.00027719379602898368 0.00060403682294858359 0.48064260716109708 0.87691632581706414
108.68000000000001 -4.9152086923244882 2.9381074413261659 0.0025694281599019544 -0.00055042288347394999 0.0011055583485082147 0.47628672908702829 0.87928915975972732
108.69 -4.9161351835595939 2.93864659832927 0.0025383300594161349 -0.00059853666229444497 0.0012018901858600714 0.47201549865874842 0.88158922761101055
108.7 -4.9167952516904698 2.9394702423291088 0.0025057824865530377 -0.00064228777597694423 0.0012922911428858172 0.46842127708854053 0.88350406033065609
108.70999999999999 -4.9173018922715146 2.940362071952022 0.0024918813891934215 -0.00068859771738163955 0.0013387330363737859 0.46495892627369939 0.88533097229536117
108.72 -4.9177556213521374 2.9411980850974202 0.0025009992843522595 -0.0006718193217249693 0.0013178923164732753 0.46155766211772059 0.8871089765970499
108.73 -4.9180187668671556 2.9416340556595397 0.0025015281783265855 -0.00066939373545388465 0.00131865235183839 0.45977143268899689 0.8880360593754677
108.73999999999999 -4.9180544473336081 2.941683628128029 0.002501154514657559 -0.00067050560271407912 0.0013205948330638885 0.45956901953254004 0.88814082370839342
108.75 -4.9180547737815665 2.9416842658140818 0.0025017594416658884 -0.00067018684139458023 0.001319432124916569 0.45956953788076993 0.88814055745727605
108.76000000000001 -4.9180553984216857 2.9416854842061171 0.0025029151068616351 -0.00066957979335071434 0.0013171997000242573 0.45957052959788774 0.8881400480627859
108.77 -4.9180559872349887 2.9416866303269003 0.0025040022766528716 -0.00066900887500588179 0.0013150964352657767 0.45957146426949047 0.88813956796085125
108.78 -4.918056268866053 2.941687177613542 0.0025045214778418212 -0.00066873603972176642 0.0013140919444938187 0.45957191126200286 0.88813933835488923
108.79000000000001 -4.9180566316896259 2.9416878817389449 0.002505189559091462 -0.00066838478328363647 0.0013127993806705148 0.45957248705398718 0.88813904258431309
108.8 -4.9180573159650995 2.941689206524909 0.0025064470135053628 -0.0006677233142186968 0.001310366532802802 0.45957357276097899 0.88813848486867997
108.81 -4.9180576384942549 2.9416898293585856 0.0025070385860793605 -0.00066741227345367327 0.0013092221421721927 0.45957408439159536 0.88813822204309312
108.81999999999999 -4.918057948634182 2.9416904271975306 0.00250760671196067 -0.00066711367701798203 0.0013081232115439393 0.45957457629499837 0.88813796934726208
108.83 -4.9180582468721754 2.9416910010247697 0.0025081523257144845 -0.00066682701988258033 0.0013070679209143726 0.45957504924727111 0.8881377263828758
108.84 -4.9180585336763993 2.9416915517847468 0.0025086763242520749 -0.00066655181805750784 0.0013060545242227191 0.45957550399401981 0.88813749276724963
108.84999999999999 -4.9180588767864721 2.9416922091752897 0.0025093022340924032 -0.00066622321997631935 0.0013048441461448572 0.45957604791451118 0.88813721333567286
108.86 -4.9180592035726489 2.9416928336327022 0.0025098973182049495 -0.00066591093349993114 0.0013036934913511122 0.45957656584359741 0.88813694725155701
108.87 -4.9180595148337707 2.9416934267685386 0.0025104631019277146 -0.00066561413916471884 0.0013025995936241192 0.45957705905345159 0.88813669386187222
108.88 -4.9180598113296483 2.9416939901156209 0.0025110010344434287 -0.00066533205959182315 0.0013015596358814619 0.4595775287540666 0.88813645254548013
108.89 -4.9180601486496087 2.9416946288586678 0.0025116117236652956 -0.00066501195181030263 0.0013003791296257951 0.4595780629790025 0.88813617807276113
108.90000000000001 -4.9180604669283969 2.9416952291860867 0.002512186535750748 -0.00066471077005743004 0.0012992680814553675 0.45957856688710369 0.88813591917005619
108.91 -4.9180607672789973 2.9416957933432286 0.0025127275864666853 -0.00066442738445443193 0.0012982223830156918 0.45957904225069685 0.88813567492744439
108.92 -4.9180607672789973 2.9416957933432286 0.0025127275864666853 -0.00066442738445443193 0.0012982223830156918 0.45957904225069685 0.88813567492744439
@@ -0,0 +1 @@
73 -1.1860204800839835 -1.5637071989344469 0.091575138745469603 -0.42970067883716345 -0.32356653324631857 -0.21993780179039443 0.0051528723832590748 0.01813053226079377 -0.96370380891118801 0.2663075297399809 -4.2996599124332597e-05 -0.00013302682205245796 -3.3626316872579628e-05 -0.093146036471238869 -0.033023000640963425 0.043485336943729629 -0.088175115845336036 0.0099135394819331538 -9.7661660023761758 0.00060780813598797028 4.4833770274984383e-05 4.068913437385071e-06 0.0024170781771618599 0.00032731725695303603 2.1443137968033931e-05 -2.3597143001486444e-07 -2.9741917115125317e-07 9.7966640722376522e-08 2.1208513955816369e-09 2.5997265115716957e-09 -5.113828143965986e-10 2.1029545238081228e-05 6.2372126519518097e-06 5.6578640848176513e-06 1.9615872912915468e-05 8.7608927362914083e-06 5.6572697499445987e-06 4.4833770274984383e-05 0.00058045375687999019 3.5739298696195479e-06 0.00032917108381059015 0.0022005736005506395 1.7655757929154496e-05 3.1281479923900358e-07 -1.5012792304465173e-07 -2.8812862283482996e-07 -2.5530828508678023e-09 2.1325162410567553e-09 1.6011305635602758e-09 2.7572024541284657e-05 3.161555051603116e-05 1.2174875434780663e-05 2.2894475561072589e-05 3.5215830711721919e-05 1.2296275724162208e-05 4.068913437385071e-06 3.5739298696195479e-06 0.00036996744205358592 2.1762306440312313e-05 1.8755039425128898e-05 0.001267729477946909 4.5968173799619698e-07 -4.7184537272925347e-07 -4.5523729647643344e-08 -1.2926610506547117e-09 7.6217213133024349e-09 2.0332494642726058e-10 -2.9738024273382044e-07 -8.9656572513236403e-08 -2.3517667470055742e-06 -3.0426650126010034e-07 -1.4059474625069041e-07 9.7645343680620327e-08 0.0024170781771618599 0.00032917108381059015 2.1762306440312313e-05 0.013004981872738922 0.0029538966226704873 0.00015059828618843344 -2.6950965138518528e-06 -3.2909985277179347e-06 1.0445772255283359e-07 1.1634575468226878e-08 3.6590981458874928e-08 4.5667612011030474e-10 0.00015391619821639938 7.0450603260494027e-05 2.6355904239605509e-05 0.00014045666395491198 8.9179988054358458e-05 2.668278274914003e-05 0.00032731725695303603 0.0022005736005506395 1.8755039425128898e-05 0.0029538966226704873 0.010820450467951836 0.00011822554732653555 4.4540326413927473e-06 -2.0273734031960157e-06 -8.1556642792206085e-07 -1.7782839561356206e-08 3.0154785129451994e-08 3.667696296450078e-09 0.00017401610397799848 0.00018705211874168816 0.00010033429121629731 0.00014621392729136367 0.00020948544565366656 0.00010114826278730152 2.1443137968033931e-05 1.7655757929154496e-05 0.001267729477946909 0.00015059828618843344 0.00011822554732653555 0.0055765334401990984 1.1013160576330035e-06 -1.0088574257788578e-06 -1.0961393002398403e-07 1.8637431860427857e-09 1.5312453369595839e-08 3.2583612666746484e-10 3.6917601363854277e-06 4.0897525574045234e-06 -2.4921569959613943e-06 3.0462239662268385e-06 4.4678089343898683e-06 2.1691496353306824e-06 -2.3597143001486444e-07 3.1281479923900358e-07 4.5968173799619698e-07 -2.6950965138518528e-06 4.4540326413927473e-06 1.1013160576330035e-06 3.4247221086581215e-06 -6.5891096198150198e-08 -1.187155203932947e-08 -2.1047558332211635e-08 4.5418772101169739e-09 4.9683278470875706e-11 -1.8711916522636576e-08 -2.2622656198800191e-08 -9.4311040824366266e-09 -1.5400373926889885e-08 -2.5140465461497681e-08 -4.6779374320385916e-09 -2.9741917115125317e-07 -1.5012792304465173e-07 -4.7184537272925347e-07 -3.2909985277179347e-06 -2.0273734031960157e-06 -1.0088574257788578e-06 -6.5891096198150198e-08 2.7149352451710811e-06 7.8258829819440609e-09 -7.5838761822832311e-10 -4.0630668458863094e-08 2.182671615426844e-10 4.9921698727328337e-08 3.448164264717186e-08 1.9429585390713286e-08 4.4425236541581794e-08 4.1186405868944011e-08 1.4371428402872669e-08 9.7966640722376522e-08 -2.8812862283482996e-07 -4.5523729647643344e-08 1.0445772255283359e-07 -8.1556642792206085e-07 -1.0961393002398403e-07 -1.187155203932947e-08 7.8258829819440609e-09 3.014322181734162e-06 -1.2908373390480706e-12 -3.1928208071312328e-10 -2.9578396566249657e-08 -8.0321909476482999e-09 -1.5523546607456403e-08 -6.3644223888952986e-10 -5.8602056426427837e-09 -1.6653232158043849e-08 -1.1790315830824377e-09 2.1208513955816369e-09 -2.5530828508678023e-09 -1.2926610506547117e-09 1.1634575468226878e-08 -1.7782839561356206e-08 1.8637431860427857e-09 -2.1047558332211635e-08 -7.5838761822832311e-10 -1.2908373390480706e-12 1.4050409667273109e-07 2.3134995379579986e-10 -1.0183564798966984e-11 5.6081121799700914e-10 3.6452506447547404e-09 -2.031496723107663e-11 -1.8652785264268853e-10 3.6442353976070112e-09 3.998341940603152e-10 2.5997265115716957e-09 2.1325162410567553e-09 7.6217213133024349e-09 3.6590981458874928e-08 3.0154785129451994e-08 1.5312453369595839e-08 4.5418772101169739e-09 -4.0630668458863094e-08 -3.1928208071312328e-10 2.3134995379579986e-10 1.4357264987777869e-07 2.0860137790629101e-12 -1.9743536842213233e-08 -4.5985801264556568e-09 -8.2796884336933679e-10 -1.9262466674324068e-08 -8.3772533955529158e-09 -2.83116437057Line 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,66 @@
timestamp,gx,gy,gz,ax,ay,az
72.980000000000004,-7.8354344495958116e-05,0.0095295871084581964,-0.40739038834408964,-0.041949331379137061,-0.40863398003707235,9.8029440637868142
72.989999999999995,-7.3445220699919602e-05,0.0095113057692195364,-0.40655347375757722,-0.039464776810238023,-0.40787204291537943,9.802970698353878
73,-6.8033195655882233e-05,0.0098425386307416651,-0.42062532687378923,-1.3161440472412049,0.16967734403580129,9.8164590321196279
73.010000000000005,-6.3597823361189864e-05,0.0098286904958939207,-0.4199872868871603,-0.034141829697482876,-0.40945695897781187,9.8029496912850789
73.019999999999996,-5.9341521983073166e-05,0.0098168195913204692,-0.41943156805504295,-0.031546239725835791,-0.40873087065589297,9.8029742104844022
73.030000000000001,-5.5283234408234081e-05,0.0098068675357802157,-0.41896020205728984,-0.02894551323978679,-0.40801612392929887,9.8029980776249648
73.040000000000006,-5.1615350498180257e-05,0.0097014442445658815,-0.41442021007447988,0.35012569403667682,-0.57895913734330717,9.7990144597578244
73.049999999999997,0.010749540989019113,0.023703760187714196,-0.42430441883196418,-0.11473139056687723,-1.2961638708162919,9.7374199952169338
73.060000000000002,0.024303927187207697,0.040879816859937128,-0.42559991237085804,-0.11327635071346677,-1.2928375708421962,9.7374869126916384
73.069999999999993,0.011412485762278794,0.024264627647123997,-0.42690041610405216,0.07181388081345752,-0.29356281998120104,9.8063506255141295
73.079999999999998,0.011295930155629234,0.024014880793753864,-0.42820673267455744,0.070551367013256525,-0.29155143514622267,9.8064053609436499
73.090000000000003,0.011183363015874911,0.023771824625249252,-0.4295188125035202,0.069293193095837022,-0.28955419304502961,9.806459106887063
73.099999999999994,0.011349343630145552,0.023428029971142277,-0.40965036640913116,0.8281804914627362,-0.74377350931533792,9.7919120325237081
73.109999999999999,0.011239564517979195,0.023191634279775646,-0.41084419631700425,0.062884985538621901,-0.28317107779209555,9.8066250865740248
73.120000000000005,0.011133353776816027,0.022961275854002344,-0.41204619386088653,0.061633262867204719,-0.2812335932141441,9.8066751868936297
73.129999999999995,0.011030729056048787,0.022736898797387675,-0.41325344136489545,0.060385529321138373,-0.27930995565973848,9.8067243829796755
73.140000000000001,0.011009118823154775,0.022477589753996052,-0.40764763612085608,0.73902402991684912,-0.68217803029561108,9.7972592354529766
73.150000000000006,0.010911927208145267,0.022262952080531619,-0.40882478462142591,0.056855632474657011,-0.27486972319131597,9.8068356450403389
73.159999999999997,0.0011274837720274869,0.0096627950295530875,-0.41000923225785857,-0.59716098488484803,0.99474275639518506,9.9966213998068234
73.170000000000002,0.014424957123130768,0.026625172415456429,-0.41119682285533699,-0.096278728185410153,-1.2796255714939075,9.7393101514228846
73.180000000000007,0.027789354319285468,0.043528158300441842,-0.41239166812700828,-0.09541531211295326,-1.2760540185785516,9.7393508281239285
73.189999999999998,0.041241544356000713,0.060397187554580921,-0.41359304209948777,-0.095928208106676072,-1.2715840444755129,9.7393222843429612
73.200000000000003,0.056096268276119438,0.079154014092196731,-0.42882841160407531,-0.37496325908254702,-1.1245738899271704,9.7200666981755059
73.209999999999994,0.069771135804016574,0.095975899158274591,-0.43012831949445679,-0.099376497938928374,-1.260096442126009,9.7391313347710557
73.219999999999999,0.083602924510002563,0.11284191224767212,-0.43143312218211588,-0.10404648846002076,-1.2527028069300319,9.7388717949879915
73.230000000000004,0.097576154389577702,0.1297292978229892,-0.43265617490999292,-0.10193310607482825,-1.2463394403026862,9.7392105327075242
73.239999999999995,0.10284555420217026,0.13547804755532483,-0.45082200125836597,1.7493305204857117,-2.2058649128626109,9.8926098286351003
73.25,0.11718256848883389,0.15255198489044203,-0.45242543218879611,-0.11573071861390831,-1.2283726625084974,9.7396514667232577
73.260000000000005,0.13172216874918213,0.16971541915165328,-0.45387565352792597,-0.13100471438432626,-1.2148573787767349,9.7380098279116929
73.269999999999996,0.14651888968594512,0.18702855363576426,-0.45533576667306319,-0.14153514855913343,-1.2027668920853274,9.7373371381992744
73.280000000000001,0.16159635833286834,0.20451668446936047,-0.45680629260130595,-0.15347071295778156,-1.1895657968484012,9.7365366560660682
73.290000000000006,0.17697857439565889,0.22220474901567216,-0.45828815603846612,-0.16681668041367642,-1.1752044487194755,9.7356001897313185
73.299999999999997,0.19317938387111885,0.24096209442295696,-0.44330059132484445,-0.32601790288839161,-1.0814763533931744,9.7179752444769445
73.310000000000002,0.20924681156617111,0.2591997520549254,-0.44470322812392088,-0.20005417423733532,-1.1427413633144983,9.7330382921714751
73.319999999999993,0.21799100295136525,0.27313151403498587,-0.43980839089244594,-0.21007216449068022,-1.0025491156634148,9.7454605177780973
73.329999999999998,0.23288777627506119,0.28981750868208533,-0.44127550976639796,-0.22918030374248341,-0.98393951018281656,9.7439637648319231
73.340000000000003,0.24458329896663189,0.30301441633392945,-0.41276865111697753,2.5259868908446221,1.5417214323607373,9.8767183112935903
73.349999999999994,0.04670193778725152,0.089972856964108353,-0.33938019711657563,-1.8581802015841355,4.2524418790403562,5.0166236830827415
73.359999999999999,-0.023033935035377841,-0.044325621378972835,-0.25668604600173428,-2.4445259469386813,5.6563400047690697,6.5398699530043114
73.370000000000005,-0.11548343221942599,-0.16354870515891556,-0.39319706972899976,-4.0700637614422241,-16.712599868001288,31.415677482000284
73.379999999999995,-0.10816181034319979,-0.1538397404140206,-0.42195887516994757,-0.24592455318405387,-1.1445999717616107,9.7401309387465353
73.390000000000001,-0.093391386527653858,-0.13368654534171145,-0.42320449357488288,-0.23155778985928718,-1.1493817872544265,9.7413798757177315
73.400000000000006,-0.084723749092420919,-0.12032911328889175,-0.38509361277589499,0.93222191855265923,-1.6405616540193313,9.8661844224595807
73.409999999999997,-0.07001750024545815,-0.10062080805496776,-0.38612060666621112,-0.21128500605782019,-1.154742724074667,9.7426710011034974
73.420000000000002,-0.055373222601836629,-0.08114331114713795,-0.3871575638424587,-0.20141361068485586,-1.1570598987616196,9.7434584692680009
73.430000000000007,-0.040768607507474686,-0.061867670724642519,-0.38819835455162177,-0.19308418516556647,-1.158355767869238,9.7441003166961409
73.439999999999998,-0.029559138861381382,-0.04635890691270271,-0.35746102627438814,0.45053145277940698,-1.4115767250331073,9.807803517919286
73.450000000000003,-0.014895278490932962,-0.027306014586986567,-0.35834076391564817,-0.18416775203970459,-1.1572689145193358,9.7445953836794494
73.459999999999994,-0.00020511751773792794,-0.0083598975532057015,-0.35922913558038883,-0.1780823996002367,-1.1512554001287785,9.7448560762734751
73.469999999999999,0.017576967131798776,0.014387198741614459,-0.36012131810905157,0.12000139884387431,-0.53074901562916732,9.7439790888988966
73.480000000000004,0.035455749590555974,0.037087097815893144,-0.36101644273562561,0.11596641417312487,-0.53172432874625919,9.7436965220290936
73.489999999999995,0.051139603805240991,0.056629455590295141,-0.36428063944003952,0.081754199690666607,-0.51300593922714532,9.7533136220894736
73.5,0.062949892556653259,0.07255574335997958,-0.30458072326919639,5.3607773514998627,4.8651334266379376,9.9672454470668104
73.510000000000005,0.080093947171883478,0.093774571062345477,-0.3052256501626589,0.074807149362320746,-0.47877550007980313,9.751305284643589
73.519999999999996,0.097420639914153062,0.11507873598934916,-0.3058964247111195,0.064973701725612065,-0.47475406283817656,9.7502222255262012
73.530000000000001,0.11495685821268421,0.13649546381171412,-0.3065837564438485,0.053370590896538506,-0.46965324624279176,9.7489145355568247
73.540000000000006,0.29723332159126603,0.37461955584236989,-0.22351489315656864,-12.788428419911225,-5.9459184533471117,8.911534997472458
73.549999999999997,-0.0066481793987961044,0.20825765418887801,-0.2226766795842833,-3.7620317988710532,1.7741290509259613,5.4903190207580019
73.560000000000002,0.0062837318174231993,0.12637890870908894,-0.16769073775878729,-6.6064098596231249,0.41758271667715674,8.3696263076125792
73.569999999999993,0.0040442971016930226,0.056573159912984013,-0.10212823950165814,-6.7379210190338803,0.15044657152919713,8.4427996491416533
73.579999999999998,0.0016495690894367616,-0.013163794294091001,-0.036572344137316609,-6.7375967545183801,0.15443064835544271,8.4423661799084453
73.590000000000003,0.00022069049724417894,-0.08737929976847815,1.7012733126897927e-05,-6.2479265595145961,1.5459013180568317,8.2960183842218616
73.599999999999994,4.9683713493571535e-05,-0.16736300845426663,1.5905618074494828e-05,-6.2355129994503384,1.546419311232109,8.3003729570604605
73.609999999999999,-0.00012075011793151458,-0.2476389531478862,1.4609841830961557e-05,-6.2108012231131546,1.5441335599584702,8.3018758052246326
73.620000000000005,-0.09678470505438122,-0.12357589020282497,-2.1495070713531232e-07,0.10627007267836641,-0.31333170698237695,9.7335273902384483
1 timestamp gx gy gz ax ay az
2 72.980000000000004 -7.8354344495958116e-05 0.0095295871084581964 -0.40739038834408964 -0.041949331379137061 -0.40863398003707235 9.8029440637868142
3 72.989999999999995 -7.3445220699919602e-05 0.0095113057692195364 -0.40655347375757722 -0.039464776810238023 -0.40787204291537943 9.802970698353878
4 73 -6.8033195655882233e-05 0.0098425386307416651 -0.42062532687378923 -1.3161440472412049 0.16967734403580129 9.8164590321196279
5 73.010000000000005 -6.3597823361189864e-05 0.0098286904958939207 -0.4199872868871603 -0.034141829697482876 -0.40945695897781187 9.8029496912850789
6 73.019999999999996 -5.9341521983073166e-05 0.0098168195913204692 -0.41943156805504295 -0.031546239725835791 -0.40873087065589297 9.8029742104844022
7 73.030000000000001 -5.5283234408234081e-05 0.0098068675357802157 -0.41896020205728984 -0.02894551323978679 -0.40801612392929887 9.8029980776249648
8 73.040000000000006 -5.1615350498180257e-05 0.0097014442445658815 -0.41442021007447988 0.35012569403667682 -0.57895913734330717 9.7990144597578244
9 73.049999999999997 0.010749540989019113 0.023703760187714196 -0.42430441883196418 -0.11473139056687723 -1.2961638708162919 9.7374199952169338
10 73.060000000000002 0.024303927187207697 0.040879816859937128 -0.42559991237085804 -0.11327635071346677 -1.2928375708421962 9.7374869126916384
11 73.069999999999993 0.011412485762278794 0.024264627647123997 -0.42690041610405216 0.07181388081345752 -0.29356281998120104 9.8063506255141295
12 73.079999999999998 0.011295930155629234 0.024014880793753864 -0.42820673267455744 0.070551367013256525 -0.29155143514622267 9.8064053609436499
13 73.090000000000003 0.011183363015874911 0.023771824625249252 -0.4295188125035202 0.069293193095837022 -0.28955419304502961 9.806459106887063
14 73.099999999999994 0.011349343630145552 0.023428029971142277 -0.40965036640913116 0.8281804914627362 -0.74377350931533792 9.7919120325237081
15 73.109999999999999 0.011239564517979195 0.023191634279775646 -0.41084419631700425 0.062884985538621901 -0.28317107779209555 9.8066250865740248
16 73.120000000000005 0.011133353776816027 0.022961275854002344 -0.41204619386088653 0.061633262867204719 -0.2812335932141441 9.8066751868936297
17 73.129999999999995 0.011030729056048787 0.022736898797387675 -0.41325344136489545 0.060385529321138373 -0.27930995565973848 9.8067243829796755
18 73.140000000000001 0.011009118823154775 0.022477589753996052 -0.40764763612085608 0.73902402991684912 -0.68217803029561108 9.7972592354529766
19 73.150000000000006 0.010911927208145267 0.022262952080531619 -0.40882478462142591 0.056855632474657011 -0.27486972319131597 9.8068356450403389
20 73.159999999999997 0.0011274837720274869 0.0096627950295530875 -0.41000923225785857 -0.59716098488484803 0.99474275639518506 9.9966213998068234
21 73.170000000000002 0.014424957123130768 0.026625172415456429 -0.41119682285533699 -0.096278728185410153 -1.2796255714939075 9.7393101514228846
22 73.180000000000007 0.027789354319285468 0.043528158300441842 -0.41239166812700828 -0.09541531211295326 -1.2760540185785516 9.7393508281239285
23 73.189999999999998 0.041241544356000713 0.060397187554580921 -0.41359304209948777 -0.095928208106676072 -1.2715840444755129 9.7393222843429612
24 73.200000000000003 0.056096268276119438 0.079154014092196731 -0.42882841160407531 -0.37496325908254702 -1.1245738899271704 9.7200666981755059
25 73.209999999999994 0.069771135804016574 0.095975899158274591 -0.43012831949445679 -0.099376497938928374 -1.260096442126009 9.7391313347710557
26 73.219999999999999 0.083602924510002563 0.11284191224767212 -0.43143312218211588 -0.10404648846002076 -1.2527028069300319 9.7388717949879915
27 73.230000000000004 0.097576154389577702 0.1297292978229892 -0.43265617490999292 -0.10193310607482825 -1.2463394403026862 9.7392105327075242
28 73.239999999999995 0.10284555420217026 0.13547804755532483 -0.45082200125836597 1.7493305204857117 -2.2058649128626109 9.8926098286351003
29 73.25 0.11718256848883389 0.15255198489044203 -0.45242543218879611 -0.11573071861390831 -1.2283726625084974 9.7396514667232577
30 73.260000000000005 0.13172216874918213 0.16971541915165328 -0.45387565352792597 -0.13100471438432626 -1.2148573787767349 9.7380098279116929
31 73.269999999999996 0.14651888968594512 0.18702855363576426 -0.45533576667306319 -0.14153514855913343 -1.2027668920853274 9.7373371381992744
32 73.280000000000001 0.16159635833286834 0.20451668446936047 -0.45680629260130595 -0.15347071295778156 -1.1895657968484012 9.7365366560660682
33 73.290000000000006 0.17697857439565889 0.22220474901567216 -0.45828815603846612 -0.16681668041367642 -1.1752044487194755 9.7356001897313185
34 73.299999999999997 0.19317938387111885 0.24096209442295696 -0.44330059132484445 -0.32601790288839161 -1.0814763533931744 9.7179752444769445
35 73.310000000000002 0.20924681156617111 0.2591997520549254 -0.44470322812392088 -0.20005417423733532 -1.1427413633144983 9.7330382921714751
36 73.319999999999993 0.21799100295136525 0.27313151403498587 -0.43980839089244594 -0.21007216449068022 -1.0025491156634148 9.7454605177780973
37 73.329999999999998 0.23288777627506119 0.28981750868208533 -0.44127550976639796 -0.22918030374248341 -0.98393951018281656 9.7439637648319231
38 73.340000000000003 0.24458329896663189 0.30301441633392945 -0.41276865111697753 2.5259868908446221 1.5417214323607373 9.8767183112935903
39 73.349999999999994 0.04670193778725152 0.089972856964108353 -0.33938019711657563 -1.8581802015841355 4.2524418790403562 5.0166236830827415
40 73.359999999999999 -0.023033935035377841 -0.044325621378972835 -0.25668604600173428 -2.4445259469386813 5.6563400047690697 6.5398699530043114
41 73.370000000000005 -0.11548343221942599 -0.16354870515891556 -0.39319706972899976 -4.0700637614422241 -16.712599868001288 31.415677482000284
42 73.379999999999995 -0.10816181034319979 -0.1538397404140206 -0.42195887516994757 -0.24592455318405387 -1.1445999717616107 9.7401309387465353
43 73.390000000000001 -0.093391386527653858 -0.13368654534171145 -0.42320449357488288 -0.23155778985928718 -1.1493817872544265 9.7413798757177315
44 73.400000000000006 -0.084723749092420919 -0.12032911328889175 -0.38509361277589499 0.93222191855265923 -1.6405616540193313 9.8661844224595807
45 73.409999999999997 -0.07001750024545815 -0.10062080805496776 -0.38612060666621112 -0.21128500605782019 -1.154742724074667 9.7426710011034974
46 73.420000000000002 -0.055373222601836629 -0.08114331114713795 -0.3871575638424587 -0.20141361068485586 -1.1570598987616196 9.7434584692680009
47 73.430000000000007 -0.040768607507474686 -0.061867670724642519 -0.38819835455162177 -0.19308418516556647 -1.158355767869238 9.7441003166961409
48 73.439999999999998 -0.029559138861381382 -0.04635890691270271 -0.35746102627438814 0.45053145277940698 -1.4115767250331073 9.807803517919286
49 73.450000000000003 -0.014895278490932962 -0.027306014586986567 -0.35834076391564817 -0.18416775203970459 -1.1572689145193358 9.7445953836794494
50 73.459999999999994 -0.00020511751773792794 -0.0083598975532057015 -0.35922913558038883 -0.1780823996002367 -1.1512554001287785 9.7448560762734751
51 73.469999999999999 0.017576967131798776 0.014387198741614459 -0.36012131810905157 0.12000139884387431 -0.53074901562916732 9.7439790888988966
52 73.480000000000004 0.035455749590555974 0.037087097815893144 -0.36101644273562561 0.11596641417312487 -0.53172432874625919 9.7436965220290936
53 73.489999999999995 0.051139603805240991 0.056629455590295141 -0.36428063944003952 0.081754199690666607 -0.51300593922714532 9.7533136220894736
54 73.5 0.062949892556653259 0.07255574335997958 -0.30458072326919639 5.3607773514998627 4.8651334266379376 9.9672454470668104
55 73.510000000000005 0.080093947171883478 0.093774571062345477 -0.3052256501626589 0.074807149362320746 -0.47877550007980313 9.751305284643589
56 73.519999999999996 0.097420639914153062 0.11507873598934916 -0.3058964247111195 0.064973701725612065 -0.47475406283817656 9.7502222255262012
57 73.530000000000001 0.11495685821268421 0.13649546381171412 -0.3065837564438485 0.053370590896538506 -0.46965324624279176 9.7489145355568247
58 73.540000000000006 0.29723332159126603 0.37461955584236989 -0.22351489315656864 -12.788428419911225 -5.9459184533471117 8.911534997472458
59 73.549999999999997 -0.0066481793987961044 0.20825765418887801 -0.2226766795842833 -3.7620317988710532 1.7741290509259613 5.4903190207580019
60 73.560000000000002 0.0062837318174231993 0.12637890870908894 -0.16769073775878729 -6.6064098596231249 0.41758271667715674 8.3696263076125792
61 73.569999999999993 0.0040442971016930226 0.056573159912984013 -0.10212823950165814 -6.7379210190338803 0.15044657152919713 8.4427996491416533
62 73.579999999999998 0.0016495690894367616 -0.013163794294091001 -0.036572344137316609 -6.7375967545183801 0.15443064835544271 8.4423661799084453
63 73.590000000000003 0.00022069049724417894 -0.08737929976847815 1.7012733126897927e-05 -6.2479265595145961 1.5459013180568317 8.2960183842218616
64 73.599999999999994 4.9683713493571535e-05 -0.16736300845426663 1.5905618074494828e-05 -6.2355129994503384 1.546419311232109 8.3003729570604605
65 73.609999999999999 -0.00012075011793151458 -0.2476389531478862 1.4609841830961557e-05 -6.2108012231131546 1.5441335599584702 8.3018758052246326
66 73.620000000000005 -0.09678470505438122 -0.12357589020282497 -2.1495070713531232e-07 0.10627007267836641 -0.31333170698237695 9.7335273902384483
@@ -0,0 +1,7 @@
Isolated Gazebo Python launch, cylinder centered at (-4,-1.5), radius 0.22 m.
The leg from (0,0) back to (-5,3) stopped after rejections at 73.3 and 73.4 s
with registration stage FINAL_FUSION and innovation above the rank-six gate.
The checkpoint is the live prediction at sim 73.0 s. The estimate was low by
0.075 m at 73.3 s. Predicted and true sensor poses had 513 and 545 inliers.
Uses return_contact/map.flmap. Ground truth only scores the result.
The original unrecorded zero-correspondence failure is a separate symptom.
@@ -0,0 +1,8 @@
timestamp,file
73,716.flpc
73.099999999999994,717.flpc
73.200000000000003,718.flpc
73.299999999999997,719.flpc
73.400000000000006,720.flpc
73.5,721.flpc
73.599999999999994,722.flpc
1 timestamp file
2 73 716.flpc
3 73.099999999999994 717.flpc
4 73.200000000000003 718.flpc
5 73.299999999999997 719.flpc
6 73.400000000000006 720.flpc
7 73.5 721.flpc
8 73.599999999999994 722.flpc
@@ -0,0 +1,64 @@
72.986000000000004 -1.1827268115237362 -1.5545798885105371 0.0058503683128641685 0.0031301075244346047 -0.011291668895969408 0.96303472306647764 -0.26912231941758785
72.995999999999995 -1.1871888648243818 -1.5576408724309503 0.0058506913738757497 0.0031073608787444322 -0.011298428291316116 0.96357973301227318 -0.2671643463385629
73.006 -1.1916342342322537 -1.5606819444765541 0.0058509988583626453 0.0030839596115858335 -0.011305291957612885 0.96413552600730001 -0.26515159259844956
73.016000000000005 -1.1960801508860572 -1.5637051949047489 0.0058512915210192735 0.0030604007959725938 -0.011312122327296068 0.96469019752111762 -0.26312638150152751
73.025999999999996 -1.2005324013228871 -1.5667114803470656 0.0058515701113706535 0.0030368478865988595 -0.01131887567226837 0.96523991156191746 -0.26110261150814101
73.036000000000001 -1.2049911000891447 -1.569700966017002 0.0058518353561440436 0.0030132968344191305 -0.011325554296524652 0.9657847915226504 -0.25907988792188191
73.046000000000006 -1.2094761555512541 -1.5726563636090436 0.0058514931440729551 0.0029775415743041557 -0.011327041109622219 0.96632793569678654 -0.25704698612872584
73.055999999999997 -1.2139813859319666 -1.5755217306559217 0.0058467866734837094 0.0028531614658296417 -0.011290521870982027 0.9668725771097133 -0.25499373172443324
73.066000000000003 -1.2184970583372341 -1.5783420770566474 0.0058411485173472224 0.0027101286142647055 -0.011245432738640568 0.9674146672986218 -0.25293290996015494
73.075999999999993 -1.2230230999073919 -1.581174339566185 0.0058372459161947837 0.0026026102969416822 -0.011215152911073112 0.96795363620886388 -0.25086491367838176
73.085999999999999 -1.2275594802434509 -1.584004724373161 0.0058334010181124874 0.0024965007395751663 -0.011185053184934762 0.96848978920550355 -0.24878944968383798
73.096000000000004 -1.2321061458005205 -1.586833273349284 0.0058296125281075833 0.0023917628099110935 -0.011155125972395104 0.96902309106103679 -0.24670648881963916
73.105999999999995 -1.2366770672797653 -1.5896597593421413 0.0058257933189042521 0.0022875676175172907 -0.011124399978516344 0.96953274426748903 -0.24469832968916033
73.116 -1.2412612759579238 -1.5924844438350985 0.0058220077784071631 0.0021845019836098339 -0.011093611178925624 0.97003453494922343 -0.24270385400305933
73.126000000000005 -1.2458551695513467 -1.5953074384597066 0.005818276249389181 0.0020827332471716501 -0.011062995599026178 0.9705336511324667 -0.24070252256692404
73.135999999999996 -1.2504586966141451 -1.5981287852739068 0.0058145975239704299 0.0019822282630259577 -0.011032546067196629 0.97103006156964311 -0.23869430916224993
73.146000000000001 -1.255084419744052 -1.6009479136873122 0.0058109448845094034 0.001882740217275448 -0.011001970759730145 0.97151727032669921 -0.23670573585284282
73.156000000000006 -1.2597227209909205 -1.6037653292807263 0.0058073367000094668 0.0017844065781903173 -0.010971482741895466 0.97200017467302524 -0.23471706988460922
73.165999999999997 -1.2643703716012211 -1.6065692004929799 0.0058054351471337629 0.0017207138821939841 -0.010956429657944052 0.97248007250003377 -0.23272194650100214
73.176000000000002 -1.2690273659231286 -1.6092870412226157 0.0057995853584831784 0.0015774642266509142 -0.010904630443552707 0.9729579453695304 -0.23071939056742757
73.186000000000007 -1.2736936294264443 -1.6119132852962943 0.0057888903842487011 0.0013366454841123518 -0.010807168976942191 0.9734338788669914 -0.22870920827880409
73.195999999999998 -1.2783690768235658 -1.6144484411759916 0.0057733570847300335 0.00099838714014245981 -0.010663363271679079 0.97390776174996807 -0.22669134855574477
73.206000000000003 -1.2830459816176745 -1.6168935041479873 0.0057526303709198659 0.00055478348460317756 -0.010469086626791425 0.97439213585460505 -0.22461089916828808
73.215999999999994 -1.2877302190973396 -1.6192486817193614 0.0057269994531547698 1.1858640024756509e-05 -0.010226038876597652 0.97487711803995747 -0.22250850031037867
73.225999999999999 -1.2924236269314422 -1.6215143558841598 0.0056965603103861003 -0.00062870174059144587 -0.0099341254176952484 0.97535929519869891 -0.2203977385451229
73.236000000000004 -1.2971263107162498 -1.6236910792608883 0.0056613326323830615 -0.0013670999905177658 -0.0095924540980015325 0.97583833270215847 -0.21827886817341038
73.245999999999995 -1.3018883834526711 -1.6257740491873514 0.0056239117144352598 -0.0021517079689924931 -0.0092250211793455002 0.97632841537557724 -0.2160858497617815
73.256 -1.3066724522289066 -1.6277675579927218 0.005582366458046736 -0.0030220127470465268 -0.0088121498758130402 0.97681841066491237 -0.21386679508422426
73.266000000000005 -1.3114658236480086 -1.6296735204577222 0.005536059271095733 -0.0039917655401962571 -0.0083463838234752209 0.97730427806235165 -0.2116382568581803
73.275999999999996 -1.3162683485699671 -1.6314924744494148 0.0054849957814838224 -0.0050619140072993641 -0.007826374711552871 0.97778560591429009 -0.2094001761037505
73.286000000000001 -1.3210799159925637 -1.6332249663976133 0.0054291888087800583 -0.0062335075109966193 -0.0072506941703858385 0.97826195609988331 -0.20715239816566938
73.296000000000006 -1.3259004157127494 -1.6348715556793953 0.0053686555042825965 -0.0075077337713179019 -0.0066178173011011698 0.9787328436423689 -0.20489475152748682
73.305999999999997 -1.3307258730288571 -1.6364331023120495 0.0053031983619743518 -0.0088901447072203075 -0.0059243973886139627 0.97918432592740234 -0.20269169371428425
73.316000000000003 -1.3355688420359801 -1.6379338642402002 0.0052066599772398357 -0.010349309723247574 -0.0051351687533685254 0.97962303805373774 -0.20051240646027871
73.325999999999993 -1.3404288287396919 -1.6393094520762683 0.0051431728984243112 -0.01191358322865199 -0.0043528051038197648 0.98005172552508568 -0.19833742692110404
73.335999999999999 -1.3452969908923822 -1.6406113168530503 0.0050762464459957867 -0.013574640558649069 -0.003513638653623339 0.9804731942281727 -0.19615223393354278
73.346000000000004 -1.3501895167318128 -1.6419798548380817 0.005108738976746104 -0.015112268455780108 -0.002745964899443495 0.98085529585059306 -0.19413131540464329
73.355999999999995 -1.3549640787730097 -1.643812391091483 0.0052728105183241208 -0.015456375536794619 -0.0026939842015352993 0.98116484973653617 -0.19253410229325085
73.366 -1.3595536153661432 -1.6459691252064099 0.0050727415228652038 -0.015103014156831235 -0.0028926586344415043 0.98142075506854209 -0.19125070721462972
73.376000000000005 -1.3644408608921856 -1.6481096591831021 0.0050303164843351379 -0.014129238367996394 -0.0031990403064940261 0.98181768324296859 -0.18927273347122053
73.385999999999996 -1.3693679054219983 -1.6500463243136565 0.0050716421136637185 -0.013287502301379286 -0.0036035105415935555 0.98222354639289056 -0.18720940656318727
73.396000000000001 -1.3743027258731864 -1.6518878352927291 0.0051078334634670477 -0.012558165495312168 -0.0039544144955527879 0.9826243984334011 -0.18513764254949971
73.406000000000006 -1.3792750390455779 -1.653630489318143 0.0051402522403393063 -0.011910411700310231 -0.0042684389015000919 0.98299183291174042 -0.18321293336249561
73.415999999999997 -1.3842618856175508 -1.6552783728159306 0.0051678629559868527 -0.011365311066434713 -0.0045325318919417308 0.98334805810745662 -0.18131983475424274
73.426000000000002 -1.3892557057606063 -1.6568332167167177 0.0051903275164664614 -0.010928970993995174 -0.0047423280642563716 0.98370049479445809 -0.1794196323111874
73.436000000000007 -1.394256443797167 -1.6582956225633008 0.0052076506453389328 -0.010600293412376642 -0.0048976108430821763 0.98404929433243071 -0.17751234749010111
73.445999999999998 -1.3992803525324311 -1.6596636580785431 0.0052205679673638641 -0.010362552415903985 -0.0050074287281092989 0.9843722748967384 -0.17572355442450174
73.456000000000003 -1.4043146774059381 -1.6609397975496776 0.0052285160752110005 -0.010227302423756654 -0.0050641691906889597 0.98468660432798594 -0.17395990265737007
73.465999999999994 -1.4093552246548775 -1.6621424203794255 0.0052310615029692153 -0.010203195071777764 -0.0050622497105420518 0.98499790146017485 -0.17219001875035322
73.475999999999999 -1.4144019162987285 -1.6633231241499224 0.0052274511189123575 -0.01030546793865101 -0.0049927276760517187 0.98530606351375705 -0.17041370603311956
73.486000000000004 -1.4194603931236236 -1.6644842632343171 0.0052180160450279768 -0.010528061320118303 -0.0048578627442221181 0.98561223941979692 -0.16862406293376736
73.495999999999995 -1.4245287535741527 -1.6656258096952028 0.0052034305511925519 -0.01086466396589038 -0.0046597265761129372 0.98591593499195707 -0.16682330518869151
73.506 -1.4296621409454648 -1.6668540088835526 0.0051845470553112281 -0.011296878445963545 -0.0044096432938098198 0.98617617643336519 -0.16525581568788048
73.516000000000005 -1.4348154349037505 -1.6680920915855586 0.0051606356239071475 -0.011842531349017563 -0.0040958759277063429 0.98642343956985878 -0.16374301853453616
73.525999999999996 -1.4399737281517972 -1.6693138150216535 0.0051314803138102659 -0.012507535848080481 -0.0037139381697808187 0.98666753687285635 -0.1622249669179523
73.536000000000001 -1.4448108571510392 -1.6703872549451679 0.0050748358390243983 -0.013654117135374278 -0.0030522962961160565 0.98687800113934654 -0.16086037249671561
73.546000000000006 -1.448396490965824 -1.6708636848531406 0.005251067238020434 -0.015408964009291733 -0.002318675811017387 0.98703020248953166 -0.15977661576124966
73.555999999999997 -1.4515248319730381 -1.6713613042405748 0.0055058843437679012 -0.016317612017665597 -0.0026360788593341013 0.98719442384803147 -0.15866302704045965
73.566000000000003 -1.4541058422468496 -1.6717288667858907 0.0056966781063328351 -0.016875331532463796 -0.0027096104034522975 0.98730797652805991 -0.15789503057790946
73.575999999999993 -1.4561705707068855 -1.6719405539160637 0.005769558057817115 -0.017087362353195943 -0.002733171804277935 0.98737458440055792 -0.15745469792776765
73.585999999999999 -1.4577188766658054 -1.6719969350138024 0.0057247128990593867 -0.016953677612950045 -0.0027079798480792918 0.98739581231247131 -0.15733642136623532
73.596000000000004 -1.4587606276285694 -1.6719950828801873 0.0055514879861516108 -0.016443476617033503 -0.0026257375244013747 0.98740443243506093 -0.15733786698310492
73.605999999999995 -1.4593019073162419 -1.6719919533146337 0.0052435932373300249 -0.015538053557393336 -0.002481383320436847 0.98741908353097274 -0.1573402844389151
73.616 -1.4593872573948983 -1.6719896736122408 0.0050093300597352768 -0.014500939174517082 -0.0025331301065374453 0.98743382718860817 -0.1573459339753602
@@ -1,50 +1,151 @@
#include "field_localization/core/dataset.hpp"
#include "field_localization/core/tracking_health.hpp"
#include "test_util.hpp"
#include <Eigen/Eigenvalues>
#include <cstdio>
#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);
namespace {
struct Report {
int scans{0};
int full{0};
int innovation_rejections{0};
double maximum_rotation_error{0};
double maximum_correction_gap{0};
double maximum_position_error{0};
double maximum_position_three_sigma{0};
};
Report evaluate_recording(const std::filesystem::path &directory,const NoiseOptions &noise,
const std::filesystem::path &map_path,const RegistrationOptions &registration={}) {
const auto options=read_dataset_config(directory/"config.txt");
FilterSnapshot checkpoint;
auto &state=checkpoint.state;
std::ifstream input(directory/"checkpoint.txt");
input>>state.timestamp_sec;
for (auto *v:{&state.pose.translation,&state.velocity})
for (int i=0;i<3;++i) input>>(*v)[i];
for (int i=0;i<4;++i) input>>state.pose.rotation.coeffs()[i];
for (auto *v:{&state.gyro_bias,&state.accel_bias,&state.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;
std::string error;
const auto map=read_map(map_path,error);
CHECK(map.has_value());
if (!map) return {};
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);
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)) {
std::ifstream scans(directory/"scans.csv");
std::getline(scans,line);
ErrorStateFilter filter(noise);
filter.restore(checkpoint);
Report report;
TrackingHealth health;
const auto imu_from_base=inverse(options.base_from_imu);
double last_correction=-1;
auto observe_prior=[&] {
const auto &prior=filter.snapshot();
LocalizationSnapshot snapshot{compose(prior.state.pose,imu_from_base),prior,{}};
health.update(snapshot,options.base_from_imu,prior.state.timestamp_sec);
report.maximum_position_three_sigma=std::max(report.maximum_position_three_sigma,
health.position_three_sigma());
};
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;
auto a=interpolate_imu(samples,filter.snapshot().state.timestamp_sec);
CHECK(a.has_value());
if (!a) return report;
for (const auto &b:samples) {
if (b.timestamp_sec<=a->timestamp_sec || b.timestamp_sec>=cloud.timestamp_sec) continue;
CHECK(filter.propagate(*a,b));
observe_prior();
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 auto finish=interpolate_imu(samples,cloud.timestamp_sec);
CHECK(finish.has_value());
if (!finish) return report;
if (finish->timestamp_sec>a->timestamp_sec) CHECK(filter.propagate(*a,*finish));
observe_prior();
const auto result=scan_to_map(cloud,options.deskew.imu_from_sensor,*map,filter.snapshot(),
noise,registration);
++report.scans;
if (result.failure==RegistrationFailure::INNOVATION) ++report.innovation_rejections;
if (last_correction>=0)
report.maximum_correction_gap=std::max(report.maximum_correction_gap,
cloud.timestamp_sec-last_correction);
if (result.success) {
last_correction=cloud.timestamp_sec;
filter.restore(result.estimate);
++report.full;
}
const auto base=compose(filter.snapshot().state.pose,imu_from_base);
const auto gt=trajectory_pose(truth,cloud.timestamp_sec);
CHECK(gt.has_value());
if (!gt) return report;
report.maximum_position_error=std::max(report.maximum_position_error,
(base.translation-gt->translation).norm());
report.maximum_rotation_error=std::max(report.maximum_rotation_error,
log_so3(gt->rotation.conjugate()*base.rotation).norm());
const Eigen::SelfAdjointEigenSolver<Matrix18> eigen(filter.snapshot().covariance);
CHECK(eigen.info()==Eigen::Success);CHECK(eigen.eigenvalues().minCoeff()>-1e-10);
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);
std::printf("%s scale=%.2f map_sigma=%.3f FULL=%d/%d innovation_rejections=%d max_position_error=%.6f m max_prior_horizontal_3sigma=%.6f m max_rotation_error=%.6f rad max_correction_gap=%.6f s\n",
directory.filename().string().c_str(),noise.integration_error_scale,registration.map_translation_sigma,
report.full,report.scans,report.innovation_rejections,report.maximum_position_error,
report.maximum_position_three_sigma,report.maximum_rotation_error,report.maximum_correction_gap);
return report;
}
} // namespace
int main(int argc,char **argv) {
CHECK(argc==4);
if (argc!=4) return 1;
const std::filesystem::path turn=argv[1],clear_return=argv[2],cylinder_return=argv[3];
const auto turn_report=evaluate_recording(turn,{},turn/"map.flmap");
CHECK(turn_report.scans==5 && turn_report.full==5);
CHECK(turn_report.maximum_position_error<0.10);
CHECK(turn_report.maximum_rotation_error<0.02);
const auto return_map=clear_return/"map.flmap";
const auto updated=evaluate_recording(clear_return,{},return_map);
NoiseOptions previous_noise;
previous_noise.integration_error_scale=2.0;
RegistrationOptions previous_map;
previous_map.map_translation_sigma=0.02;
const auto baseline=evaluate_recording(clear_return,previous_noise,return_map,previous_map);
CHECK(updated.scans==5 && updated.full==5);
CHECK(baseline.scans==5 && baseline.full==5);
CHECK(updated.maximum_position_error<0.10);
CHECK(baseline.maximum_position_three_sigma>HealthOptions{}.position_three_sigma);
CHECK(updated.maximum_position_three_sigma<HealthOptions{}.position_three_sigma);
const auto cylinder=evaluate_recording(cylinder_return,{},return_map);
const auto previous_cylinder=evaluate_recording(cylinder_return,{},return_map,previous_map);
CHECK(cylinder.scans==7 && cylinder.full>previous_cylinder.full);
CHECK(cylinder.maximum_correction_gap<HealthOptions{}.correction_timeout);
CHECK(previous_cylinder.maximum_correction_gap>=HealthOptions{}.correction_timeout-1e-9);
CHECK(cylinder.maximum_position_error<0.10);
CHECK(previous_cylinder.innovation_rejections>=1);
return sentry_nav_test::Summary("RecordedUpdate");
}
@@ -20,6 +20,20 @@ int main() {
RegistrationOptions exact_map; exact_map.map_translation_sigma=0; exact_map.map_rotation_sigma=0;
const auto result=scan_to_map(scan,{},map,filter.snapshot(),{},exact_map);
CHECK(result.success); CHECK(result.degeneracy.dimensions==0);
CHECK(result.stage==RegistrationStage::COMPLETE);
const auto support=inspect_scan_support(scan,{},map,initial.pose,exact_map);
CHECK(support.candidate_planes<=support.sampled);
CHECK(support.candidate_planes==support.outside_support+support.plane_distance_rejected+support.inliers);
CHECK(result.initial_associations.inliers==support.inliers);
CHECK(result.last_associations.inliers==result.inliers);
auto far=initial;
far.pose.translation.x()+=20;
filter.initialize(far);
const auto unsupported=scan_to_map(scan,{},map,filter.snapshot(),{},exact_map);
CHECK(!unsupported.success);
CHECK(unsupported.stage==RegistrationStage::INITIAL_MATCH);
CHECK(unsupported.failure==RegistrationFailure::NO_CORRESPONDENCES);
CHECK(unsupported.initial_associations.sampled>0 && unsupported.initial_associations.candidate_planes==0);
const double position_error=(result.estimate.state.pose.translation-truth.translation).norm();
const double rotation_error=log_so3(truth.rotation.conjugate()*result.estimate.state.pose.rotation).norm();
std::printf("3-plane registration: translation %.9g m, rotation %.9g rad, rmse %.9g, inliers %zu\n",
@@ -51,6 +65,7 @@ int main() {
const auto rejected=scan_to_map(shifted,{},floor,confident,{},strict);
CHECK(!rejected.success);
CHECK(rejected.failure==RegistrationFailure::INNOVATION);
CHECK(rejected.stage==RegistrationStage::FINAL_FUSION);
CHECK(rejected.inliers>100);
CHECK(rejected.measurement_rank==3);
// Rotate the whole plane; verify its null space rather than an axis label.
+20 -3
View File
@@ -77,10 +77,22 @@ local function ros_common()
end
end
if not ROS then
local distro = os.getenv("ROS_DISTRO")
if distro and distro ~= "" then
local candidate = "/opt/ros/" .. distro
if os.isdir(candidate .. "/include")
and os.isdir(candidate .. "/lib") then
ROS = candidate
end
end
end
if not ROS then
raise(
"ROS installation not found. "
.. "Source ROS setup or set ROS_PREFIX."
.. "Source ROS setup or set ROS_PREFIX / ROS_DISTRO."
)
end
end
@@ -88,7 +100,7 @@ local function ros_common()
-- Resolve ROS include directories.
local script = path.join(
target:scriptdir(),
"../../tools/resolve_ros_includes.py"
"../../tools/_internal/resolve_ros_includes.py"
)
if not os.isfile(script) then
@@ -416,6 +428,11 @@ target("test_recorded_update")
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")})
local fixtures = path.join(os.projectdir(), "src/field_localization/tests/data")
target:set("runargs", {
path.join(fixtures, "turn_contact"),
path.join(fixtures, "return_contact"),
path.join(fixtures, "return_cylinder"),
})
end)
add_tests("default", {group = "unit"})
+79 -5
View File
@@ -28,6 +28,7 @@
#include <cstdlib>
#include <future>
#include <memory>
#include <optional>
#include <string>
#include <thread>
#include <vector>
@@ -37,6 +38,7 @@
#include <nav2_msgs/action/navigate_to_pose.hpp>
#include <nav_msgs/msg/occupancy_grid.hpp>
#include <geometry_msgs/msg/pose_stamped.hpp>
#include <std_msgs/msg/bool.hpp>
#include <tf2_ros/buffer.hpp>
#include <tf2_ros/transform_listener.hpp>
@@ -56,6 +58,7 @@ constexpr int kOccupiedThreshold = 65;
constexpr double kClearanceSearch = 2.0;
// 圆周率(避开 M_PI —— 严格 C++ 里它不是标准宏)。
constexpr double kPi = 3.14159265358979323846;
constexpr auto kLocalizationFreshness = 300ms;
struct Args
{
@@ -166,6 +169,14 @@ int main(int argc, char * argv[])
tf2_ros::Buffer tf_buffer(node->get_clock());
tf2_ros::TransformListener tf_listener(tf_buffer);
std::optional<std::chrono::steady_clock::time_point> last_health;
bool localization_valid = false;
auto health_sub = node->create_subscription<std_msgs::msg::Bool>(
"/field_localization/navigation_valid", rclcpp::QoS(1),
[&](const std_msgs::msg::Bool & msg) {
last_health = std::chrono::steady_clock::now();
localization_valid = msg.data;
});
// /map 是 TRANSIENT_LOCAL 发布的,用默认 QoS 会一条都收不到。
auto map_qos = rclcpp::QoS(rclcpp::KeepLast(1))
@@ -197,7 +208,7 @@ int main(int argc, char * argv[])
map_executor.remove_node(node);
if (!holder.got) {
std::printf("⚠️ 15 秒内没收到 /map,跳过预检直接发目标\n");
std::printf("⚠️ 15 秒内没收到 /map,跳过静态地图预检\n");
} else {
const auto & info = holder.last.info;
const auto & data = holder.last.data;
@@ -254,6 +265,54 @@ int main(int argc, char * argv[])
}
std::printf("✅ 动作服务器可用\n");
// Give discovery and the TF listener a bounded window before sending a goal.
// AMCL has no LIO heartbeat and uses the same fresh TF check.
auto localization_error = [&]() -> const char * {
if (last_health || health_sub->get_publisher_count() > 0) {
if (!last_health || std::chrono::steady_clock::now() - *last_health > kLocalizationFreshness) {
return "LIO 有效性心跳缺失或过期";
}
if (!localization_valid) {
return "LIO 有效性心跳为 false";
}
}
const auto now = node->now();
if (now.nanoseconds() <= 0) {
return "未收到仿真时钟";
}
try {
const auto transform = tf_buffer.lookupTransform("map", "base_link", rclcpp::Time(0));
const rclcpp::Time stamp(transform.header.stamp, now.get_clock_type());
if (stamp.nanoseconds() <= 0 ||
(now - stamp).nanoseconds() >
std::chrono::duration_cast<std::chrono::nanoseconds>(kLocalizationFreshness).count())
{
return "map → base_link TF 已过期";
}
} catch (const tf2::TransformException &) {
return "map → base_link TF 不连通";
}
return nullptr;
};
map_executor.add_node(node);
const auto localization_deadline = std::chrono::steady_clock::now() + 5s;
const char * reason = nullptr;
do {
map_executor.spin_some();
reason = localization_error();
if (reason == nullptr) {
break;
}
std::this_thread::sleep_for(20ms);
} while (rclcpp::ok() && std::chrono::steady_clock::now() < localization_deadline);
map_executor.remove_node(node);
if (reason != nullptr) {
std::printf("❌ 定位不可用:%s。未发送导航目标。\n", reason);
rclcpp::shutdown();
return 1;
}
NavigateToPose::Goal goal;
goal.pose.header.frame_id = "map";
goal.pose.header.stamp = node->now();
@@ -288,7 +347,7 @@ int main(int argc, char * argv[])
if (rclcpp::spin_until_future_complete(node, goal_future, 15s) !=
rclcpp::FutureReturnCode::SUCCESS)
{
std::printf("❌ 目标被拒绝(耗时 %.1f s)\n", 0.0);
std::printf("❌ 等待 Nav2 确认目标超时或中断\n");
rclcpp::shutdown();
return 1;
}
@@ -313,19 +372,34 @@ int main(int argc, char * argv[])
const double elapsed =
std::chrono::duration<double>(std::chrono::steady_clock::now() - t_goal).count();
int exit_code = 1;
if (result_future.valid() && result_future.wait_for(0s) == std::future_status::ready) {
const auto code = result_future.get().code;
const auto result = result_future.get();
const auto code = result.code;
const char * name = "❌ 未知状态";
if (code == rclcpp_action::ResultCode::SUCCEEDED) {
name = "✅ SUCCEEDED";
exit_code = 0;
} else if (code == rclcpp_action::ResultCode::CANCELED) {
name = "❌ CANCELED";
} else if (code == rclcpp_action::ResultCode::ABORTED) {
name = "❌ ABORTED";
}
std::printf("结果: %s 导航耗时 %.1f s\n", name, elapsed);
if (result.result) {
std::printf("Nav2 error_code=%u error_msg=%s\n",
static_cast<unsigned>(result.result->error_code), result.result->error_msg.c_str());
}
} else {
std::printf("超时未完成(180 s,已等待 %.0f s)\n", elapsed);
std::printf("超时或中断(上限 180 s,已等待 %.0f s)\n", elapsed);
if (rclcpp::ok()) {
try {
auto canceled = client->async_cancel_goal(handle);
(void)rclcpp::spin_until_future_complete(node, canceled, 1s);
} catch (const rclcpp_action::exceptions::UnknownGoalHandleError &) {
// The server can finish the goal while the timeout is being handled.
}
}
}
try {
@@ -340,5 +414,5 @@ int main(int argc, char * argv[])
}
rclcpp::shutdown();
return 0;
return exit_code;
}
+41 -5
View File
@@ -39,6 +39,8 @@
#include <cstddef>
#include <cstdint>
#include <limits>
#include <algorithm>
#include <stdexcept>
#include <memory>
#include <string>
@@ -87,6 +89,19 @@ public:
declare_parameter<double>("max_range", params.max_range));
core_ = std::make_unique<sentry_nav::SelfFilterCore>(params);
const auto lio_topic = declare_parameter<std::string>("lio_output_topic", "/scan/points_lio");
if (!lio_topic.empty()) {
if (lio_topic == output_topic_) {
throw std::invalid_argument("lio_output_topic must differ from the obstacle cloud topic");
}
auto lio_params = params;
lio_params.keep_min_z = static_cast<float>(declare_parameter<double>("lio_keep_min_z", -0.25));
// Keep the floor outside the body footprint without admitting underbody returns.
lio_params.box_min_z = std::min(lio_params.box_min_z, lio_params.keep_min_z);
lio_core_ = std::make_unique<sentry_nav::SelfFilterCore>(lio_params);
lio_pub_ = create_publisher<sensor_msgs::msg::PointCloud2>(lio_topic, rclcpp::QoS(5).reliable());
RCLCPP_INFO(get_logger(), "LIO cloud: %s (keep_min_z=%.2f)", lio_topic.c_str(), lio_params.keep_min_z);
}
tf_buffer_ = std::make_unique<tf2_ros::Buffer>(get_clock());
tf_listener_ = std::make_shared<tf2_ros::TransformListener>(*tf_buffer_);
@@ -149,10 +164,18 @@ private:
filtered.reserve(raw.size());
// 只做遍历和搬运,判定逻辑全在 core_ 里(可单测)。
const bool publish_lio = lio_pub_ && lio_pub_->get_subscription_count() > 0;
pcl::PointCloud<pcl::PointXYZ> lio_cloud;
if (publish_lio) {
lio_cloud.reserve(raw.size());
}
for (const auto & pt : raw) {
if (core_->Keep(pt.x, pt.y, pt.z)) {
filtered.push_back(pt);
}
if (publish_lio && lio_core_->Keep(pt.x, pt.y, pt.z)) {
lio_cloud.push_back(pt);
}
}
// 统计保留率,调参时有用(DEBUG 级别,默认不刷屏)
@@ -166,16 +189,27 @@ private:
static_cast<unsigned long long>(total_out_),
static_cast<unsigned long long>(total_in_));
sensor_msgs::msg::PointCloud2 out;
pcl::toROSMsg(filtered, out);
out.header.stamp = msg->header.stamp;
out.header.frame_id = target_frame_;
pub_->publish(out);
PublishCloud(filtered, msg->header.stamp, *pub_);
if (publish_lio) {
PublishCloud(lio_cloud, msg->header.stamp, *lio_pub_);
}
// 同一份过滤结果再投影成 2D 激光:不新增订阅/进程,数据一致。
PublishScan(filtered, msg->header.stamp);
}
void PublishCloud(
const pcl::PointCloud<pcl::PointXYZ> & cloud,
const builtin_interfaces::msg::Time & stamp,
rclcpp::Publisher<sensor_msgs::msg::PointCloud2> & publisher)
{
sensor_msgs::msg::PointCloud2 out;
pcl::toROSMsg(cloud, out);
out.header.stamp = stamp;
out.header.frame_id = target_frame_;
publisher.publish(out);
}
// 把过滤后的点云(已在 base_link 系)投影成 2D 激光:
// 每个方位格取该格内最小水平距离,z 只取车体碰撞带 [scan_height_min, scan_height_max]。
// 这样投影结果与地图的「体积投影」在同一高度带,避免 AMCL 因高度失配把粒子整团迁走。
@@ -223,6 +257,7 @@ private:
std::string scan_topic_;
std::unique_ptr<sentry_nav::SelfFilterCore> core_;
std::unique_ptr<sentry_nav::SelfFilterCore> lio_core_;
std::uint64_t total_in_{0};
std::uint64_t total_out_{0};
@@ -236,6 +271,7 @@ private:
std::unique_ptr<tf2_ros::Buffer> tf_buffer_;
std::shared_ptr<tf2_ros::TransformListener> tf_listener_;
rclcpp::Publisher<sensor_msgs::msg::PointCloud2>::SharedPtr pub_;
rclcpp::Publisher<sensor_msgs::msg::PointCloud2>::SharedPtr lio_pub_;
rclcpp::Publisher<sensor_msgs::msg::LaserScan>::SharedPtr scan_pub_;
rclcpp::Subscription<sensor_msgs::msg::PointCloud2>::SharedPtr sub_;
};
+2 -1
View File
@@ -15,6 +15,7 @@ local ros_direct_packages = {
"nav_msgs",
"geometry_msgs",
"sensor_msgs",
"std_msgs",
"tf2_ros",
"tf2_sensor_msgs",
"pcl_conversions",
@@ -128,7 +129,7 @@ local function ros_common()
local script = path.join(
target:scriptdir(),
"../../tools/resolve_ros_includes.py"
"../../tools/_internal/resolve_ros_includes.py"
)
if not os.isfile(script) then
+3 -3
View File
@@ -33,14 +33,14 @@ ros2 launch src/sentry_sim/launch/sentry_arena.launch.py --show-args # 看
| `map` | 迁移包里的 `rmul_2027.yaml` | Nav2 用的栅格图 |
| `field_root` | 仓库内 `field/RMUL2027_map_transfer_20261016_STEP_R1` | 迁移包目录(找不到才退回 `~/Gazebo_projects/` 下的旧路径) |
环境变量(`GZ_PARTITION` / `ROS_DOMAIN_ID` / `SENTRY_FIELD_ROOT` / `SENTRY_MAP_YAML`)
会被继承,行为和 `sentry_up.sh` 一致。详见 `../scripts/README.md`。
`map:=` 和 `field_root:=` 优先于对应的环境变量。未提供地图时,从实际选定的场地目录探测。
两个启动入口使用同一套环境探测规则,`--show-args` 可独立查看参数。详见[环境变量](../../../docs/操作手册.md#6-环境变量)。
## 和 `scripts/sentry_up.sh` 的取舍
| | `sentry_up.sh` | 本 launch 文件 |
|---|---|---|
| 依赖 | 只要 bash | 要 `ros2 launch`(launch / launch_ros) |
| 依赖 | Bash、Python 3 和 ROS | `ros2 launch`(launch / launch_ros) |
| 参数可见性 | 看脚本 | `--show-args` 全列出来 |
| 进程管理 | `trap` 收尾 | launch 统一收尾、能看进程树 |
| 被别的 launch include | ❌ | ✅ |
+91 -68
View File
@@ -53,12 +53,14 @@ from launch.actions import (
LogInfo,
OpaqueFunction,
SetEnvironmentVariable,
SetLaunchConfiguration,
)
from launch.conditions import IfCondition
from launch.event_handlers import OnProcessExit
from launch.events import Shutdown
from launch.substitutions import (LaunchConfiguration,
PathJoinSubstitution, PythonExpression)
from launch.substitutions import (
EqualsSubstitution, IfElseSubstitution, LaunchConfiguration, PathJoinSubstitution, PythonExpression,
)
from launch_ros.actions import Node
from launch_ros.parameter_descriptions import ParameterValue
@@ -68,29 +70,61 @@ from launch_ros.parameter_descriptions import ParameterValue
PKG_SHARE = Path(__file__).resolve().parents[1] # src/sentry_sim
WS = Path(__file__).resolve().parents[3] # 仓库根
SCRIPTS = PKG_SHARE / 'scripts'
TOOLS_DIR = WS / 'tools'
INTERNAL_TOOLS = TOOLS_DIR / '_internal'
# 可移植探测:xmake 产物目录 / 场地包 / 地图 / gz 版本,一个都不写死。
# 规则与 `scripts/env_common.sh` 完全一致(同样支持 SENTRY_BIN_DIR、
# SENTRY_FIELD_ROOT、SENTRY_MAP_YAML、GZ_BIN、GZ_FORCE_VERSION 覆盖)。
# `tools/` 不是 Python 包(本工程不用 ament),所以直接把目录塞进 sys.path。
if str(WS / 'tools') not in sys.path:
sys.path.insert(0, str(WS / 'tools'))
# 从仓库源码加载工具模块。
if str(TOOLS_DIR) not in sys.path:
sys.path.insert(0, str(TOOLS_DIR))
import project_env # noqa: E402 (必须在 sys.path 调整之后导入)
from dds_environment import defaults as dds_defaults # noqa: E402
from _internal.dds_environment import defaults as dds_defaults # noqa: E402
BIN_DIR = project_env.find_bin_dir(WS)
GZ_VERSION_ARGS = project_env.gz_version_args()
BIN_DIR = LaunchConfiguration('_sentry_bin_dir')
GZ_MAJOR_VERSION = LaunchConfiguration('_sentry_gz_major_version')
_FIELD_ROOT = project_env.find_field_root(WS)
if _FIELD_ROOT is None:
raise RuntimeError(
'找不到场地迁移包。设 SENTRY_FIELD_ROOT=<含 src/guodong_sentry_sim 的目录>。')
DEFAULT_FIELD_ROOT = str(_FIELD_ROOT)
_MAP_YAML = project_env.find_map_yaml(_FIELD_ROOT)
if _MAP_YAML is None:
raise RuntimeError(f'{_FIELD_ROOT} 下找不到任何栅格图 yaml。设 SENTRY_MAP_YAML=<路径>。')
DEFAULT_MAP_YAML = str(_MAP_YAML)
def _resolve_environment(context):
field_root = project_env.find_field_root(
WS, explicit=LaunchConfiguration('field_root').perform(context))
map_yaml = project_env.find_map_yaml(
field_root, explicit=LaunchConfiguration('map').perform(context))
bin_dir = project_env.find_bin_dir(WS)
nodes = ['odom_tf', 'cmd_vel_relay', 'self_filter']
if LaunchConfiguration('localization').perform(context) == 'lio':
nodes.append('field_localization_node')
for name in nodes:
project_env.require_executable(bin_dir / name, name)
gz = project_env.find_gz_bin()
versions = project_env.gz_version_args(gz)
return [
SetLaunchConfiguration('field_root', str(field_root)),
SetLaunchConfiguration('map', str(map_yaml)),
SetLaunchConfiguration('_sentry_bin_dir', str(bin_dir)),
SetEnvironmentVariable('GZ_BIN', str(gz)),
SetLaunchConfiguration('_sentry_gz_major_version', versions[1] if versions else ''),
]
def _start_gazebo(context):
headless = LaunchConfiguration('headless').perform(context).lower() in ('true', '1')
# Keep -r in both modes so that the world starts unpaused.
args = ['-s', '-r'] if headless else ['-r']
if major := GZ_MAJOR_VERSION.perform(context):
args.extend(['--force-version', major])
world_path = PathJoinSubstitution([str(PKG_SHARE / 'worlds'), LaunchConfiguration('world')])
return [ExecuteProcess(
cmd=[str(SCRIPTS / 'run_gz.sh'), 'sim', *args, world_path],
name='gazebo', output='screen',
)]
def _on_bridge_exit(event, context):
if event.returncode != 0 and not context.is_shutdown:
raise RuntimeError('Gazebo 桥启动或运行失败,请检查 /clock 与 ros_gz_bridge 日志。')
return []
def _robot_description():
@@ -126,12 +160,15 @@ def _validate_lio(context):
path = Path(LaunchConfiguration('lio_map').perform(context))
if mode == 'localization' and not path.is_file():
raise RuntimeError(f'Missing LIO map: {path}; first select lio_mode:=mapping')
if mode == 'mapping':
export = Path(LaunchConfiguration('lio_export_map').perform(context))
export.parent.mkdir(parents=True, exist_ok=True)
return []
def _preflight_nav2(context):
if LaunchConfiguration('nav2').perform(context).lower() in ('true', '1'):
subprocess.run(['python3', str(WS / 'tools' / 'nav2_startup.py'), '--preflight'],
subprocess.run(['python3', str(INTERNAL_TOOLS / 'nav2_startup.py'), '--preflight'],
env=dict(context.environment), check=True)
return []
@@ -141,7 +178,7 @@ def _start_velocity_relay(context):
localization = LaunchConfiguration('localization').perform(context)
input_topic = '/cmd_vel' if navigation else context.environment.get('MANUAL_CMD_VEL_TOPIC', '/cmd_vel')
return [ExecuteProcess(
cmd=[str(BIN_DIR / 'cmd_vel_relay'),
cmd=[PathJoinSubstitution([BIN_DIR, 'cmd_vel_relay']),
'--ros-args', '-p', 'use_sim_time:=true',
'-p', f'navigation_mode:={str(navigation).lower()}',
'-p', f'require_localization_health:={str(localization == "lio").lower()}',
@@ -154,31 +191,37 @@ def generate_launch_description():
headless = LaunchConfiguration('headless')
nav2 = LaunchConfiguration('nav2')
rviz = LaunchConfiguration('rviz')
world = LaunchConfiguration('world')
map_yaml = LaunchConfiguration('map')
localization = LaunchConfiguration('localization')
lio_mode = LaunchConfiguration('lio_mode')
lio_map = LaunchConfiguration('lio_map')
lio_export = LaunchConfiguration('lio_export_map')
lio_default_map = IfElseSubstitution(
EqualsSubstitution(lio_mode, 'mapping'),
if_value=str(WS / 'generated' / 'field_mapping.flmap'),
else_value=str(PKG_SHARE / 'maps' / 'field_full.flmap'),
)
# 布尔参数统一用 PythonExpression 判,避免 launch 把 "false" 当真值
is_headless = PythonExpression(["'", headless, "'.lower() in ('true', '1')"])
is_gui = PythonExpression(["'", headless, "'.lower() not in ('true', '1')"])
nav2_on = PythonExpression(["'", nav2, "'.lower() in ('true', '1')"])
rviz_on = PythonExpression([
"'", rviz, "'.lower() in ('true', '1') and '",
headless, "'.lower() not in ('true', '1')"])
robot_description = _robot_description()
bridge = ExecuteProcess(
cmd=[str(SCRIPTS / 'bridge_after_gz.sh')],
name='ros_gz_bridge', output='screen',
)
navigation_ready = ExecuteProcess(
cmd=['python3', str(WS / 'tools' / 'wait_navigation_ready.py')],
cmd=['python3', str(INTERNAL_TOOLS / 'wait_navigation_ready.py')],
name='wait_navigation_ready', output='screen', condition=IfCondition(nav2_on),
)
# Use the same process boundary and options as the shell entry point.
# The nested include path reproduced a Wait action discovery timeout on this setup.
navigation = ExecuteProcess(
cmd=['python3', str(WS / 'tools' / 'run_nav2.py'),
cmd=['python3', str(INTERNAL_TOOLS / 'run_nav2.py'),
'--timeout', os.environ.get('SENTRY_NAV2_TIMEOUT', '120'), '--',
['map:=', map_yaml], 'use_sim_time:=true', 'autostart:=False',
['params_file:=', str(PKG_SHARE / 'config' / 'nav2_params.yaml')],
@@ -192,8 +235,13 @@ def generate_launch_description():
actions = [
DeclareLaunchArgument('localization', default_value='lio', choices=['lio', 'amcl']),
DeclareLaunchArgument('lio_mode', default_value='localization', choices=['mapping', 'localization']),
DeclareLaunchArgument('lio_map', default_value=str(WS / 'generated' / 'field.flmap')),
DeclareLaunchArgument('lio_export_map', default_value=lio_map),
DeclareLaunchArgument(
'lio_map', default_value=os.environ.get('LIO_MAP') or lio_default_map,
description='Full-field localization map or generated/field_mapping.flmap in mapping mode',
),
DeclareLaunchArgument('lio_export_map', default_value=os.environ.get('LIO_EXPORT_MAP') or lio_map),
DeclareLaunchArgument('lio_point_cloud_topic',
default_value=os.environ.get('LIO_POINT_CLOUD_TOPIC') or '/scan/points_lio'),
DeclareLaunchArgument('lio_initial_x', default_value='-5.0'),
DeclareLaunchArgument('lio_initial_y', default_value='3.0'),
DeclareLaunchArgument('lio_initial_z', default_value='0.0'),
@@ -211,18 +259,19 @@ def generate_launch_description():
'world', default_value='sentry_arena.sdf',
description='worlds/ 下的世界文件名'),
DeclareLaunchArgument(
'map', default_value=DEFAULT_MAP_YAML,
description='Nav2 用的栅格图 yaml'),
'map', default_value='',
description='Nav2 栅格图 YAML,留空则从环境或场地包探测'),
DeclareLaunchArgument(
'field_root', default_value=DEFAULT_FIELD_ROOT,
description='迁移包(guodong_sentry_sim)所在目录'),
'field_root', default_value='',
description='场地包目录,留空则从环境或仓库探测'),
OpaqueFunction(function=_resolve_environment),
# ---------------- 环境变量 ----------------
SetEnvironmentVariable('FASTDDS_BUILTIN_TRANSPORTS',
dds_defaults(os.environ)['FASTDDS_BUILTIN_TRANSPORTS']),
SetEnvironmentVariable('GZ_SIM_RESOURCE_PATH', _gz_resource_path()),
SetEnvironmentVariable(
'GZ_PARTITION', os.environ.get('GZ_PARTITION', 'sentry')),
'GZ_PARTITION', os.environ.get('GZ_PARTITION') or 'sentry'),
SetEnvironmentVariable(
'ROS_DOMAIN_ID', dds_defaults(os.environ)['ROS_DOMAIN_ID']),
# URDF 的网格路径靠它解析;tools/check_stack.py 也读它
@@ -230,41 +279,14 @@ def generate_launch_description():
OpaqueFunction(function=_preflight_nav2),
# ---------------- 1. Gazebo ----------------
# 用 run_gz.sh 包一层:它会清掉 LD_LIBRARY_PATH,
# 否则 source 过 ROS 之后连系统版 gz 也会加载 vendor 库(缺 cpu-lidar 插件)
# ⚠️ cmd 列表里的每个元素是**独立 argv**,不会自动拼接。
# world 是 LaunchConfiguration,所以必须用 PathJoinSubstitution
# 合成成一个参数,否则 gz 会收到三个散参数
# (报 "The following arguments were not expected: xxx.sdf /")。
ExecuteProcess(
cmd=[str(SCRIPTS / 'run_gz.sh'), 'sim', '-r',
*GZ_VERSION_ARGS,
PathJoinSubstitution([str(PKG_SHARE / 'worlds'), world])],
name='gazebo',
output='screen',
condition=IfCondition(is_gui),
),
# ⚠️ headless 也必须带 -r(启动即运行)。
# 少了 -r 的话 gazebo 以**暂停**状态启动:物理引擎不步进 →
# MecanumDrive 不发 /odom、传感器不出数据,但 /clock 照常发布,
# 表面上一切正常,实际整条数据链是死的。
ExecuteProcess(
cmd=[str(SCRIPTS / 'run_gz.sh'), 'sim', '-s', '-r',
*GZ_VERSION_ARGS,
PathJoinSubstitution([str(PKG_SHARE / 'worlds'), world])],
name='gazebo',
output='screen',
condition=IfCondition(is_headless),
),
OpaqueFunction(function=_start_gazebo),
# ---------------- 2. ros_gz 桥 ----------------
# bridge_after_gz.sh 自己轮询 /clock 再起桥:
# gz-transport 的发现不回补,桥先于话题存在就订阅会一直收不到数据
ExecuteProcess(
cmd=[str(SCRIPTS / 'bridge_after_gz.sh')],
name='ros_gz_bridge',
output='screen',
),
# 等到 /clock 出现再加载桥,否则 gz-transport 可能漏掉话题。
RegisterEventHandler(OnProcessExit(
target_action=bridge, on_exit=_on_bridge_exit,
)),
bridge,
# ---------------- 3. TF 树 ----------------
Node(
@@ -286,7 +308,7 @@ def generate_launch_description():
# 如果写成嵌套列表 ['-p', 'odom_scale:=', v],会被拼成 "-podom_scale:=1.15"(没空格),
# rclpy 的参数解析会直接报错。
ExecuteProcess(
cmd=[str(BIN_DIR / 'odom_tf'), '--ros-args',
cmd=[PathJoinSubstitution([BIN_DIR, 'odom_tf']), '--ros-args',
'-p', 'use_sim_time:=true',
'-p', 'odom_scale:=' + os.environ.get('SENTRY_ODOM_SCALE', '1.0')],
name='odom_tf',
@@ -300,15 +322,16 @@ def generate_launch_description():
# ---------------- 6. 点云自滤 ----------------
# 本工程没有 ament 注册,不能 ros2 run,直接跑 xmake 产物
ExecuteProcess(
cmd=[str(BIN_DIR / 'self_filter'),
cmd=[PathJoinSubstitution([BIN_DIR, 'self_filter']),
'--ros-args', '-p', 'use_sim_time:=true', '-p', 'reliable_clouds:=true'],
name='self_filter',
output='screen',
),
ExecuteProcess(
cmd=[str(BIN_DIR / 'field_localization_node'), '--ros-args',
'-p', 'use_sim_time:=true', '-p', 'reliable_clouds:=true', '-p', 'point_cloud_topic:=/scan/points_filtered',
cmd=[PathJoinSubstitution([BIN_DIR, 'field_localization_node']), '--ros-args',
'-p', 'use_sim_time:=true', '-p', 'reliable_clouds:=true',
'-p', ['point_cloud_topic:=', LaunchConfiguration('lio_point_cloud_topic')],
'-p', ['mode:=', lio_mode], '-p', ['map_path:=', lio_map],
'-p', ['export_map_path:=', lio_export], '-p', 'publish_map_to_odom:=true',
'-p', "diagnostics_path:='" + os.environ.get('LIO_TRACE_PATH', '') + "'",
Binary file not shown.
+3 -13
View File
@@ -37,20 +37,10 @@
| `SENTRY_FIELD_ROOT` | 仓库内 `field/RMUL2027_map_transfer_20261016_STEP_R1` | 场地包位置。**优先用仓库自带的**,找不到才退回 `~/Gazebo_projects/` 下的旧路径 |
| `SENTRY_MAP_YAML` | 上面路径下的 `maps/rmul_2027/rmul_2027.yaml` | 想换地图时直接指这个 |
| `SENTRY_SIM_SHARE` | 仓库内 `src/sentry_sim` | 数据包位置。设了就以它为准;同时会导出给 `xacro`,URDF 里的网格路径靠它解析 |
| `NAV_BIN_DIR` | `<仓库根>/build/bin` | xmake 产物目录。想用别处的二进制时覆盖它 |
| `SENTRY_BIN_DIR` | `<仓库根>/build/bin` | xmake 产物目录,旧变量 `NAV_BIN_DIR` 仍可用 |
| `BRIDGE_WAIT_TIMEOUT` | `120` | 等待 Gazebo `/clock` 的秒数,两个入口共用 |
## `FIELD_ROOT` 的解析逻辑(容易踩的一点)
```bash
FIELD_DEFAULT="$HOME/Gazebo_projects/RMUL2027_map_transfer_20261016_STEP_R1"
if [ -d "$WS/field/RMUL2027_map_transfer_20261016_STEP_R1" ]; then
FIELD_DEFAULT="$WS/field/RMUL2027_map_transfer_20261016_STEP_R1"
fi
FIELD_ROOT="${SENTRY_FIELD_ROOT:-$FIELD_DEFAULT}"
```
> **不能写成 `[ -d ... ] && FIELD_DEFAULT=...`** —— 脚本第 10 行有 `set -e`,
> 目录不存在时那种写法会让整个脚本静默退出(踩过)。
场地、地图、构建目录和 Gazebo 的选择顺序见[操作手册](../../../docs/操作手册.md#6-环境变量)。
## 退出时 Gazebo 可能残留
+6 -10
View File
@@ -5,18 +5,14 @@
# (gz-transport 的发现不回补)。先轮询 /clock,再 exec 桥。
set -e
TIMEOUT_SECONDS="${BRIDGE_WAIT_TIMEOUT:-180}"
for _ in $(seq 1 "$((TIMEOUT_SECONDS / 2))"); do
if gz topic -l 2>/dev/null | grep -qx '/clock'; then
echo "[bridge_after_gz] Gazebo 已就绪,启动桥"
break
fi
sleep 2
done
SCRIPTS_DIR="$(cd -- "$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)"
# shellcheck source=./env_common.sh
. "${SCRIPTS_DIR}/env_common.sh"
GZ=$(env_gz_bin)
env_wait_gz_clock "$GZ"
echo "[bridge_after_gz] Gazebo /clock 已就绪,启动桥"
echo "[bridge_after_gz] GZ_PARTITION=${GZ_PARTITION:-<unset>} ROS_DOMAIN_ID=${ROS_DOMAIN_ID:-<unset>} RMW=${RMW_IMPLEMENTATION:-<unset>}"
echo "[bridge_after_gz] LD_LIBRARY_PATH=${LD_LIBRARY_PATH:0:80}"
echo "[bridge_after_gz] gz 话题数=$(gz topic -l 2>/dev/null | wc -l)"
exec ros2 run ros_gz_bridge parameter_bridge \
'/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock' \
'/model/sentry/cmd_vel@geometry_msgs/msg/Twist]gz.msgs.Twist' \
+43 -239
View File
@@ -1,263 +1,67 @@
#!/usr/bin/env bash
# 可移植的环境探测 —— 所有启动脚本共享这一份,别再各写一套。
#
# 设计原则:
# ① **一切都能被环境变量覆盖**:探测只是给个合理默认值,不是唯一真相。
# ② **探测失败要吵**:宁可启动时明确报错,也不要带着错路径跑到一半。
# ③ **不写死发行版/版本/平台三元组**:换台机器、换个 ROS 版本、换个 Gazebo 大版本
# 都不该需要改脚本。
#
# 覆盖用的环境变量:
# ROS_SETUP 直接指定要 source 的 setup.bash 全路径
# ROS_DISTRO ROS 发行版名(配合 /opt/ros/<名>/setup.bash)
# SENTRY_BIN_DIR xmake 产物目录(默认识别 build/*/*/release)
# GZ_BIN Gazebo 可执行文件(默认优先 /usr/bin/gz)
# GZ_FORCE_VERSION gz --force-version 的值(默认自动取已安装主版本)
# SENTRY_FIELD_ROOT 场地迁移包根目录
# SENTRY_MAP_YAML 栅格图 yaml 全路径
#
# 用法(在脚本里):
# WS="$(cd -- "$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}")")/../.." && pwd)"
# source "${WS}/src/sentry_sim/scripts/env_common.sh"
#
# 注意:本文件会被 `set -e` 的脚本 source,所以任何"可能失败"的命令都要兜住。
# Share the Python environment probes while keeping ROS setup in the caller's shell.
_SENTRY_PROJECT_ENV="$(cd -- "$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}")")/../../.." && pwd)/tools/project_env.py"
_env_query() {
# These functions can also be called from a sourced shell with unexported overrides.
ROS_SETUP="${ROS_SETUP:-}" ROS_INSTALL_ROOT="${ROS_INSTALL_ROOT:-}" \
ROS_DISTRO="${ROS_DISTRO:-}" AMENT_PREFIX_PATH="${AMENT_PREFIX_PATH:-}" \
SENTRY_BIN_DIR="${SENTRY_BIN_DIR:-}" NAV_BIN_DIR="${NAV_BIN_DIR:-}" \
SENTRY_FIELD_ROOT="${SENTRY_FIELD_ROOT:-}" SENTRY_MAP_YAML="${SENTRY_MAP_YAML:-}" \
GZ_BIN="${GZ_BIN:-}" GZ_FORCE_VERSION="${GZ_FORCE_VERSION:-}" \
GZ_PARTITION="${GZ_PARTITION:-}" BRIDGE_WAIT_TIMEOUT="${BRIDGE_WAIT_TIMEOUT:-}" \
python3 "$_SENTRY_PROJECT_ENV" "$@"
}
# ---------------------------------------------------------------------------
# 1. ROS 2 —— 找到并 source 一个能用的 setup.bash
# ---------------------------------------------------------------------------
# 为什么要探测:发行版名字(humble / jazzy / lyrical …)会变,
# 写死 `/opt/ros/lyrical/setup.bash` 等于把工程锁死在一台机器上。
env_source_ros() {
# ① 已经 source 过就别再动 —— 重复 source 会把 PATH 越叠越长。
if [ -n "${AMENT_PREFIX_PATH:-}" ] && command -v ros2 >/dev/null 2>&1; then
return 0
local setup
setup=$(_env_query --ros-setup) || return
if [ -n "$setup" ]; then
# shellcheck disable=SC1090
. "$setup" || return
echo "[env] ROS: ${setup}" >&2
fi
local cand=""
# ② 显式指定优先
if [ -n "${ROS_SETUP:-}" ]; then
if [ -f "$ROS_SETUP" ]; then
cand="$ROS_SETUP"
else
echo "[env] ❌ ROS_SETUP 指向的文件不存在: $ROS_SETUP" >&2
return 1
fi
fi
# ③ 自定义安装根(非 /opt/ros 的安装,比如源码编译)
if [ -z "$cand" ] && [ -n "${ROS_INSTALL_ROOT:-}" ] \
&& [ -f "${ROS_INSTALL_ROOT}/setup.bash" ]; then
cand="${ROS_INSTALL_ROOT}/setup.bash"
fi
# ④ 按发行版名找
if [ -z "$cand" ] && [ -n "${ROS_DISTRO:-}" ] \
&& [ -f "/opt/ros/${ROS_DISTRO}/setup.bash" ]; then
cand="/opt/ros/${ROS_DISTRO}/setup.bash"
fi
# ⑤ 在 /opt/ros 下扫,多个时取版本号最大的那个
if [ -z "$cand" ]; then
cand=$(ls -1d /opt/ros/*/setup.bash 2>/dev/null | sort -V | tail -1)
fi
if [ -z "$cand" ] || [ ! -f "$cand" ]; then
echo "[env] ❌ 找不到 ROS 2 安装(/opt/ros/*/setup.bash 全空)。" >&2
echo "[env] 办法:先 source 你的 ROS 环境;或设 ROS_SETUP=<setup.bash 全路径>;" >&2
echo "[env] 或设 ROS_DISTRO=<发行版名>;或设 ROS_INSTALL_ROOT=<安装前缀>。" >&2
return 1
fi
local n
n=$(ls -1d /opt/ros/*/setup.bash 2>/dev/null | wc -l)
if [ "$n" -gt 1 ] && [ -z "${ROS_SETUP:-}" ] && [ -z "${ROS_DISTRO:-}" ]; then
echo "[env] ⚠️ 机器上装了 $n 个 ROS,自动选了版本号最大的:$cand" >&2
echo "[env] 想用别的就设 ROS_DISTRO=<名字> 或 ROS_SETUP=<全路径>。" >&2
fi
# shellcheck disable=SC1090
# shellcheck disable=SC1091
. "$cand"
echo "[env] ROS: ${cand}" >&2
}
# ---------------------------------------------------------------------------
# 2. Gazebo 可执行文件
# ---------------------------------------------------------------------------
# 为什么要挑:source 过 ROS 之后,PATH 上的 `gz` 是 gz_tools_vendor 里那个,
# 它带着 vendor 的 RUNPATH,会去加载 gz_sim_vendor(缺 cpu-lidar 插件),
# 导致雷达传感器创建失败。所以系统装的 /usr/bin/gz 优先。
env_gz_bin() {
if [ -n "${GZ_BIN:-}" ]; then
if [ ! -x "$GZ_BIN" ]; then
echo "[env] ❌ GZ_BIN 不可执行: $GZ_BIN" >&2
return 1
fi
printf '%s\n' "$GZ_BIN"
return 0
fi
local c
for c in /usr/bin/gz /usr/local/bin/gz /opt/gz/bin/gz; do
if [ -x "$c" ]; then
printf '%s\n' "$c"
return 0
fi
done
c=$(command -v gz 2>/dev/null || true)
if [ -n "$c" ]; then
printf '%s\n' "$c"
return 0
fi
echo "[env] ❌ 找不到 Gazebo 的 gz 可执行文件。设 GZ_BIN=<路径>。" >&2
return 1
_env_query --gz
}
# 输出 `--force-version <主版本>`,取不到就输出空(表示不传这个参数)。
# 为什么要自动取:写死 10 的话,装了 gz 11 就跑不起来。
env_gz_version_args() {
if [ -n "${GZ_FORCE_VERSION:-}" ]; then
printf '%s\n%s\n' --force-version "$GZ_FORCE_VERSION"
return 0
fi
local gz v major
gz=$(env_gz_bin 2>/dev/null || true)
[ -z "$gz" ] && return 0
v=$("$gz" sim --version 2>/dev/null | head -1 || true)
major=$(printf '%s' "$v" | grep -oE '^[0-9]+' || true)
if [ -n "$major" ]; then
printf '%s\n%s\n' --force-version "$major"
fi
return 0
_env_query --gz-version-args-lines
}
env_wait_gz_clock() {
local gz="${1:?需要 Gazebo 可执行文件}"
shift
GZ_BIN="$gz" _env_query --wait-gz-clock "$@"
}
# ---------------------------------------------------------------------------
# 3. xmake 产物目录
# ---------------------------------------------------------------------------
# **现行布局固定是 `build/bin/`** —— `src/sentry_nav/xmake.lua` 里每个 target 都
# `set_targetdir("$(builddir)/bin")`,故意不用 xmake 默认的平台三元组,
# 免得 `build/<平台>/<架构>/<模式>` 这种串被抄进文档后换机器就失效。
#
# 这里仍然按「找某个已知产物的实际位置」来定位(而不是直接拼 build/bin),
# 这样老布局的 checkout 也还能用,而且编译模式换了也跟得上。
env_bin_dir() {
local ws="${1:?需要仓库根路径}"
# SENTRY_BIN_DIR 是统一名字;NAV_BIN_DIR 是历史名字,保留兼容。
if [ -n "${SENTRY_BIN_DIR:-}" ]; then
printf '%s\n' "$SENTRY_BIN_DIR"
return 0
fi
if [ -n "${NAV_BIN_DIR:-}" ]; then
printf '%s\n' "$NAV_BIN_DIR"
return 0
fi
# ① 现行布局优先
local name p
for name in self_filter nav_client patrol odom_tf field_localization_node; do
if [ -x "${ws}/build/bin/${name}" ]; then
printf '%s\n' "${ws}/build/bin"
return 0
fi
done
# ② 老布局:去 build/ 里找产物实际所在的那一层
for name in self_filter nav_client patrol odom_tf field_localization_node; do
p=$(find "$ws/build" -maxdepth 4 -type f -name "$name" 2>/dev/null | head -1 || true)
if [ -n "$p" ]; then
dirname "$p"
return 0
fi
done
# ③ 还没编译过:返回现行布局的位置
printf '%s\n' "${ws}/build/bin"
_env_query "${1:?需要仓库根路径}" --bin-dir
}
# ---------------------------------------------------------------------------
# 4. 场地迁移包
# ---------------------------------------------------------------------------
# 不写死 RMUL2027_map_transfer_20261016_STEP_R1:换一版迁移包(日期变了)就废。
env_field_root() {
local ws="${1:?需要仓库根路径}"
if [ -n "${SENTRY_FIELD_ROOT:-}" ]; then
if [ ! -d "$SENTRY_FIELD_ROOT" ]; then
echo "[env] ❌ SENTRY_FIELD_ROOT 不存在: $SENTRY_FIELD_ROOT" >&2
return 1
fi
printf '%s\n' "$SENTRY_FIELD_ROOT"
return 0
fi
local d
# ① 仓库自带的 field/ 下任意一个含 guodong_sentry_sim 的包
for d in "$ws"/field/*/src/guodong_sentry_sim; do
if [ -d "$d" ]; then
dirname "$(dirname "$d")"
return 0
fi
done
# ② 退回本机旧位置(任意 *_map_transfer_*)
for d in "$HOME"/Gazebo_projects/*map_transfer*/src/guodong_sentry_sim; do
if [ -d "$d" ]; then
dirname "$(dirname "$d")"
return 0
fi
done
echo "[env] ❌ 找不到场地迁移包。设 SENTRY_FIELD_ROOT=<含 src/guodong_sentry_sim 的目录>。" >&2
return 1
_env_query "${1:?需要仓库根路径}" --field
}
# 输出栅格图 yaml 路径:优先 rmul_2027.yaml,否则取地图目录里第一个
env_map_yaml() {
local field_root="${1:?需要场地根路径}"
if [ -n "${SENTRY_MAP_YAML:-}" ]; then
if [ ! -f "$SENTRY_MAP_YAML" ]; then
echo "[env] ❌ SENTRY_MAP_YAML 不存在: $SENTRY_MAP_YAML" >&2
return 1
fi
printf '%s\n' "$SENTRY_MAP_YAML"
return 0
fi
local m first=""
for m in "$field_root"/src/guodong_sentry_sim/maps/*/*.yaml; do
[ -f "$m" ] || continue
case "$m" in
*/rmul_2027.yaml) printf '%s\n' "$m"; return 0 ;;
esac
if [ -z "$first" ]; then first="$m"; fi
done
if [ -n "$first" ]; then
printf '%s\n' "$first"
return 0
fi
echo "[env] ❌ $field_root 下找不到任何栅格图 yaml。设 SENTRY_MAP_YAML=<路径>。" >&2
return 1
_env_query --map --field-root "${1:?需要场地根路径}"
}
# ---------------------------------------------------------------------------
# 5. 一次性打印全部探测结果(调试用)
# ---------------------------------------------------------------------------
env_report() {
local ws="${1:?需要仓库根路径}"
echo " SENTRY_SIM_SHARE = ${SENTRY_SIM_SHARE:-<未设>}"
echo " ROS = ${AMENT_PREFIX_PATH%%:*}"
echo " ROS_DISTRO = ${ROS_DISTRO:-<未设>}"
echo " BIN_DIR = $(env_bin_dir "$ws")"
echo " GZ_BIN = $(env_gz_bin 2>/dev/null || echo '<找不到>')"
echo " GZ 版本参数 = $(env_gz_version_args | tr '\n' ' ')"
echo " FIELD_ROOT = $(env_field_root "$ws" 2>/dev/null || echo '<找不到>')"
printf ' SENTRY_SIM_SHARE = %s\n' "${SENTRY_SIM_SHARE:-<未设>}"
local ros="${AMENT_PREFIX_PATH:-}"
printf ' ROS = %s\n' "${ros%%:*}"
printf ' ROS_DISTRO = %s\n' "${ROS_DISTRO:-<未设>}"
local bin gz versions field
bin=$(env_bin_dir "$ws") || return
gz=$(env_gz_bin) || return
versions=$(GZ_BIN="$gz" env_gz_version_args) || return
field=$(env_field_root "$ws") || return
printf ' BIN_DIR = %s\n' "$bin"
printf ' GZ_BIN = %s\n' "$gz"
printf ' GZ 版本参数 = %s\n' "${versions//$'\n'/ }"
printf ' FIELD_ROOT = %s\n' "$field"
}
+52 -56
View File
@@ -15,6 +15,7 @@ set -e
SELF="$(readlink -f "${BASH_SOURCE[0]}")"
WS="$(cd -- "$(dirname -- "$SELF")/../../.." && pwd)"
INTERNAL_TOOLS="$WS/tools/_internal"
# ---------------------------------------------------------------------------
# 日志默认自动落盘:不需要再记得 `| tee generated/up.log`
@@ -41,8 +42,7 @@ export SENTRY_SIM_SHARE="$PKG_SHARE"
# ---------------------------------------------------------------------------
# 环境探测:ROS 发行版 / 场地包 / 地图 / xmake 产物目录 / gz 版本,一个都不写死。
# 全部逻辑在 env_common.sh 里,也能被别的脚本复用;每个值都可以用环境变量覆盖
# (顶层注释里列了全部变量名)。
# env_common.sh 调用 tools/project_env.py,和 Python launch 共用探测规则。
# ---------------------------------------------------------------------------
# shellcheck source=./env_common.sh
. "${PKG_SHARE}/scripts/env_common.sh"
@@ -50,22 +50,35 @@ export SENTRY_SIM_SHARE="$PKG_SHARE"
# 注意顺序:先 source ROS,后面 `ros2 run` / `xacro` 才在 PATH 上。
env_source_ros
FIELD_ROOT="$(env_field_root "$WS")" || exit 1
MAP_YAML="$(env_map_yaml "$FIELD_ROOT")" || exit 1
NAV_BIN_DIR="${NAV_BIN_DIR:-$(env_bin_dir "$WS")}"
GZ_EXE="$(env_gz_bin)" || exit 1
# `--force-version <主版本>`,没装多个版本时可以留空;GZ_FORCE_VERSION 可强制指定。
mapfile -t GZ_VER_ARGS < <(env_gz_version_args)
FIELD_ROOT="$(env_field_root "$WS")"
MAP_YAML="$(env_map_yaml "$FIELD_ROOT")"
NAV_BIN_DIR="$(env_bin_dir "$WS")"
GZ_EXE="$(env_gz_bin)"
GZ_VERSION_LINES="$(GZ_BIN="$GZ_EXE" env_gz_version_args)"
GZ_VER_ARGS=()
if [ -n "$GZ_VERSION_LINES" ]; then
mapfile -t GZ_VER_ARGS <<< "$GZ_VERSION_LINES"
fi
HEADLESS="${HEADLESS:-0}"
NAV2="${NAV2:-1}"
RVIZ="${RVIZ:-1}"
# Use exactly the same defaults as the Python launch entry point.
eval "$(python3 "$WS/tools/dds_environment.py" --shell)"
eval "$(python3 "$INTERNAL_TOOLS/dds_environment.py" --shell)"
LOCALIZATION="${LOCALIZATION:-lio}"
LIO_MODE="${LIO_MODE:-localization}"
if [ "$LIO_MODE" = mapping ]; then
LIO_DEFAULT_MAP="$WS/generated/field_mapping.flmap"
else
LIO_DEFAULT_MAP="$PKG_SHARE/maps/field_full.flmap"
fi
LIO_MAP="${LIO_MAP:-$LIO_DEFAULT_MAP}"
LIO_EXPORT_MAP="${LIO_EXPORT_MAP:-$LIO_MAP}"
LIO_POINT_CLOUD_TOPIC="${LIO_POINT_CLOUD_TOPIC:-/scan/points_lio}"
# ---------- 试运行:只打印探测结果,不启动任何东西 ----------
# 排查"路径不对/版本不对"时先跑这个,比启动一半再失败好定位:
# SENTRY_DRY_RUN=1 scripts/sentry_up.sh
if [ "${SENTRY_DRY_RUN:-0}" != "0" ]; then
echo "[sentry_up] 试运行(不启动任何进程)"
@@ -76,13 +89,16 @@ if [ "${SENTRY_DRY_RUN:-0}" != "0" ]; then
echo " GZ 版本参数 = ${GZ_VER_ARGS[*]:-<无>}"
echo " FIELD_ROOT = $FIELD_ROOT"
echo " MAP_YAML = $MAP_YAML"
echo " LIO_MAP = $LIO_MAP"
echo " LIO_EXPORT_MAP = $LIO_EXPORT_MAP"
echo " LIO_POINT_CLOUD_TOPIC = $LIO_POINT_CLOUD_TOPIC"
echo " SENTRY_SIM_SHARE = $SENTRY_SIM_SHARE"
echo " ROS_DISTRO = ${ROS_DISTRO:-<未设>}"
echo " ROS 前缀 = ${AMENT_PREFIX_PATH%%:*}"
echo " HEADLESS/NAV2/RVIZ = $HEADLESS/$NAV2/$RVIZ"
echo " 可执行文件检查:"
for _n in self_filter odom_tf cmd_vel_relay patrol; do
if [ -x "${NAV_BIN_DIR}/${_n}" ]; then
if [ -f "${NAV_BIN_DIR}/${_n}" ] && [ -x "${NAV_BIN_DIR}/${_n}" ]; then
echo " ✅ ${_n}"
else
echo " ⚠️ ${_n} 不存在(用到它的部分会失败,先 xmake)"
@@ -92,7 +108,7 @@ if [ "${SENTRY_DRY_RUN:-0}" != "0" ]; then
fi
# UDPv4 is a transport default, not a guarantee that service discovery succeeds.
python3 "$WS/tools/dds_environment.py"
python3 "$INTERNAL_TOOLS/dds_environment.py"
# ROS 环境由上面的 env_source_ros 自动 source(逻辑在 env_common.sh),
# 不再写死 /opt/ros/<发行版>/setup.bash —— 换发行版不用改脚本。
@@ -100,7 +116,7 @@ python3 "$WS/tools/dds_environment.py"
# 没有资源索引,所以不能 `ros2 run`,只能直接跑路径。
nav_cmd() {
local node="$1"
if [ ! -x "${NAV_BIN_DIR}/${node}" ]; then
if [ ! -f "${NAV_BIN_DIR}/${node}" ] || [ ! -x "${NAV_BIN_DIR}/${node}" ]; then
echo "[sentry_up] ❌ 找不到可执行文件 ${NAV_BIN_DIR}/${node}" >&2
echo "[sentry_up] 先编译:cd ${WS} && xmake" >&2
echo "[sentry_up] 产物目录是自动探测的;不对就显式指定:" >&2
@@ -110,20 +126,25 @@ nav_cmd() {
echo "${NAV_BIN_DIR}/${node}"
}
export GZ_SIM_RESOURCE_PATH="${PKG_SHARE}/models:${FIELD_ROOT}/src/guodong_sentry_sim/models"
export GZ_SIM_RESOURCE_PATH="${PKG_SHARE}/models:${FIELD_ROOT}/src/guodong_sentry_sim/models${GZ_SIM_RESOURCE_PATH:+:$GZ_SIM_RESOURCE_PATH}"
export GZ_PARTITION="${GZ_PARTITION:-sentry}"
export ROS_DOMAIN_ID="${ROS_DOMAIN_ID:-0}" # 默认用 0,跟普通终端一致;要隔离时自己设
LOCALIZATION="${LOCALIZATION:-lio}"
LIO_MODE="${LIO_MODE:-localization}"
LIO_MAP="${LIO_MAP:-${WS}/generated/field.flmap}"
LIO_EXPORT_MAP="${LIO_EXPORT_MAP:-${LIO_MAP}}"
case "$LOCALIZATION" in lio) NAV2_LOCALIZATION=False ;; amcl) NAV2_LOCALIZATION=True ;; *) echo "LOCALIZATION must be lio or amcl" >&2; exit 1 ;; esac
case "$LIO_MODE" in mapping|localization) ;; *) echo "LIO_MODE must be mapping or localization" >&2; exit 1 ;; esac
if [ "$LOCALIZATION" = lio ] && [ "$LIO_MODE" = localization ] && [ ! -r "$LIO_MAP" ]; then
if [ "$LOCALIZATION" = lio ] && [ "$LIO_MODE" = localization ] && { [ ! -f "$LIO_MAP" ] || [ ! -r "$LIO_MAP" ]; }; then
echo "[sentry_up] missing LIO map: $LIO_MAP; first run LIO_MODE=mapping or choose LOCALIZATION=amcl" >&2
exit 1
fi
if [ "$LOCALIZATION" = lio ] && [ "$LIO_MODE" = mapping ]; then
mkdir -p "$(dirname -- "$LIO_EXPORT_MAP")"
fi
ODOM_TF_EXE="$(nav_cmd odom_tf)"
CMD_VEL_RELAY_EXE="$(nav_cmd cmd_vel_relay)"
SELF_FILTER_EXE="$(nav_cmd self_filter)"
if [ "$LOCALIZATION" = lio ]; then
LIO_EXE="$(nav_cmd field_localization_node)"
fi
WORLD="${PKG_SHARE}/worlds/sentry_arena.sdf"
PIDS=()
CLEANED=0
@@ -187,7 +208,7 @@ cleanup() {
trap cleanup EXIT INT TERM
if [ "$NAV2" = "1" ]; then
python3 "$WS/tools/nav2_startup.py" --preflight
python3 "$INTERNAL_TOOLS/nav2_startup.py" --preflight
fi
# ---------- 1. Gazebo(系统版,清掉 ROS vendor 的库路径)----------
@@ -203,34 +224,9 @@ GZ_PID=$!
PIDS+=("$GZ_PID")
# ---------- 2. 等 Gazebo 就绪(/clock 出现)----------
# 查话题也用 $GZ_EXE,而不是 PATH 上的 `gz`:source 过 ROS 之后 PATH 上是
# gz_tools_vendor 那份,和真正在跑的进程不一定同一个版本,容易误判。
echo -n "[sentry_up] 等 Gazebo 就绪"
GZ_READY=0
for _ in $(seq 1 120); do
# Gazebo 进程提前退出 → 立刻报错,不用干等满 120 秒
if ! kill -0 "$GZ_PID" 2>/dev/null; then
echo
echo "[sentry_up] ❌ Gazebo 启动失败,进程已退出" >&2
wait "$GZ_PID" 2>/dev/null || true
exit 1
fi
if env -u LD_LIBRARY_PATH "$GZ_EXE" topic -l 2>/dev/null | grep -qx '/clock'; then
GZ_READY=1
break
fi
echo -n "."
sleep 1
done
if [ "$GZ_READY" != "1" ]; then
echo
echo "[sentry_up] ❌ 等待 Gazebo 超时(120 s),没看到 /clock" >&2
echo "[sentry_up] 先确认 GZ_PARTITION=${GZ_PARTITION:-<未设>} 和其他终端一致" >&2
echo "[sentry_up] 再确认 Gazebo 窗口/进程还活着" >&2
exit 1
fi
echo " OK"
echo "[sentry_up] 等 Gazebo /clock"
env_wait_gz_clock "$GZ_EXE" --gazebo-pid "$GZ_PID"
echo "[sentry_up] Gazebo /clock 已就绪"
# ---------- 3. ros_gz 桥 ----------
echo "[sentry_up] 启动 ros_gz 桥"
@@ -265,7 +261,7 @@ PIDS+=($!)
# ---------- 5. odom -> base_link ----------
echo "[sentry_up] 启动 odom_tf(${NAV_BIN_DIR}/odom_tf,C++ 版)"
# SENTRY_ODOM_SCALE != 1.0 时给里程计加比例误差(演示 AMCL 纠正漂移用)
$(nav_cmd odom_tf) --ros-args \
"$ODOM_TF_EXE" --ros-args \
-p use_sim_time:=true -p "odom_scale:=${SENTRY_ODOM_SCALE:-1.0}" &
PIDS+=($!)
@@ -277,20 +273,20 @@ RELAY_HEALTH=false
if [ "$LOCALIZATION" = lio ]; then RELAY_HEALTH=true; fi
RELAY_INPUT=/cmd_vel
if [ "$RELAY_NAVIGATION" = false ]; then RELAY_INPUT="${MANUAL_CMD_VEL_TOPIC:-/cmd_vel}"; fi
$(nav_cmd cmd_vel_relay) --ros-args -p use_sim_time:=true \
"$CMD_VEL_RELAY_EXE" --ros-args -p use_sim_time:=true \
-p navigation_mode:="$RELAY_NAVIGATION" -p require_localization_health:="$RELAY_HEALTH" -p in_topic:="$RELAY_INPUT" &
PIDS+=($!)
# ---------- 5.55 点云自滤(剔除车身自身回波,Nav2 避障用)----------
echo "[sentry_up] 启动点云自滤(${NAV_BIN_DIR}/self_filter)"
$(nav_cmd self_filter) --ros-args -p use_sim_time:=true -p reliable_clouds:=true &
"$SELF_FILTER_EXE" --ros-args -p use_sim_time:=true -p reliable_clouds:=true &
PIDS+=($!)
# ---------- 5.6 唯一 map->odom 发布者:LIO 或 AMCL ----------
if [ "$LOCALIZATION" = lio ]; then
echo "[sentry_up] LIO mode=$LIO_MODE (AMCL disabled)"
$(nav_cmd field_localization_node) --ros-args -p use_sim_time:=true \
-p point_cloud_topic:=/scan/points_filtered -p imu_topic:=/imu -p reliable_clouds:=true \
echo "[sentry_up] LIO mode=$LIO_MODE map=$LIO_MAP cloud=$LIO_POINT_CLOUD_TOPIC (AMCL disabled)"
"$LIO_EXE" --ros-args -p use_sim_time:=true \
-p "point_cloud_topic:=$LIO_POINT_CLOUD_TOPIC" -p imu_topic:=/imu -p reliable_clouds:=true \
-p mode:="$LIO_MODE" -p map_path:="$LIO_MAP" -p export_map_path:="$LIO_EXPORT_MAP" \
-p publish_map_to_odom:=true -p "diagnostics_path:='${LIO_TRACE_PATH:-}'" \
-p initial_x:="${LIO_INITIAL_X:--5.0}" -p initial_y:="${LIO_INITIAL_Y:-3.0}" \
@@ -317,7 +313,7 @@ echo "体检(含 Gazebo 真值对照):python3 tools/check_stack.py"
# ---------- 6. Nav2 ----------
if [ "$NAV2" = "1" ]; then
python3 "$WS/tools/wait_navigation_ready.py"
python3 "$INTERNAL_TOOLS/wait_navigation_ready.py"
echo "[sentry_up] 启动 Nav2($LOCALIZATION + 栅格图)"
# 三个参数都是必需的,各有原因(踩过的坑):
# use_composition:=False 组合模式在本机起不来 —— /nav2_container 起来后一个组件都不加载,
@@ -328,7 +324,7 @@ if [ "$NAV2" = "1" ]; then
# 发现不到,lifecycle_manager 会无限等下去(日志刷
# "Waiting for service keepout_costmap_filter_info_server/get_state"),
# Nav2 永远不激活 → 所有导航目标被拒。我们不用禁入区/限速区,直接关掉。
python3 "$WS/tools/run_nav2.py" --timeout "${SENTRY_NAV2_TIMEOUT:-120}" -- \
python3 "$INTERNAL_TOOLS/run_nav2.py" --timeout "${SENTRY_NAV2_TIMEOUT:-120}" -- \
map:="${MAP_YAML}" \
use_sim_time:=true \
autostart:=False \