Initial commit
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* 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.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
using CartographerSharp.Models.Transform;
|
||||
|
||||
namespace CartographerSharp.Models.Mapping;
|
||||
|
||||
/// <summary>
|
||||
/// Active area of the submap.
|
||||
/// </summary>
|
||||
public struct ActiveArea
|
||||
{
|
||||
[JsonPropertyName("min_x")]
|
||||
public double MinX { get; set; }
|
||||
|
||||
[JsonPropertyName("min_y")]
|
||||
public double MinY { get; set; }
|
||||
|
||||
[JsonPropertyName("max_x")]
|
||||
public double MaxX { get; set; }
|
||||
|
||||
[JsonPropertyName("max_y")]
|
||||
public double MaxY { get; set; }
|
||||
|
||||
[JsonPropertyName("origin")]
|
||||
public Rigid3dProto Origin { get; set; }
|
||||
|
||||
public ActiveArea(double minX, double minY, double maxX, double maxY, Rigid3dProto origin)
|
||||
{
|
||||
MinX = minX;
|
||||
MinY = minY;
|
||||
MaxX = maxX;
|
||||
MaxY = maxY;
|
||||
Origin = origin;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serialized state of a Submap2D.
|
||||
/// </summary>
|
||||
public struct Submap2D
|
||||
{
|
||||
[JsonPropertyName("local_pose")]
|
||||
public Rigid3dProto LocalPose { get; set; }
|
||||
|
||||
[JsonPropertyName("num_range_data")]
|
||||
public int NumRangeData { get; set; }
|
||||
|
||||
[JsonPropertyName("finished")]
|
||||
public bool Finished { get; set; }
|
||||
|
||||
[JsonPropertyName("grid")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public Grid2D? Grid { get; set; }
|
||||
|
||||
[JsonPropertyName("active_area")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public ActiveArea? ActiveArea { get; set; }
|
||||
|
||||
[JsonPropertyName("merged_from_others")]
|
||||
public bool MergedFromOthers { get; set; }
|
||||
|
||||
public Submap2D(
|
||||
Rigid3dProto localPose,
|
||||
int numRangeData,
|
||||
bool finished,
|
||||
Grid2D? grid = null,
|
||||
ActiveArea? activeArea = null,
|
||||
bool mergedFromOthers = false)
|
||||
{
|
||||
LocalPose = localPose;
|
||||
NumRangeData = numRangeData;
|
||||
Finished = finished;
|
||||
Grid = grid;
|
||||
ActiveArea = activeArea;
|
||||
MergedFromOthers = mergedFromOthers;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serialized state of a Submap3D.
|
||||
/// </summary>
|
||||
public struct Submap3D
|
||||
{
|
||||
[JsonPropertyName("local_pose")]
|
||||
public Rigid3dProto LocalPose { get; set; }
|
||||
|
||||
[JsonPropertyName("num_range_data")]
|
||||
public int NumRangeData { get; set; }
|
||||
|
||||
[JsonPropertyName("finished")]
|
||||
public bool Finished { get; set; }
|
||||
|
||||
[JsonPropertyName("high_resolution_hybrid_grid")]
|
||||
public HybridGrid HighResolutionHybridGrid { get; set; }
|
||||
|
||||
[JsonPropertyName("low_resolution_hybrid_grid")]
|
||||
public HybridGrid LowResolutionHybridGrid { get; set; }
|
||||
|
||||
[JsonPropertyName("rotational_scan_matcher_histogram")]
|
||||
public List<double> RotationalScanMatcherHistogram { get; set; }
|
||||
|
||||
public Submap3D(
|
||||
Rigid3dProto localPose,
|
||||
int numRangeData,
|
||||
bool finished,
|
||||
HybridGrid highResolutionHybridGrid,
|
||||
HybridGrid lowResolutionHybridGrid,
|
||||
List<double>? rotationalScanMatcherHistogram = null)
|
||||
{
|
||||
LocalPose = localPose;
|
||||
NumRangeData = numRangeData;
|
||||
Finished = finished;
|
||||
HighResolutionHybridGrid = highResolutionHybridGrid;
|
||||
LowResolutionHybridGrid = lowResolutionHybridGrid;
|
||||
RotationalScanMatcherHistogram = rotationalScanMatcherHistogram ?? new List<double>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user