< Summary

Class:IdealSensor
Assembly:bamlab.micromissiles
File(s):/github/workspace/Assets/Scripts/Sensors/IdealSensor.cs
Covered lines:16
Uncovered lines:0
Coverable lines:16
Total lines:37
Line coverage:100% (16 of 16)
Covered branches:0
Total branches:0
Covered methods:5
Total methods:5
Method coverage:100% (5 of 5)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
IdealSensor(...)0%110100%
Sense(...)0%110100%
Sense(...)0%110100%
Sense(...)0%110100%
GenerateSensorOutput(...)0%110100%

File(s)

/github/workspace/Assets/Scripts/Sensors/IdealSensor.cs

#LineLine coverage
 1using UnityEngine;
 2
 3// Ideal sensor.
 4//
 5// The ideal sensor provides perfect, noise-free measurements of the relative transformation between
 6// the sensing agent and a target. This sensor is useful for testing and establishing baseline
 7// behavior before adding realistic sensor noise and limitations.
 8public class IdealSensor : SensorBase {
 549  public IdealSensor(IAgent agent) : base(agent) {}
 10
 11  // Sense the target hierarchical object.
 312  public override SensorOutput Sense(IHierarchical hierarchical) {
 313    Transformation relativeTransformation = Agent.GetRelativeTransformation(hierarchical);
 314    return GenerateSensorOutput(relativeTransformation);
 315  }
 16
 17  // Sense the target agent.
 218  public override SensorOutput Sense(IAgent agent) {
 219    Transformation relativeTransformation = Agent.GetRelativeTransformation(agent);
 220    return GenerateSensorOutput(relativeTransformation);
 221  }
 22
 23  // Sense the waypoint.
 124  public override SensorOutput Sense(in Vector3 waypoint) {
 125    Transformation relativeTransformation = Agent.GetRelativeTransformation(waypoint);
 126    return GenerateSensorOutput(relativeTransformation);
 127  }
 28
 29  // Generate the sensor output from the relative transformation.
 630  private SensorOutput GenerateSensorOutput(in Transformation relativeTransformation) {
 631    return new SensorOutput {
 32      Position = relativeTransformation.Position,
 33      Velocity = relativeTransformation.Velocity,
 34      Acceleration = relativeTransformation.Acceleration,
 35    };
 636  }
 37}