< Summary

Information
Class: Trailblazer.Navigation.Motor.GroundCondition
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Motor/Surface/GroundCondition.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 63
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_GroundNormal()100%22100%
Clone()100%11100%
RecordData(...)100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Motor/Surface/GroundCondition.cs

#LineLine coverage
 1//=======================================================================
 2// GroundCondition.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System;
 9using Chronicler;
 10using FixedMathSharp;
 11
 12namespace Trailblazer.Navigation.Motor;
 13
 14/// <summary>
 15/// Represents the state of the surface the scout is interacting with, including surface movement and normal data.
 16/// </summary>
 17[Serializable]
 18public struct GroundCondition : IRecordable
 19{
 20    /// <summary>
 21    /// The host-provided sampled platform state the scout is currently standing on.
 22    /// </summary>
 23    public PlatformSnapshot Platform;
 24
 25    /// <summary>
 26    /// The current surface friction applied to movement.
 27    /// </summary>
 28    public Fixed64 SurfaceFriction;
 29
 30    /// <summary>
 31    /// Determines how the scout inherits movement from the ground surface when the sampled platform is not inert.
 32    /// </summary>
 33    public MotionTransfer MotionTransferState;
 34
 35    /// <summary>
 36    /// Convenience normal derived from the sampled platform transform.
 37    /// </summary>
 88438    public readonly Vector3d GroundNormal => Platform.Active ? Platform.Transform.Up : Vector3d.Zero;
 39
 40    /// <summary>
 41    /// Creates a new GroundCondition instance that is a copy of the current instance.
 42    /// </summary>
 43    /// <remarks>
 44    /// The returned object is a shallow copy. Reference-type properties are not deeply cloned.
 45    /// </remarks>
 46    /// <returns>
 47    /// A new GroundCondition object with the same Platform, SurfaceFriction, and MotionTransferState values as the curr
 48    /// </returns>
 30749    public GroundCondition Clone() => new()
 30750    {
 30751        Platform = Platform,
 30752        SurfaceFriction = SurfaceFriction,
 30753        MotionTransferState = MotionTransferState
 30754    };
 55
 56    /// <inheritdoc/>
 57    public void RecordData(IChronicler chronicler)
 58    {
 22959        chronicler.LookDeepStruct(ref Platform, "Platform");
 22960        chronicler.LookValue(ref SurfaceFriction, "SurfaceFriction", Fixed64.Zero);
 22961        chronicler.LookValue(ref MotionTransferState, "MotionTransferState", MotionTransfer.None);
 22962    }
 63}