Announcement

Collapse
No announcement yet.

Two Servos Move

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

  • Two Servos Move

    Hi guys. My team is using a servo to push a beacon, and a servo to release the linear slide. My problem is, when I activate the code to move one servo, the other servo moves too! I checked the configuration, and that is correct, the code does not give any possibility to have both move by the same button, and I am very confused.

  • #2
    Originally posted by patfanman101 View Post
    Hi guys. My team is using a servo to push a beacon, and a servo to release the linear slide. My problem is, when I activate the code to move one servo, the other servo moves too! I checked the configuration, and that is correct, the code does not give any possibility to have both move by the same button, and I am very confused.
    Without more information we just going to wild guess.

    ~ What is FTC SDK version?
    ~ Post your code here
    ~ Are there more servos plugged in? specifically CR Servos?

    Comment


    • #3
      Originally posted by patfanman101 View Post
      Hi guys. My team is using a servo to push a beacon, and a servo to release the linear slide. My problem is, when I activate the code to move one servo, the other servo moves too! I checked the configuration, and that is correct, the code does not give any possibility to have both move by the same button, and I am very confused.
      Are you talking about the both servos moved during initialization or both servos moved when you command only one to move?

      Comment


      • #4
        Originally posted by mikets View Post
        Are you talking about the both servos moved during initialization or both servos moved when you command only one to move?
        Both servos move when I command only one to move.
        Originally posted by FTC11722 View Post
        Without more information we just going to wild guess.

        ~ What is FTC SDK version?
        ~ Post your code here
        ~ Are there more servos plugged in? specifically CR Servos?
        I believe it is 2.1 or 2.2
        here is my code
        Code:
        if(gamepad2.a) {
        Beacon.setPosition(0.2);
        }
        
        if (gamepad.2.b) {
        Rlease.setPosition(2);
        }
        No other servos are plugged in.

        Comment


        • #5
          Originally posted by patfanman101 View Post
          Both servos move when I command only one to move.

          I believe it is 2.1 or 2.2
          here is my code
          Code:
          if(gamepad2.a) {
          Beacon.setPosition(0.2);
          }
          
          if (gamepad.2.b) {
          Rlease.setPosition(2);
          }
          No other servos are plugged in.
          It's hard to tell what's wrong with only partial code but I hope that's not the exact code you copied and pasted here because it has some typos in it. For example, gamepad.2.b is certainly not valid.

          Comment


          • #6
            A few things:

            FTC SDK 2.1 or 2.2 is (relatively) ancient. Current is 2.4, it seems likely that 2.6 will be coming soon.

            That is probably not your real code, as (gamepad.2.b) is not valid. Please copy and paste your code, don't try to re-type it here. Copy and paste the entire opmod, not just this section.

            The allowed values for setPosition: position - the position to which the servo should move, a value in the range [0.0, 1.0] --- So, attempting to setPosition(2) is not valid.

            Comment


            • #7
              Originally posted by patfanman101 View Post
              Both servos move when I command only one to move.

              I believe it is 2.1 or 2.2
              here is my code
              Code:
              if(gamepad2.a) {
              Beacon.setPosition(0.2);
              }
              
              if (gamepad.2.b) {
              Rlease.setPosition(2);
              }
              No other servos are plugged in.
              Have you set both servos to some "default" position in your init code?

              If you have not, the first time you set ANY servo position, all the attached servos will move.
              This is because the servo controller is not "enabled" until you set your first servo position.
              So regardless of which button you press, both servos will move.

              So.... add some setPosition() calls into your init code so that when you hit init on the robot, both servos move to their "default" startup positions.

              Comment

              Working...
              X