void MONEEControlArchitecture::step() {
    bool done = false;
    while (!done) {
        switch (_wm->_action) {
            case ACTION_SELECT:
                select();
                _wm->advance();
                break;
            case ACTION_ACTIVATE :
                reset();
                _wm->_phase = PHASE_GATHERING;
                _wm->setRobotLED_colorValues(34, 139, 34);
                _wm->advance();
                break;
            case ACTION_GATHER :
                updateActuators();
                _wm->advance();
                // Last turn of gathering can't be combined with the braking turn.
                done = true;
                break;
            case ACTION_BRAKE :
                _wm->_desiredTranslationalValue = 0;
                _wm->_desiredRotationalVelocity = 0;
                _wm->_phase = PHASE_MATING;
                _wm->setRobotLED_colorValues(255, 69, 0);
                _wm->advance();
                break;
            case ACTION_MATE :
                updateGenomes();
                // Last turn of mating can be combined with selection, activation and first turn of gathering
                if (_wm->advance() > 0) done = true;
                break;
        }

    }
}
示例#2
0
// This update function should be called every second
void Control::update() {
    updateSensors();
    updatePids();
    updateActuators();
    mutex->update();
}