Example #1
0
void CalibrateGate()
{
  int i;

  PromptFor("Disengage Gate");

  enable_servos();
  Gate(0);
  PromptFor("Re-engage at top");
  printf("Testing...");
  for (i = 3; i >= 0; i--)
    {
    printf("%d", i);
    sleep(1.0);
    }
  printf("\n");
  for (i = 0; i < 5; i++)
    {
    Gate(1);
    sleep(5.0);
    Gate(0);
    sleep(1.0);
    }
  disable_servos();  
}
Example #2
0
void DumpBall()
{
  DebugStop("Dump Ball");
  while (1)
    {
    Lookdown();
    if (iSight == iMe)
      {
      DebugStop("Dumping");
      fBallRelease = 1;
      Gate(0);
      Hard(-70);
      msleep(1000L);
      if (fBlocked)
      	Unbind();
      Move(-200,-200);
      Move(50, 50);
      Hard(-90);
      fBallRelease = 0;
      fBall = 0;
      break;
      }
    Move(300, 300);
    if (fBlocked)
    	{
    	if (rgfBlock[3]) Hard(-10);
    	else Hard(10);
    	}
    }
}
bool
GateKeeper::RegisterGate( const std::string gate_name )
{
   if( GateExists( gate_name ) ) return( false );
   gates.insert( std::make_pair( gate_name, Gate( num_processors ) ) );
   return( true );
}
Example #4
0
int FBallCapture()
{
  if (fBall && !fBallRelease && !fGateDown)
    {
    Gate(1);
    return 1;
    }
  return 0;
}
Example #5
0
Gate Gate::Parse(Object* object, QList<Key*> keyList)
{
    Gate gate = Gate();

    gate.name =      object->find(ELE_NAME, "");
    gate.type =      static_cast<Gate::Type>(object->find(ELE_GATE_TYPE, "").toInt());
    gate.keys =       object->find(ELE_KEY_LINKS, "").split(':');
    gate.triggered = (object->find(ELE_TRIGGERED, "false") == "false" ? false : true);

    return gate;
}
Example #6
0
void CompeteInit(int fPre)
{
  enable_servos();
  Gate(0);
  if (fPre)
    {
    sleep(0.25);
    disable_servos();
    }
  fBall = 0;
  ipMotor = start_process(MotorDriver());
}
Example #7
0
void CollectBalls()
{
  Hard(90);
  Move(-80,-80);
  Move(30, 30);
  Gate(0);
  fBallRelease = 1;
  Move(500, 500);
  pwrMax = 60;
  Move(-10, -10);
  Gate(1);
  fBallRelease = 0;
  msleep(250L);
  Move(-20, -20);
  pwrMax = 100;
  Move(-600,-600);
  msleep(250L);
  Move(80, 80);
  Hard(110);
  Move(-200,-200);
  Move(700, 700);
}
Example #8
0
QList<Gate> DBHandler::gates()
{

    QList<Gate> l;
    bool ok;
    QSqlQuery q = mDB.select(QStringList() <<"gates",ok,QHash<QString,QStringList>());
    if(ok){
        while(q.next()){
            l.append(Gate(q));
        }
    }else {
        QMessageBox::warning(0,"Fehler","select konnt nicht ausgeführt werden \n"+mDB.lastError().text(),QMessageBox::Ok);
    }
    return l;
}
Example #9
0
/* Measure ticks per second */
void CalibrateSpeed()
{
  long msStart;
  long msEnd;
  int cForward;
  int cBack;
  int cTicks = 500;
  int i;
  int fServo;

  for (fServo = 0; fServo < 2; fServo++)
    {
    if (fServo)
      {
      enable_servos();
      Gate(0);
      printf("Servo: ");
      }
    else
      printf("No Servo: ");

    for (i = 0; i < 2; i++)
      {
      msStart = mseconds();
      Move(cTicks,cTicks);
      msEnd = mseconds();
      rgSpeed[i] = MultDiv(100, 1000, (int) (msEnd - msStart));
      printf("%d ", rgSpeed[i]);
      cTicks = -cTicks;
      sleep(1.0);
      }

    if (fServo)
      disable_servos();

    printf("\n");
    StartPress();
    }
}
void SectorManager::GateActivate(Player *player, long target)
{
	Gate(player, target);
}
Example #11
0
//Alters the map to the users specifications
void Map::AlterMap (char W, char S, char F, char G, char C, char X, char L, char E, char P)
{
	if (Washrooms(W))
	{
		floorOne[3][3] = 'W'; floorOne[2][11] = 'W'; floorOne[13][45] = 'W'; floorOne[13][51] = 'W';
		floorTwo[13][4] = 'W'; floorTwo[13][12] = 'W'; floorTwo[2][50] = 'W'; floorTwo[5][50] = 'W';
	} else
	{
		floorOne[3][3] = ' '; floorOne[2][11] = ' '; floorOne[13][45] = ' '; floorOne[13][51] = ' ';
		floorTwo[13][4] = ' '; floorTwo[13][12] = ' '; floorTwo[2][50] = ' '; floorTwo[5][50] = ' ';
	}

	if (Store(S))
	{
		floorOne[11][4] = 'S';
		floorTwo[8][3] = 'S';
	} else
	{
		floorOne[11][4] = ' ';
		floorTwo[8][3] = ' ';
	}

	if (Food(F))
	{
		floorTwo[2][4] = 'F'; floorTwo[2][12] = 'F';
	} else
	{
		floorTwo[2][4] = ' '; floorTwo[2][12] = ' ';
	}

	if (Gate(G))
	{
		floorTwo[1][27] = 'G'; floorTwo[1][40] = 'G';
	} else
	{
		floorTwo[1][27] = ' '; floorTwo[1][40] = ' ';
	}

	if (Customs(C))
	{
		floorTwo[9][31] = 'C';
	} else
	{
		floorTwo[9][31] = ' ';
	}

	if (CheckIn(X))
	{
		floorOne[2][38] = 'X';
	} else
	{
		floorOne[2][38] = ' ';
	}

	if (Luggage(L))
	{
		floorOne[2][38] = 'L';
	} else
	{
		floorOne[2][38] = ' ';
	}

	if (Entrance(E))
	{
		floorOne[10][52] = 'E';
	} else
	{
		floorOne[10][52] = ' ';
	}

	if (PickUp(P))
	{
		floorOne[11][28] = 'P'; floorOne[11][37] = 'P';
	} else
	{
		floorOne[11][28] = ' '; floorTwo[11][37] = ' ';
	}
}