Exemplo n.º 1
0
//----main----//
task main ()
{
	Delete(sFileName1, nIoResult);
	Delete(sFileName2, nIoResult);
	nxtDisplayCenteredTextLine(3, "Roaming");
	nxtDisplayCenteredTextLine(5, "This is a test");
	initialisePose(); //set up
	iterate(stepSize); //run excitation etc
	currentDirection = 0; //set initial
  currentTheta = 0;
  setTemp();  //get local view
  checkLocalCell(); //create first association

  datalogging();
  sumPoseStruct();
	while(1)
	{
		alive(); //stop NXT from sleeping

    float centreSonarValue = SensorValue(centreSonar);
    if(centreSonarValue<19)
	  {
	  	doTurn();
	  	pose3D(changeTheta,0);
	  }
	  else {
	  drive(100,180,50);
    pose3D(changeTheta,0.5);
    }
    sumPoseStruct();
    setTemp();
    checkLocalCell();

    //store data
    datalogging();
    clearEncoders(); //clear encoder count
    changeTheta=0;
  }
  SaveNxtDatalog();
  PlaySound(soundException);
  while(bSoundActive){}
}
Exemplo n.º 2
0
//----main----//
task main ()
{
	nxtDisplayCenteredTextLine(3, "Pose Test");
	wait1Msec(500);
	initialisePose(); //set up
	iterate(stepSize); //run excitation etc
	currentDirection = 0; //set initial
  currentTheta = 0;
  changeTheta = 0;

  //display data
 displayMax();
    nxtDisplayTextLine(2, "Num Act.: %3d",numActive);
    nxtDisplayTextLine(4, "Direction: %1d", currentDirection);
    nxtDisplayTextLine(5, "currentTheta:%3d", currentTheta);
    nxtDisplayTextLine(6, "changeTheta:%3d", changeTheta);
	datalogging();
  while(totalClicks<1800)
	{
		alive(); //stop NXT from sleeping
    totalClicks += clicks;
    //drive(-100,190,50);
   // drive(50,180,50);

    pose3D(changeTheta,0.5);

    displayMax();
    nxtDisplayTextLine(2, "Num Act.: %3d",numActive);
    nxtDisplayTextLine(4, "Direction: %1d", currentDirection);
    nxtDisplayTextLine(5, "currentTheta:%3d", currentTheta);
    nxtDisplayTextLine(6, "changeTheta:%3d", changeTheta);
    clearEncoders(); //clear encoder count
    changeTheta=0;
    datalogging();

  }
  PlaySound(soundFastUpwardTones);
  while(bSoundActive) {}
  SaveNxtDatalog();
}
Exemplo n.º 3
0
task main() {
	servoChangeRate[flagRaiserExtender] = 5;
	servoChangeRate[blockBlocker] = 8;

	servo[flagRaiserExtender] = 220;
	servo[wrist] = 90;
	servo[blockBlocker] = 30;

	servo[autoArm] = 145;
	servo[autoBlock] = 200;
	waitForStart();
	//servo[flagRaiserExtender] = 0;

	while (true) {
		bFloatDuringInactiveMotorPWM = false;
		getJoystickSettings(joystick);
		driver();
		arm();
		datalogging();
		// RobotC function for keeping the robot on
		//alive();
	}
}