Initial commit

This commit is contained in:
2026-07-03 16:31:37 +07:00
commit 899c7c637d
1939 changed files with 641750 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
/*
* 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.Sensor;
/// <summary>
/// Protocol buffer representation of adaptive voxel filter options.
/// </summary>
public struct AdaptiveVoxelFilterOptions(double maxLength, double minNumPoints, double maxRange)
{
/// <summary>
/// Maximum length of a voxel edge.
/// </summary>
[JsonPropertyName("max_length")]
public double MaxLength { get; set; } = maxLength;
/// <summary>
/// If there are more points and not at least 'min_num_points' remain, the
/// voxel length is reduced trying to get this minimum number of points.
/// </summary>
[JsonPropertyName("min_num_points")]
public double MinNumPoints { get; set; } = minNumPoints;
/// <summary>
/// Points further away from the origin are removed.
/// </summary>
[JsonPropertyName("max_range")]
public double MaxRange { get; set; } = maxRange;
}

View File

@@ -0,0 +1,178 @@
/*
* 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 CartographerSharp.Models.Transform;
using System.Text.Json.Serialization;
namespace CartographerSharp.Models.Sensor;
/// <summary>
/// Protocol buffer representation of a rangefinder point.
/// </summary>
public struct RangefinderPoint(Vector3f position)
{
[JsonPropertyName("position")]
public Vector3f Position { get; set; } = position;
}
/// <summary>
/// Protocol buffer representation of a timed rangefinder point.
/// </summary>
public struct TimedRangefinderPoint(Vector3f position, double time)
{
[JsonPropertyName("position")]
public Vector3f Position { get; set; } = position;
[JsonPropertyName("time")]
public double Time { get; set; } = time;
}
/// <summary>
/// Compressed collection of a 3D point cloud.
/// </summary>
public struct CompressedPointCloud(int numPoints, List<int> pointData)
{
[JsonPropertyName("num_points")]
public int NumPoints { get; set; } = numPoints;
[JsonPropertyName("point_data")]
public List<int> PointData { get; set; } = pointData ?? [];
}
/// <summary>
/// Proto representation of ::cartographer::sensor::TimedPointCloudData.
/// </summary>
public struct TimedPointCloudData(
long timestamp,
Vector3f origin,
List<Vector4f>? pointDataLegacy = null,
List<TimedRangefinderPoint>? pointData = null,
List<double>? intensities = null)
{
[JsonPropertyName("timestamp")]
public long Timestamp { get; set; } = timestamp;
[JsonPropertyName("origin")]
public Vector3f Origin { get; set; } = origin;
[JsonPropertyName("point_data_legacy")]
public List<Vector4f> PointDataLegacy { get; set; } = pointDataLegacy ?? [];
[JsonPropertyName("point_data")]
public List<TimedRangefinderPoint> PointData { get; set; } = pointData ?? [];
[JsonPropertyName("intensities")]
public List<double> Intensities { get; set; } = intensities ?? [];
}
/// <summary>
/// Proto representation of ::cartographer::sensor::RangeData.
/// </summary>
public struct RangeData(
Vector3f origin,
List<Vector3f>? returnsLegacy = null,
List<Vector3f>? missesLegacy = null,
List<RangefinderPoint>? returns = null,
List<RangefinderPoint>? misses = null)
{
[JsonPropertyName("origin")]
public Vector3f Origin { get; set; } = origin;
[JsonPropertyName("returns_legacy")]
public List<Vector3f> ReturnsLegacy { get; set; } = returnsLegacy ?? [];
[JsonPropertyName("misses_legacy")]
public List<Vector3f> MissesLegacy { get; set; } = missesLegacy ?? [];
[JsonPropertyName("returns")]
public List<RangefinderPoint> Returns { get; set; } = returns ?? [];
[JsonPropertyName("misses")]
public List<RangefinderPoint> Misses { get; set; } = misses ?? [];
}
/// <summary>
/// Proto representation of ::cartographer::sensor::ImuData.
/// </summary>
public struct ImuData(long timestamp, Vector3d linearAcceleration, Vector3d angularVelocity)
{
[JsonPropertyName("timestamp")]
public long Timestamp { get; set; } = timestamp;
[JsonPropertyName("linear_acceleration")]
public Vector3d LinearAcceleration { get; set; } = linearAcceleration;
[JsonPropertyName("angular_velocity")]
public Vector3d AngularVelocity { get; set; } = angularVelocity;
}
/// <summary>
/// Proto representation of ::cartographer::sensor::OdometryData.
/// </summary>
public struct OdometryData(long timestamp, Rigid3dProto pose)
{
[JsonPropertyName("timestamp")]
public long Timestamp { get; set; } = timestamp;
[JsonPropertyName("pose")]
public Rigid3dProto Pose { get; set; } = pose;
}
/// <summary>
/// Proto representation of ::cartographer::sensor::FixedFramePoseData.
/// </summary>
public struct FixedFramePoseData(long timestamp, Rigid3dProto pose)
{
[JsonPropertyName("timestamp")]
public long Timestamp { get; set; } = timestamp;
[JsonPropertyName("pose")]
public Rigid3dProto Pose { get; set; } = pose;
}
/// <summary>
/// Proto representation of ::cartographer::sensor::LandmarkData.
/// </summary>
public struct LandmarkData(long timestamp, List<LandmarkData.LandmarkObservation>? landmarkObservations = null)
{
/// <summary>
/// Landmark observation within LandmarkData.
/// </summary>
public struct LandmarkObservation(
byte[] id,
Rigid3dProto landmarkToTrackingTransform,
double translationWeight,
double rotationWeight)
{
[JsonPropertyName("id")]
public byte[] Id { get; set; } = id ?? [];
[JsonPropertyName("landmark_to_tracking_transform")]
public Rigid3dProto LandmarkToTrackingTransform { get; set; } = landmarkToTrackingTransform;
[JsonPropertyName("translation_weight")]
public double TranslationWeight { get; set; } = translationWeight;
[JsonPropertyName("rotation_weight")]
public double RotationWeight { get; set; } = rotationWeight;
}
[JsonPropertyName("timestamp")]
public long Timestamp { get; set; } = timestamp;
[JsonPropertyName("landmark_observations")]
public List<LandmarkObservation> LandmarkObservations { get; set; } = landmarkObservations ?? [];
}