KIT-MRT / arbitration_graphs

Hierarchical behavior models for complex decision-making and behavior generation in robotics
https://kit-mrt.github.io/arbitration_graphs/
MIT License
15 stars 0 forks source link

getCommand is being called twice in CostArbitrator #62

Closed ll-nick closed 1 week ago

ll-nick commented 1 month ago

Since the CostArbitrator calls getCommand during sortOptionsByGivenPolicy, the getCommand is being called twice.

getCommand might be an expensive operation, so that's not ideal. One solution would be to cache the result of getCommand on the user end but of course that's not the best solution.

Another idea could be the following:

Instead of calling option->behavior->getCommand, Option could implement a wrapper around the behavior's getCommand. The Option class would then receive a util_caching::Cache<Command> and only actually call the getCommand of the underlying behavior if it has not been called before in the same time step.