#include "utility/scheduling/TaskDecoratorRepeat.h" TaskDecoratorRepeat::TaskDecoratorRepeat(ConditionType condition, TaskState exitState) : m_condition(condition) , m_exitState(exitState) { } void TaskDecoratorRepeat::doEnter(std::shared_ptr blackboard) { } Task::TaskState TaskDecoratorRepeat::doUpdate(std::shared_ptr blackboard) { TaskState state = m_taskRunner->update(blackboard); switch (m_condition) { case CONDITION_WHILE_SUCCESS: if (state == Task::STATE_SUCCESS) { m_taskRunner->reset(); state = Task::STATE_RUNNING; } else if (state == Task::STATE_FAILURE) { state = m_exitState; } break; } return state; } void TaskDecoratorRepeat::doExit(std::shared_ptr blackboard) { } void TaskDecoratorRepeat::doReset(std::shared_ptr blackboard) { m_taskRunner->reset(); }