Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capstone active sensing #962

Merged
merged 2 commits into from
Apr 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,9 @@ private IEnumerable<IListeningProbe> Probes
{
get
{
IProbe probe;

//it is worth noting that there is a bug in TryGetProbe if it is called with a more specific interface than IProbe
//this is the reason why we pass in IProbe and then typecast to IListeningProbe after the probe is returned
if(Protocol.TryGetProbe<ILinearAccelerationDatum, IProbe>(out probe))
if (Protocol.TryGetProbe<ILinearAccelerationDatum, IProbe>(out IProbe probe))
{
yield return (IListeningProbe)probe;
}
Expand Down Expand Up @@ -315,19 +313,19 @@ protected override async Task OnStateChangedAsync(SensingAgentState previousStat
throw new Exception("Error, opportunistic control should be disabled for this agent");
}

if ( currentState == SensingAgentState.ActiveControl)
if (currentState == SensingAgentState.ActiveControl || currentState == SensingAgentState.ActiveObservation)
{
foreach(var probe in Probes)
{
probe.MaxDataStoresPerSecond = ProbeHz;
await probe.RestartAsync(); //whether the probe is stopped or currently running this should refresh
await probe.RestartAsync(); //this will work when whether the probes are stopped or currently running
}
}
else if (currentState == SensingAgentState.EndingControl)
else if (currentState == SensingAgentState.Idle)
{
foreach(var probe in Probes)
{
await probe.StopAsync(); //whether or not the probe is already stopped this should not cause an issue
await probe.StopAsync(); //this will work whether or not the probe is already stopped
}
}
}
Expand Down