< Summary

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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
IdealSensor(...)0%110100%
Sense(...)0%110100%
Sense(...)0%2100%
Sense(...)0%2100%
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 {
 29079  public IdealSensor(IAgent agent) : base(agent) {}
 10
 11  // Sense the target hierarchical object.
 166112  public override SensorOutput Sense(IHierarchical hierarchical) {
 166113    Transformation relativeTransformation = Agent.GetRelativeTransformation(hierarchical);
 166114    return GenerateSensorOutput(relativeTransformation);
 166115  }
 16
 17  // Sense the target agent.
 018  public override SensorOutput Sense(IAgent agent) {
 019    Transformation relativeTransformation = Agent.GetRelativeTransformation(agent);
 020    return GenerateSensorOutput(relativeTransformation);
 021  }
 22
 23  // Sense the waypoint.
 024  public override SensorOutput Sense(in Vector3 waypoint) {
 025    Transformation relativeTransformation = Agent.GetRelativeTransformation(waypoint);
 026    return GenerateSensorOutput(relativeTransformation);
 027  }
 28
 29  // Generate the sensor output from the relative transformation.
 166130  private SensorOutput GenerateSensorOutput(in Transformation relativeTransformation) {
 166131    return new SensorOutput {
 32      Position = relativeTransformation.Position,
 33      Velocity = relativeTransformation.Velocity,
 34      Acceleration = relativeTransformation.Acceleration,
 35    };
 166136  }
 37}