From 446e4268f1f00dea0e59f3723181e24bbc5b33a4 Mon Sep 17 00:00:00 2001 From: Pascal Date: Wed, 29 Jan 2020 01:19:11 -0600 Subject: [PATCH] [fix] fixed child groups lagging a tick behind their parent --- src/main/scala/scim/components/Simulation.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/scala/scim/components/Simulation.scala b/src/main/scala/scim/components/Simulation.scala index 05f31ba..d5830ff 100644 --- a/src/main/scala/scim/components/Simulation.scala +++ b/src/main/scala/scim/components/Simulation.scala @@ -69,9 +69,10 @@ class Simulation(config: Configuration) { // overwrite truth with value from configuration if this is the root group val prevTruth = if(subGroup.parent.isEmpty && !configTruths.isEmpty && configTruths.get.contains(subGroup)) { configTruths.get(subGroup) - // make sure parent actually calculates a ground truth + // make sure parent actually calculates a ground truth and is not a sensor child } else if(prevTruths.contains(subGroupParent) && subGroupParent.sensorParent.isEmpty) { - prevTruths(subGroupParent) + // pass the parents result of this tick instead of previous truth to child, to avoid lagging a tick behind + if(subGroup == subGroupParent) prevTruths(subGroup) else resultTruths(subGroupParent) } else { // this can happen if sensor parent has another sensor parent // TODO: A sensor with parent should not have children (warn in parser)