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

101 lines
3.0 KiB
C#

/*
* Copyright 2017 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.Sensor;
using CartographerSharp.Transform;
using RobotNet10.Shared.Numbers;
namespace CartographerSharp.Mapping;
/// <summary>
/// Interface for pose extrapolation.
/// </summary>
public interface IPoseExtrapolator
{
/// <summary>
/// Returns the time of the last added pose or long.MinValue if no pose was added yet.
/// </summary>
long GetLastPoseTime();
/// <summary>
/// Returns the time of the last extrapolated pose.
/// </summary>
long GetLastExtrapolatedTime();
/// <summary>
/// Adds a pose at the given time.
/// </summary>
void AddPose(long time, Rigid3d pose);
/// <summary>
/// Adds IMU data.
/// </summary>
void AddImuData(ImuData imuData);
/// <summary>
/// Adds odometry data.
/// </summary>
void AddOdometryData(OdometryData odometryData);
/// <summary>
/// Extrapolates pose to the given time.
/// </summary>
Rigid3d ExtrapolatePose(long time);
/// <summary>
/// Extrapolates pose with low-pass filter to reduce jitter during direction changes.
/// Match C++: ExtrapolatePose_filter
/// </summary>
Rigid3d ExtrapolatePoseFilter(long time);
/// <summary>
/// Extrapolates poses with gravity for multiple times.
/// </summary>
ExtrapolationResult ExtrapolatePosesWithGravity(List<long> times);
/// <summary>
/// Returns the current gravity alignment estimate as a rotation from
/// the tracking frame into a gravity aligned frame.
/// </summary>
Quaternion EstimateGravityOrientation(long time);
}
/// <summary>
/// Result of pose extrapolation with gravity.
/// </summary>
public struct ExtrapolationResult
{
/// <summary>
/// The poses for the requested times at index 0 to N-1 (previous poses).
/// </summary>
public List<Rigid3f> PreviousPoses { get; set; }
/// <summary>
/// The pose for the requested time at index N (current pose).
/// </summary>
public Rigid3d CurrentPose { get; set; }
/// <summary>
/// Current velocity estimate.
/// </summary>
public Vector3 CurrentVelocity { get; set; }
/// <summary>
/// Gravity alignment estimate as a rotation from the tracking frame into a gravity aligned frame.
/// </summary>
public Quaternion GravityFromTracking { get; set; }
}