Beispiel #1
0
void Move::rotate(int angle) {
  changeMoveState(MOV_ROTATE);

#ifdef MOVE_DEBUG
  Serial.print(P("Rotating ")); 
  Serial.println(angle);
#endif

  if (angle < 0) {
#ifdef MOVE_DEBUG
    Serial.println(P(" (left)")); 
#endif
    motorReverse(MOTOR_LEFT,  speed); 
    motorForward(MOTOR_RIGHT, speed);  
  } else if (angle > 0) {
#ifdef MOVE_DEBUG
    Serial.println(P(" (right)"));
#endif
    motorForward(MOTOR_LEFT,  speed);
    motorReverse(MOTOR_RIGHT, speed);
  }  

  int ms = rotationAngleToTime(angle);

  movingDelay(ms); 
  brake();   
}
Beispiel #2
0
void Move::forward() {
  changeMoveState(MOV_FORWARD);
  motorForward(MOTOR_LEFT,  speed);
  motorForward(MOTOR_RIGHT, speed);
}
Beispiel #3
0
void Move::backward() {
  changeMoveState(MOV_BACK);
  motorReverse(MOTOR_LEFT, speed);
  motorReverse(MOTOR_RIGHT, speed);  
}
Beispiel #4
0
void Move::right() {
  changeMoveState(MOV_RIGHT);
  motorForward(MOTOR_LEFT,  speed);
  motorForward(MOTOR_RIGHT, 0);
}
Beispiel #5
0
void Move::brake() {
  changeMoveState(MOV_STOP);
  motorBrake(MOTOR_LEFT);
  motorBrake(MOTOR_RIGHT);
}
Beispiel #6
0
void Move::stop() {
  changeMoveState(MOV_STOP);
  motorStop(MOTOR_LEFT);
  motorStop(MOTOR_RIGHT);
}
Beispiel #7
0
void CSimpleEnemyController::start() {
  m_fTimeToNextAction = 2;
  m_vCurrentWalkDir = Ogre::Vector3::UNIT_X;
  changeMoveState(MS_NORMAL);
  m_eCurrentKIState = KI_PATROLING;
}
Beispiel #8
0
CSimpleEnemyController::CSimpleEnemyController(CPerson * ccPerson)
  : CPersonController(ccPerson), m_pPlayer(NULL) {
  changeMoveState(MS_USER_STATE);

  m_fMoveSpeed = 3;
}