2018年11月13日星期二

after exam

today i got the result of the exam and i got a 95, it is good and i think i can do better in it.
and i am programing for the robots these days and this the code i got today.
when(STARTED){
  while(true){
    BallLifting.setVelocity(127,percent);
    BallLifting.setMaxTorque(127,percent);
    Driving1Right.setVelocity((1.27*(Controller1.Axis1.position(percent)+Controller1.Axis2.position(percent))),percent);
    Driving2Left.setVelocity((1.27*(Controller1.Axis1.position(percent)-Controller1.Axis2.position(percent))),percent);
    Driving1Right.setMaxTorque(127,percent);
    Driving2Left.setMaxTorque(127,percent);
    CapLifting1Left.setVelocity(90,percent);
    CapLifting2Right.setVelocity(90,percent);
    CapLifting1Left.setMaxTorque(90,percent);
    CapLifting2Right.setMaxTorque(90,percent);
    Flywheel1Left.setMaxTorque(127,percent);
    Flywheel2Right.setMaxTorque(127,percent);
    LShapeStructure.setVelocity(50,percent);
    LShapeStructure.setMaxTorque(127,percent);
    Driving1Right.spin(forward);
    Driving2Left.spin(forward);
    BallLifting.rotateTo((Controller1.Axis3.position(percent)*5),degrees);
    if(Controller1.ButtonR1.pressing()){
      Flywheel1Left.setVelocity(127,percent);
      Flywheel2Right.setVelocity(127,percent);
      Flywheel1Left.spin(reverse);
      Flywheel2Right.spin(forward);
    }else{
      if(Controller1.ButtonR2.pressing()){
        Flywheel1Left.setVelocity(127,percent);
        Flywheel2Right.setVelocity(127,percent);
        Flywheel1Left.spin(forward);
        Flywheel2Right.spin(reverse);
      }else{
        Flywheel1Left.stop();
        Flywheel2Right.stop();
      }
    }
    if(Controller1.ButtonL1.pressing()){
      CapLifting1Left.spin(forward);
      CapLifting2Right.spin(reverse);
    }else{
      if(Controller1.ButtonL2.pressing()){
        CapLifting1Left.spin(reverse);
        CapLifting2Right.spin(forward);
      }else{
        CapLifting1Left.stop();
        CapLifting2Right.stop();
      }
    }
    if(Controller1.ButtonLeft.pressing()){
      BallLifting.rotateFor(-840,degrees);
    }else{
      if(Controller1.ButtonRight.pressing()){
        BallLifting.rotateFor(-420,degrees);
      }else{
        BallLifting.stop();
      }
    }
  }
}

1 条评论:

The last Humangeo class

Ok... it is really sad to say goodbye, but the good thing is we can still meet in the School! I have a Robotic competition this Sunday and ...