No announcement yet.

Continuous Rotation Servo Question

  • Filter
  • Time
  • Show
Clear All
new posts

  • Continuous Rotation Servo Question

    We've programmed our continuous rotation servo with the following code:
    if (gamepad1.left_stick_x>0.5) {
    {belt.setPosition(0); }}
    if (gamepad1.left_stick_x<-0.5) {
    {belt.setPosition(1.00); }}

    It moves spins freely in the 1.00 position (forward), but it pulses in the 0 position (reverse). It stops fine in the 0.5 position. Does anyone know why it doesn't spin free in the 0.00 position? We've put the continuous rotation servo on the x and y buttons and the bumpers, but it doesn't moves as freely on those.

  • #2
    The way you've written your if statements has two separate blocks. Watch your braces!!

    if >0.5 then set 0

    if <-0.5 then set 1 else set 0.5

    So when >0.5, the first if executes and sets the position to 0, then, the second if/else block executes and ends up resetting position to 0.5. The result is pulsing (being set to 0, then to 0.5, and repeating)
    Technical Coach, Newton Busters FTC 10138, FLL 3077
    Chicago 'burbs, IL


    • #3
      So, I wan't to clarify. For a continuous rotation servo, 1 is forward, 0 is backward, and 0.5 is stop. Correct?


      • #4
        Incorrect. Something close to 0.5 is stop and will vary between servos. Alternatively, with the CRServo class you can treat it similar to a motor and the SDK will find the magic value which is stop.