using RobotNet10.RobotApp.Shared;
namespace RobotNet10.RobotApp.SLAM.Cartographer;
public class MapCartographerInfo : MapInfo
{
///
/// Cartographer configuration snapshot khi map được save
/// Dùng để validate khi load map
///
public MapCartographerConfigSnapshot? MapConfig { get; init; }
}
///
/// Snapshot của CartographerConfiguration khi save map
/// Chỉ lưu các phần cần thiết để recreate MapBuilder
///
public class MapCartographerConfigSnapshot
{
///
/// Use 2D or 3D trajectory builder
///
public bool Use2D { get; init; }
///
/// MapBuilder configuration snapshot
///
public MapCarographerBuilderConfigSnapshot MapBuilder { get; init; } = new();
///
/// TrajectoryBuilder configuration snapshot (chỉ các phần quan trọng)
///
public TrajectoryBuilderConfigSnapshot TrajectoryBuilder { get; init; } = new();
}
///
/// Snapshot của MapBuilderConfiguration
///
public class MapCarographerBuilderConfigSnapshot
{
public bool? UseTrajectoryBuilder2D { get; init; }
public bool? UseTrajectoryBuilder3D { get; init; }
public int NumBackgroundThreads { get; init; }
public int OptimizeEveryNNodes { get; init; }
public double MatcherTranslationWeight { get; init; }
public double MatcherRotationWeight { get; init; }
public int? MaxNumFinalIterations { get; init; }
public double? GlobalSamplingRatio { get; init; }
public bool? LogResidualHistograms { get; init; }
public double? GlobalConstraintSearchAfterNSeconds { get; init; }
public bool EnableSingleTrajectoryLoopClosure { get; init; } = true;
public double SingleTrajectoryLoopClosureDistanceThreshold { get; init; } = 3.0;
public OptimizationProblemOptionsSnapshot OptimizationProblemOptions { get; init; } = new();
}
///
/// Snapshot của OptimizationProblemOptions
///
public class OptimizationProblemOptionsSnapshot
{
public double HuberScale { get; init; }
public double AccelerationWeight { get; init; }
public double RotationWeight { get; init; }
public double LocalSlamPoseTranslationWeight { get; init; }
public double LocalSlamPoseRotationWeight { get; init; }
public double OdometryTranslationWeight { get; init; }
public double OdometryRotationWeight { get; init; }
public double FixedFramePoseTranslationWeight { get; init; }
public double FixedFramePoseRotationWeight { get; init; }
public bool FixedFramePoseUseTolerantLoss { get; init; }
public double FixedFramePoseTolerantLossParamA { get; init; }
public double FixedFramePoseTolerantLossParamB { get; init; }
public bool LogSolverSummary { get; init; }
public int MaxNumIterations { get; init; }
}
///
/// Snapshot của TrajectoryBuilderConfiguration (chỉ các phần quan trọng)
///
public class TrajectoryBuilderConfigSnapshot
{
public bool Use2D { get; init; }
public double MinRange { get; init; }
public double MaxRange { get; init; }
public double? MinZ { get; init; }
public double? MaxZ { get; init; }
public double? MissingDataRayLength { get; init; }
public double VoxelFilterSize { get; init; }
public int NumAccumulatedRangeData { get; init; }
public bool? UseImuData { get; init; }
public bool UseOnlineCorrelativeScanMatching { get; init; }
}
///
/// Result from loading map files (pbstream path and saved config)
/// Used to separate file loading from CartographerSharp MapBuilder creation
///
public class MapCartographerLoadResult
{
///
/// Đường dẫn đến file .pbstream
///
public string PbstreamPath { get; init; } = string.Empty;
///
/// Đường dẫn đến map folder
///
public string MapPath { get; init; } = string.Empty;
///
/// Cartographer configuration snapshot khi map được save (nếu có)
///
public MapCartographerConfigSnapshot? SavedConfig { get; init; }
}