Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit afabd225 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

PTOController: Added Duration

parent de3f4e42
No related branches found
No related tags found
No related merge requests found
...@@ -66,5 +66,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -66,5 +66,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
{ {
_ptoController.CommitSimulationStep(null); _ptoController.CommitSimulationStep(null);
} }
public Second Duration
{
get
{
if (_ptoController != null)
return _ptoController.Duration;
else {
return 0.SI<Second>();
}
}
}
} }
} }
\ No newline at end of file
using System.Linq;
using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
...@@ -14,9 +15,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -14,9 +15,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
set { NextComponent = value; } set { NextComponent = value; }
} }
public readonly Second Duration;
protected Second IdleStart; protected Second IdleStart;
public PTOCycleController(DrivingCycleData cycle) : base(null, cycle) {} public PTOCycleController(DrivingCycleData cycle) : base(null, cycle)
{
Duration = Data.Entries.Last().Time - Data.Entries.First().Time;
}
public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity,
bool dryRun = false) bool dryRun = false)
...@@ -55,7 +61,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -55,7 +61,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
if (RightSample.Current == null) if (RightSample.Current == null)
return null; return null;
return RightSample.Current.Time; return RightSample.Current.Time - LeftSample.Current.Time;
} }
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment