Announcement

Collapse

Technology Forum Has Moved!

The FIRST Tech Challenge Technology forum has moved to a new location! Please take a look at our forum blog for links and instructions on how to access the new forum.

https://firsttechchallenge.blogspot....orum-blog.html

Note that volunteers (except for FTA/WTA/CSA will still access their role specific forum through this site. The blog also outlines how to access the volunteer forums.
See more
See less

CR Servo - some turn slowly at "stop", others just stop

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

  • CR Servo - some turn slowly at "stop", others just stop

    We are using a few Firmware version 2.0 Servo Controllers, checking against each other.
    Using one set of CR servos, the servos actually stop when commanded.
    Using another set of CR servos, the servos turn slowly in the "-" direction.
    Has anyone else seen this?
    Please advise.
    Thanks,
    Martin Haeberli
    (de-)Mentor, FTC 7593, TigerBots

  • #2
    Originally posted by mhaeberli View Post
    We are using a few Firmware version 2.0 Servo Controllers, checking against each other.
    Using one set of CR servos, the servos actually stop when commanded.
    Using another set of CR servos, the servos turn slowly in the "-" direction.
    Has anyone else seen this?
    Please advise.
    Thanks,
    Martin Haeberli
    (de-)Mentor, FTC 7593, TigerBots
    Just like joystick controlling the robot, at the center position of the joystick, it may not be zero so your robot may run slowly sometimes. That's why we introduce "deadband".
    Similarly in continuous servo, the range (1.5-2.5 usec) is to spinning full speed on reverse at one end and full speed forward at the other end. The "center" (approx. 2 usec) will be "stop" but if the continuous servo and the servo controller doesn't quite agree what the "center" is, then the motor may spin slowly in one direction. You just need to determine what is the "center" of a particular servo and adjust your code accordingly.

    Comment


    • #3
      Originally posted by mikets View Post
      You just need to determine what is the "center" of a particular servo and adjust your code accordingly.
      Our team found the same solution that mikets suggest. We actually wrote some code that steps the servo from 0.4 to 0.6 "position" command in .01 increments. We run it and then note what the command is when the servo stops. We found that value to be different when the servo is set to REVERSE compared to FORWARDS. We also found that when we initialized the servo immediately after getting the object from the hardware map, outputting the command to stop the "drift" did not do the trick. We had to put in a 100 mSec delay between the two in order to get the command to operate properly. See constructor for our CRServo class:

      Code:
          public CRServo(String servoName, HardwareMap hardwareMap, double centerValueForward,
                         double centerValueReverse, double deadBandRange, Servo.Direction direction) {
              crServo = hardwareMap.servo.get(servoName);
              this.centerValueReverse = centerValueReverse;
              this.centerValueForward = centerValueForward;
              // Set the direction for a positive position command and also sets the center value
              // The stupid center value that makes a CR servo not move seems to be different for Forwards
              // or backwards
              setDirection(direction);
              this.deadBandRange = deadBandRange;
              timer = new ElapsedTime();
              // If I don't put a delay here the next setPosition command seems to get lost and the servo
              // starts to move at init.
              delay(100);
      
      
              crServo.setPosition(centerValue);
          }
          
           /**
           * Implements a delay
           *
           * @param mSec delay in milli Seconds
           */
          private void delay(int mSec) {
              try {
                  Thread.sleep((int) (mSec));
              } catch (InterruptedException e) {
                  Thread.currentThread().interrupt();
              }
          }

      Comment

      Working...
      X