[Simulator] TargetChangerController wrong index for non-absorbing targets
Summary
What is the current bug behavior?
If the target is changed by a TargetChanger
, the nextTargetListIndex > 0.
In this case, the next target id is returned over the targetIds.get(nextTargetListIndex) in Agent
public int getNextTargetId() {
// Deprecated target list usage
if (nextTargetListIndex == -1) {
return targetIds.getFirst();
}
// The right way:
**return targetIds.get(nextTargetListIndex);**
}
If agents steps on non-observing targets, the list index is incremented. See TargetController
:
if (nextTargetListIndex != -1) {
if (nextTargetListIndex < agent.getTargets().size()) {
agent.incrementNextTargetListIndex();
}
}
In the next simulation step, a null pointer is thrown if the index is out of bound.
What is the expected correct behavior?
Use the next available target in an agent's targetIds