[fix] fixed child groups lagging a tick behind their parent
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user