Esempio n. 1
0
void OnConnect(Client *c) {
	World world = World(500, 500);

	Robot* r1 = makeRobot(40, 40, Point(100.0f, 200.0f), &world);
	Robot* r2 = makeRobot(40, 40, Point(200.0f, 200.0f), &world);

	world.Add(r1);
	world.Add(r2);

	c->sendSelfInfo();
	c->sendEnemyInfo(20);
	c->sendGameInfo(&world);
	c->notifyStart();
	int sleepPeriod = 20;

	r1->Execute("MOV", "120.0");
	r1->Execute("FR", "");
	r1->Execute("ROT", "-0.75");
	//r2->Execute("FR", "");
	
	for(int i = 0; i < 26; i++)
		doLoobBody(world, c, sleepPeriod);
	//r1->Execute("FR", "");
	//r2->Execute("FR", "");
	while(true)
		doLoobBody(world, c, sleepPeriod);
}
Esempio n. 2
0
void Robot_func(){
	// Translate and ROtatae ! 
	//	-- > 
	glPushMatrix();


//	glRotatef(robot_rot,0,robot_y,0);
	
	makeRobot();
	glPopMatrix();
}
Esempio n. 3
0
int main(int argc, char **argv)
{

    if(!sPort.Open("/dev/ttyUSB0", 57600))
    {
	perror("Could not Open Serial Port s0 :");
	exit(0);
    }
    int angle[4];
    Leg_Config leg[4];
    int num_packets,t;
//    char ch = argv[1][0];
//    sPort.WriteByte(ch);
    int pre;
    
    scanf("%d",&num_packets);
    
    for (int k = 0; k < num_packets; k++)
    {
	scanf("%d",&pre);
	if(pre == 170)
	{
	    for(int i=0;i<4;i++)
	    {
		for(int j=0;j<4;j++)
		{
		    if(j==0)
		    {
			scanf("%d",&t);
			angle[j] = mat[i][t+2];
		    }
		    else scanf("%d",&angle[j]);
		}
		leg[i] = makeLeg(angle[0],angle[1],angle[2],angle[3]);
	    }
	    Robot_Config myRobot = makeRobot(leg[0],leg[1],leg[2],leg[3]);   
      
	    sendCommand(myRobot, pre);
	}
	if(pre ==187)
	{
	    char ch;
	    scanf(" %c",&ch);
	    //printf("%c", ch);
	    //ch = 'w';
	    sendRollCommand(ch,pre);
	}
      usleep(1000000);
    } 
  //Leg_Config leg1 = getDogGaitTheta(113.9725, -113.9398, 0);
  //printf("%d %d %d %d\n",leg1.theta[0],leg1.theta[1],leg1.theta[2], leg1.theta[3]);
  
  return 0;
}