private void avoidWalls() { currentStateController.stop(); final AvoidWallStateController avoidWallController = new AvoidWallStateController(robotModel); currentStateController = avoidWallController; Thread avoidWallThread = new Thread( new Runnable() { public void run() { avoidWallController.controlState(); } }); avoidWallThread.start(); }
private void collectGroundBalls() { currentStateController.stop(); final BallCollectionStateController ballCollectionController = new BallCollectionStateController(robotModel, camera); currentStateController = ballCollectionController; Thread ballCollectionThread = new Thread( new Runnable() { public void run() { while (!ballCollectionController.isDone()) { ballCollectionController.controlState(); } } }); ballCollectionThread.start(); }