Class DwellDetector
Tracks whether a continuous hold within a distance threshold has been maintained for the required dwell duration.
Inherited Members
Namespace: MOSAIC.Components.Tests.TAC
Assembly: MOSAIC.dll
Syntax
public sealed class DwellDetector
Remarks
Each call to Update(double, double) advances the state machine:
if distance ≤ threshold, the internal timer accumulates;
if the distance exceeds the threshold after being inside, an overshoot is counted
and the timer resets. Once the accumulated hold time reaches DwellTime,
IsComplete becomes true.
Call Reset() at the start of each new trial.
Constructors
DwellDetector(double, double)
Initializes a new DwellDetector.
Declaration
public DwellDetector(double dwellTime, double threshold)
Parameters
| Type | Name | Description |
|---|---|---|
| double | dwellTime | Required hold duration in seconds. |
| double | threshold | Maximum L2 distance for "in target". |
Fields
_entryTime
Declaration
private double _entryTime
Field Value
| Type | Description |
|---|---|
| double |
Properties
DwellTime
Required continuous hold duration in seconds.
Declaration
public double DwellTime { get; }
Property Value
| Type | Description |
|---|---|
| double |
HoldProgress
Hold progress towards dwell time [0, 1].
Declaration
public double HoldProgress { get; private set; }
Property Value
| Type | Description |
|---|---|
| double |
HoldTime
Continuous time spent within the threshold since last entry.
Declaration
public double HoldTime { get; private set; }
Property Value
| Type | Description |
|---|---|
| double |
InTarget
Whether the prediction is currently within the threshold.
Declaration
public bool InTarget { get; private set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsComplete
Whether the dwell time has been fully satisfied.
Declaration
public bool IsComplete { get; private set; }
Property Value
| Type | Description |
|---|---|
| bool |
Overshoots
Number of times the prediction left the target zone this trial.
Declaration
public int Overshoots { get; private set; }
Property Value
| Type | Description |
|---|---|
| int |
Threshold
Maximum L2 distance to count as "in target".
Declaration
public double Threshold { get; }
Property Value
| Type | Description |
|---|---|
| double |
Methods
Reset()
Resets the detector for a new trial.
Declaration
public void Reset()
Update(double, double)
Advances the dwell state machine with the current distance and timestamp.
Declaration
public void Update(double distance, double now)
Parameters
| Type | Name | Description |
|---|---|---|
| double | distance | Current L2 distance to target. |
| double | now | Current time in seconds (monotonic). |