コード例 #1
0
task main()
{
  initialize ();  // In the original template this was "initializeRobot();"

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

  clasp_goal(true);

  distanceToDrive = 72.0; //6 feet
  drive_both_wheels (-motorSpeed, -motorSpeed, distanceToDrive * kInch); //drives out of parking zone to kickstand

  int i = 0;
  for(i = 0; i <= 1; i++){
  	distanceToDrive = 6.0; //6 in
  	drive_both_wheels (motorSpeed, motorSpeed, distanceToDrive * kInch);

  	distanceToDrive = 10.0 //10 in
  	drive_both_wheels (-motorSpeed, -motorSpeed, distanceToDrive * kInch);
  }

  distanceToDrive = 12.0; //12 in
  drive_both_wheels(motorSpeed, motorSpeed, distanceToDrive * kInch); //backs up to angle for final try

  degreesToTurn = 90.0; //90 degrees
  TurnLeft(degreesToTurn * kDegrees); //turns 90 degrees

  distanceToDrive = 10.0; //10 in
  drive_both_wheels(motorSpeed, motorSpeed, distanceToDrive * kInch); //drives 4 in

  degreesToTurn = 90.0; //90 degrees
  TurnRight(degreesToTurn * kDegrees); //turns 90 degrees

  distanceToDrive = 30.0; //2.5 feet
  drive_both_wheels(-motorSpeed, -motorSpeed, distanceToDrive * kInch); //comes in for final try to knock down the kickstand

  for(i = 0; i <= 1; i++){
  	distanceToDrive = 6.0; //6 in
  	drive_both_wheels (motorSpeed, motorSpeed, distanceToDrive * kInch);

  	distanceToDrive = 10.0; //10 in
  	drive_both_wheels (-motorSpeed, -motorSpeed, distanceToDrive * kInch);
  }
  //the program basically flails around to knock down the kickstand




  transition(); //waits for autonomous phase to end

} // main
コード例 #2
0
task main()
{
    initialize ();  // In the original template this was "initializeRobot();"

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

    //
    // Raise the arm.  Unless the arm is ALL the way down, this call will hang
    // your robot.
    //
//  raise_arm ();

    //
    // Drive forward twelve inches.
    //
    drive_both_wheels (75, 75, 12 * kInch);

    //
    // Rotate right 90 degrees.  This will cause one motor to turn in one
    // direction, but the other will turn in the opposite direction.
    //
    TurnRight (90 * kDegrees);

    //
    // Drive forward twelve inches.
    //
    drive_both_wheels (75, 75, 12 * kInch);

    //
    // Rotate right 90 degrees.  This will cause one motor to turn in one
    // direction, but the other will turn in the opposite direction.
    //
    TurnRight (90 * kDegrees);

    //
    // Drive forward until a white line is found.
    //
    find_line ();

    //
    // Lower the arm and close the hand.
    //
//  lower_arm ();
    move_hand (e_hand_command_close);

    //
    // Drive forward twelve inches.
    //
    drive_both_wheels (75, 75, 12 * kInch);

    //
    // Rotate left 90 degrees.
    //
    TurnLeft (90 * kDegrees);

    //
    // Drive forward twelve inches.
    //
    drive_both_wheels (75, 75, 12 * kInch);

} // main