Announcement

Collapse
No announcement yet.

Servos Not Stopping

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Servos Not Stopping

    Hello, I am the Lead Programmer of Team 8720 at Evergreen Middle School. Our team has been posting a lot recently. This week is our home stretch before our Super Qualifiers! We have been doing so much lately, and running into a lot of problems we don't know to to solve. When the driver presses a button, I want two servo's to stop. The problem however is that the servo's keep on running Any help that is provided will be greatly appreciated. We are using a Linear OpMode.

    Declaring OpMode Members:
    Code:
     
     Servo LeftCycleServo;  Servo RightCycleServo;
    Hardware Mapping Them:
    Code:
     
     LeftCycleServo = hardwareMap.servo.get("left_cycle_servo");  RightCycleServo =  hardwareMap.servo.get("right_cycle_servo");
    While the OpMode is Active:
    Code:
     
     if (gamepad2.a) {     LeftCycleMotor.setPower(0);     RightCycleMotor.setPower(0);          LeftCycleServo.setPosition(0); //This is not working     RightCycleServo.setPosition(0); //This is not working }

  • #2
    I don't know what you mean by stop. setPosition(0) tells the servo to move to that position and hold there.

    Comment


    • #3
      If they're CR servos, setting the position to 0.5 should stop them.

      If you want them to stop receiving electrical power altogether, and if you're using REV electronics, you can cast to ServoImplEx and then call disablePwm()

      Comment


      • #4
        You can also disable the servo motors by using RightCycleServo.getController().pwmDisable()
        Mark Hancock
        Tigard Team Mentor

        Comment


        • #5
          Thank you for all your help!

          Comment

          Working...
          X