Пример #1
0
 private void setSpeedReal(float speedLeft, float speedRight) {
   Log.i(LOG_TAG, "Setting speeds to " + speedLeft + ", " + speedRight);
   this.speedLeft = speedLeft;
   this.speedRight = speedRight;
   try {
     if (gameControl != null && gameControl.hasRobotControl()) {
       gameControl.setLeftMotorSpeed(speedLeft);
       gameControl.setRightMotorSpeed(speedRight);
       lastCommandTime = System.currentTimeMillis();
     }
   } catch (RemoteException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
Пример #2
0
 private void setFullStop(boolean fullStop) {
   // Stop the motors
   Log.i(LOG_TAG, "Fullstop: " + fullStop);
   try {
     if (gameControl != null && gameControl.hasRobotControl()) {
       if (fullStop && !gameControl.isAtFullStop()) {
         gameControl.setFullStop(true);
         return;
       }
       if (!fullStop && gameControl.isAtFullStop()) {
         gameControl.setFullStop(false);
         return;
       }
     }
   } catch (RemoteException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   // Add this to the SeekBars' change listener.
 }