< Summary

Class:ApnController
Assembly:bamlab.micromissiles
File(s):/github/workspace/Assets/Scripts/Controller/ApnController.cs
Covered lines:7
Uncovered lines:0
Coverable lines:7
Total lines:17
Line coverage:100% (7 of 7)
Covered branches:0
Total branches:0
Covered methods:2
Total methods:2
Method coverage:100% (2 of 2)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ApnController(...)0%110100%
Plan(...)0%110100%

File(s)

/github/workspace/Assets/Scripts/Controller/ApnController.cs

#LineLine coverage
 1using UnityEngine;
 2
 3// The augmented proportional navigation controller applies an input that is proportional to the
 4// line-of-sight's rotation rate and adds a term to compensate for the target's acceleration.
 5public class ApnController : PnController {
 186  public ApnController(IAgent agent, float gain) : base(agent, gain) {}
 7
 8  // Controller-dependent implementation of the control law.
 69  protected override Vector3 Plan(in Transformation relativeTransformation) {
 610    Vector3 accelerationInput = base.Plan(relativeTransformation);
 11
 12    // Add a feedforward term proportional to the target's acceleration.
 613    Vector3 targetAcceleration = relativeTransformation.Acceleration.Cartesian;
 614    Vector3 normalTargetAcceleration = Vector3.ProjectOnPlane(targetAcceleration, Agent.Forward);
 615    return accelerationInput + Gain / 2 * normalTargetAcceleration;
 616  }
 17}