/* * 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; /// /// Protocol buffer representation of a trajectory. /// public struct Trajectory { /// /// Node within a trajectory. /// public struct Node { /// /// Index of this node within its trajectory. /// [JsonPropertyName("node_index")] public int NodeIndex { get; set; } /// /// Timestamp of this node. /// [JsonPropertyName("timestamp")] public long Timestamp { get; set; } /// /// Transform from tracking to global map frame. /// [JsonPropertyName("pose")] public Rigid3dProto Pose { get; set; } public Node(int nodeIndex, long timestamp, Rigid3dProto pose) { NodeIndex = nodeIndex; Timestamp = timestamp; Pose = pose; } } /// /// Submap within a trajectory. /// public struct Submap { /// /// Index of this submap within its trajectory. /// [JsonPropertyName("submap_index")] public int SubmapIndex { get; set; } /// /// Transform from submap to global map frame. /// [JsonPropertyName("pose")] public Rigid3dProto Pose { get; set; } public Submap(int submapIndex, Rigid3dProto pose) { SubmapIndex = submapIndex; Pose = pose; } } /// /// ID of this trajectory. /// [JsonPropertyName("trajectory_id")] public int TrajectoryId { get; set; } /// /// Time-ordered sequence of Nodes. /// [JsonPropertyName("node")] public List Nodes { get; set; } /// /// Submaps associated with the trajectory. /// [JsonPropertyName("submap")] public List Submaps { get; set; } public Trajectory(int trajectoryId, List? nodes = null, List? submaps = null) { TrajectoryId = trajectoryId; Nodes = nodes ?? new List(); Submaps = submaps ?? new List(); } }