/** * crosses the bridge without right bumper. */ bool StrategyAttackBadBumperCL::findAndCrossBridgeNoRightBumper() { bridgeDetectionByCenter_ = true; const bool TURN_ON_RIGHT_WHEEL = false; while (true) { bridge_ = BRIDGE_POS_CENTER; Log->bridge(bridge_); // try again, if failed... if (!gotoBridgeEntry()) continue; if (gotoBridgeEntryRotateToSeeBridge(TURN_ON_RIGHT_WHEEL)) { // use sioux, as the bridge is in the correct position. if (gotoBridgeEntry() && crossBridge()) { skittleMiddleProcessed_ = true; return true; } } else { bridge_ = BRIDGE_POS_BORDURE; Log->bridge(bridge_); unsigned int retries = 0; while (retries < 5) { if (gotoBridgeEntry()) break; retries ++; } // if we failed 5 times try the whole thing again. if (retries == 5) continue; if (gotoBridgeEntryRotateToSeeBridge(TURN_ON_RIGHT_WHEEL)) { if (crossBridge()) return true; } else { bridge_ = BRIDGE_POS_MIDDLE_BORDURE; Log->bridge(bridge_); retries = 0; while (retries < 5) { if (gotoBridgeEntry() && crossBridge()) return true; retries++; } } } if (checkEndEvents()) return false; } return false; }
// --------------------------------------------------------------------------- // fonction qui boucle jusqu'a ce que le robot ait traverse le pont ou // que ce soit la fin du match // -------------------------------------------------------------------------- bool StrategyAttackCL::findAndCrossBridge() { while (true) { if (gotoBridgeEntry()) { if (crossBridge()) { if (bridgeDetectionByCenter_ && (bridge_ == BRIDGE_POS_CENTER || bridge_ == BRIDGE_POS_MIDDLE_CENTER) ) { // on est passe par le pont du milieu, on fait tomber les // quilles qui y etaient skittleMiddleProcessed_=true; } return true; } } if (checkEndEvents()) return false; getNearestBridgeEntry(); // met a jour bridge avec une autre // position de pont a explorer } }
/******************************************************************************* * function driveBicycle() - used by a Bicycle thread, simply calls crossBridge() * passing in the current state as a parameter. ******************************************************************************/ void *rideBicycle(void *threadarg){ crossBridge((vstate_t *)threadarg); }
/******************************************************************************* * function driveTruck() - used by a Truck thread, simply calls crossBridge() * passing in the current state as a parameter. ******************************************************************************/ void *driveTruck(void *threadarg){ crossBridge((vstate_t *)threadarg); }
/******************************************************************************* * function driveCar() - used by a Car thread, simply calls crossBridge() * passing in the current state as a parameter. ******************************************************************************/ void *driveCar(void *threadarg){ crossBridge((vstate_t *)threadarg); }