68 lines
2.0 KiB
C#
68 lines
2.0 KiB
C#
/*
|
|
* Copyright 2018 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 grid options for 2D.
|
|
/// </summary>
|
|
public struct GridOptions2D
|
|
{
|
|
public enum GridType
|
|
{
|
|
InvalidGrid = 0,
|
|
ProbabilityGrid = 1,
|
|
Tsdf = 2
|
|
}
|
|
|
|
[JsonPropertyName("grid_type")]
|
|
public GridType GridTypeValue { get; set; }
|
|
|
|
[JsonPropertyName("resolution")]
|
|
public double Resolution { get; set; }
|
|
|
|
[JsonPropertyName("tsdf_options")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public TSDFOptions2D? TsdfOptions { get; set; }
|
|
|
|
public GridOptions2D(GridType gridType, double resolution, TSDFOptions2D? tsdfOptions = null)
|
|
{
|
|
GridTypeValue = gridType;
|
|
Resolution = resolution;
|
|
TsdfOptions = tsdfOptions;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Options for TSDF2D grid.
|
|
/// </summary>
|
|
public struct TSDFOptions2D
|
|
{
|
|
[JsonPropertyName("truncation_distance")]
|
|
public double TruncationDistance { get; set; }
|
|
|
|
[JsonPropertyName("max_weight")]
|
|
public double MaxWeight { get; set; }
|
|
|
|
public TSDFOptions2D(double truncationDistance, double maxWeight)
|
|
{
|
|
TruncationDistance = truncationDistance;
|
|
MaxWeight = maxWeight;
|
|
}
|
|
}
|
|
}
|