コード例 #1
0
ファイル: 4AutonyWloop.c プロジェクト: AidanBoyer/FTC-7664
task main() // main task
{

  initializeRobot(); // calls the "initializeRobot" function

  //waitForStart(); // Wait for the beginning of autonomous phase.

  accelerateGradually(); // calls the "accelerateGradually" function

  while (((nMotorEncoder[LeftFrontDrive] + nMotorEncoder[LeftRearDrive] + nMotorEncoder[RightFrontDrive]
	+ nMotorEncoder[RightRearDrive]) / 4) < ticksToTravel) // repeat this section of code (do not continue sequential
	// execution) until the average of all four motor values is greater than the target number of ticks to move,
	// calculated from the specified number of feet to move.
  {
  	moveAllMotors(100);  // Calls the "moveAllMotors" function, passing the value 100
  }

  moveAllMotors(-100); // sets all the motors to 50% power backwards, to brake the motors and the robot from
  										// gliding further forward

  wait10Msec(20); // waits 200 milliseconds (0.200 seconds)

  moveAllMotors(0); // sets all the motors to 0% power (off)

} // end of main function, end of program
コード例 #2
0
ファイル: 4AutonyWloop.c プロジェクト: AidanBoyer/FTC-7664
void accelerateGradually() // Accelerates gradually from 0 to 95% power in 0.525 seconds, to keep wheels from
// slipping and throwing off the encoder values
{
	for(int i = 1; i <= 21; i++)
	{
		moveAllMotors(i * 4.7);
		wait1Msec(25);
	} // end of the for loop
} // end of the "accelerateGradually" function
コード例 #3
0
void BigPuppyController::onStep(BigPuppy& subject, double dt){

    // Update controller's internal time
    if (dt <= 0.0) { throw std::invalid_argument("dt is not positive"); }
    m_totalTime+=dt;    

    setBicepTargetLength(subject, dt);
    setFrontTricepTargetLength(subject, dt);
    setRearTricepTargetLength(subject, dt);
    setLegToAbdomenTargetLength(subject, dt);
    setRightShoulderTargetLength(subject, dt);
    moveAllMotors(subject, dt);
}