Files
BQP/srcs/RobotNet10/RobotApp/Communication/CartographerSharp/Models/Mapping/OptimizationProblemOptions.cs
2026-07-13 09:25:40 +07:00

103 lines
3.7 KiB
C#

/*
* Copyright 2016 The Cartographer Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Text.Json.Serialization;
namespace CartographerSharp.Models.Mapping;
/// <summary>
/// Protocol buffer representation of optimization problem options.
/// </summary>
public struct OptimizationProblemOptions
{
[JsonPropertyName("huber_scale")]
public double HuberScale { get; set; }
[JsonPropertyName("odometry_huber_scale")]
public double OdometryHuberScale { get; set; }
[JsonPropertyName("local_slam_pose_huber_scale")]
public double LocalSlamPoseHuberScale { get; set; }
[JsonPropertyName("odometry_translation_weight")]
public double OdometryTranslationWeight { get; set; }
[JsonPropertyName("odometry_rotation_weight")]
public double OdometryRotationWeight { get; set; }
[JsonPropertyName("local_slam_pose_translation_weight")]
public double LocalSlamPoseTranslationWeight { get; set; }
[JsonPropertyName("local_slam_pose_rotation_weight")]
public double LocalSlamPoseRotationWeight { get; set; }
[JsonPropertyName("fixed_frame_pose_translation_weight")]
public double FixedFramePoseTranslationWeight { get; set; }
[JsonPropertyName("fixed_frame_pose_rotation_weight")]
public double FixedFramePoseRotationWeight { get; set; }
[JsonPropertyName("fixed_frame_pose_use_tolerant_loss")]
public bool FixedFramePoseUseTolerantLoss { get; set; }
[JsonPropertyName("fixed_frame_pose_tolerant_loss_param_a")]
public double FixedFramePoseTolerantLossParamA { get; set; }
[JsonPropertyName("fixed_frame_pose_tolerant_loss_param_b")]
public double FixedFramePoseTolerantLossParamB { get; set; }
[JsonPropertyName("log_solver_summary")]
public bool LogSolverSummary { get; set; }
/// <summary>
/// Maximum number of iterations for the Ceres solver.
/// </summary>
[JsonPropertyName("max_num_iterations")]
public int MaxNumIterations { get; set; }
/// <summary>
/// Scaling parameter for the IMU acceleration term.
/// </summary>
[JsonPropertyName("acceleration_weight")]
public double AccelerationWeight { get; set; }
/// <summary>
/// Scaling parameter for the IMU rotation term.
/// </summary>
[JsonPropertyName("rotation_weight")]
public double RotationWeight { get; set; }
public OptimizationProblemOptions()
{
HuberScale = 1.0;
OdometryHuberScale = 1.0;
LocalSlamPoseHuberScale = 1.0;
OdometryTranslationWeight = 1.0;
OdometryRotationWeight = 1.0;
LocalSlamPoseTranslationWeight = 1.0;
LocalSlamPoseRotationWeight = 1.0;
FixedFramePoseTranslationWeight = 1.0;
FixedFramePoseRotationWeight = 1.0;
FixedFramePoseUseTolerantLoss = false;
FixedFramePoseTolerantLossParamA = 1.0;
FixedFramePoseTolerantLossParamB = 1.0;
LogSolverSummary = false;
MaxNumIterations = 50; // Default for pose graph optimization
AccelerationWeight = 8.0; // Default from C++ proto
RotationWeight = 9.0; // Default from C++ proto
}
}