Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   FIRST Tech Challenge (http://www.chiefdelphi.com/forums/forumdisplay.php?f=146)
-   -   [FTC]: Continuous Servo Keeps Rotating (http://www.chiefdelphi.com/forums/showthread.php?t=139601)

FRC Team CC 24-11-2015 01:25

[FTC]: Continuous Servo Keeps Rotating
 
Hey Chief Delphi,

We seem to have some trouble getting the continuous rotation servo to stop moving. The servo should move when button A on Gamepad 1 is pressed and should stop when released. Here is the code snippet we have:

Code:

if (gamepad1.a ) {
      // if the A button is pushed on gamepad1, increment the position of the servo.
      linearPosition = linearSliderLeft.getPosition()+ linearDelta; 
      linearPosition = Range.clip(linearPosition, 0.2, 0.8);
      linearSliderLeft.setPosition(linearPosition);
}

Should we have an else block in which we stop the servo with a setPosition call? We have tried setting it to 0.45, 0.5 and 0.55 but the servo still keeps moving.

Thanks,
The Charging Champions

GeeTwo 24-11-2015 22:01

Re: [FTC]: Continuous Servo Keeps Rotating
 
There is not a whole lot of FTC traffic on CD, but as I see it's been a while with no posts at all, I'll post something that may or may not be helpful.

Caveat: I have not done any FTC. I have used "generic" continuous rotation servos, however, e.g. the ones on Boe Bots. If the FTC continuous servos are not like those, this will be useless.

Generic Continuous Rotation Servos either do not have a potentiometer, or have broken the link between it and the rotation shaft. The practical upshot is that it is a "servo" that thinks it is always at center. This means that the farther from center you try to "set" its position, the faster/harder it tries to go that direction. There should be some "set" value which results in the servo not rotating.

When you change the "position", does the speed and/or direction of rotation change? If so, I suggest that you interpolate/extrapolate to where the wheel should not rotate, enter that value, and iterate until you get a non-rotating shaft. (This is known numerically as Newton's Method for finding a root, if you want to Google more about it.)

If the speed does not change, I'd suggest verifying that you're addressing the correct pin. If you're sure of that, try another method to see if you're really sending a good PWM signal to the port. This could be (for example) an oscilloscope, a regular servo, or a PWM motor controller like used in FRC. Hopefully the answer to that will give you a clue which way to go from there; if not, post your results and we'll help you through it.

Christopher149 25-11-2015 20:59

Re: [FTC]: Continuous Servo Keeps Rotating
 
The servo will not rotate when set to about 0.5 (some servos behave differently than others, 0.49 worked fine for us). And like GeeTwo said, you can't get position information from a continuous rotation servo, so you need some other method.

For 0.45 and 0.55, did the servo move in different directions? If so, the no-rotation spot is somewhere in between.

FRC Team CC 26-11-2015 02:46

[FTC]: Continuous Servo Keeps Rotating
 
Update: the issue was that the servo was plugged into port 6 but was programmed on the phone for port 1. The servo now works and stops at 0.5.

However, this brings up another question: why did the servo move even though no instructions were given to it (as per the phone)? Is this expected?

Thanks,
Charging Champions

GeeTwo 26-11-2015 05:34

Re: [FTC]: Continuous Servo Keeps Rotating
 
Quote:

Originally Posted by FTC Team CC (Post 1507900)
However, this brings up another question: why did the servo move even though no instructions were given to it (as per the phone)? Is this expected?

No, I would not expect this; I know that the Boe Bots CR servos are stationary when they do not receive a signal. Are you perhaps putting some sort of signal on port 6?

Christopher149 27-11-2015 00:50

Re: [FTC]: Continuous Servo Keeps Rotating
 
Quote:

Originally Posted by FTC Team CC (Post 1507900)
Update: the issue was that the servo was plugged into port 6 but was programmed on the phone for port 1. The servo now works and stops at 0.5.

However, this brings up another question: why did the servo move even though no instructions were given to it (as per the phone)? Is this expected?

Thanks,
Charging Champions

We ran into a similar thing, and I suspect (but do not know for sure) that when any servo is commanded to a position that all others not commanded go to position "0.0" - which for the CR servos makes them keep moving.

FRC Team CC 28-11-2015 10:49

Even if that is the case, the servo we plugged in should not have moved at all, since it was told to move to position 0.5.

By the way, we noticed the servo was always moving in only one direction regardless of whether the servo's position was 0 or 1.

GeeTwo 28-11-2015 11:53

Re: [FTC]: Continuous Servo Keeps Rotating
 
Quote:

Originally Posted by FTC Team CC (Post 1508302)
Even if that is the case, the servo we plugged in should not have moved at all, since it was told to move to position 0.5.

One of us has misread something. The way I read this:

Quote:

Originally Posted by FTC Team CC (Post 1507900)
Update: the issue was that the servo was plugged into port 6 but was programmed on the phone for port 1.

That is, you programmed port 1 to move to 0.5, but did not program port 6.

Quote:

Originally Posted by Christopher149 (Post 1508056)
I suspect (but do not know for sure) that when any servo is commanded to a position that all others not commanded go to position "0.0" - which for the CR servos makes them keep moving.

Christopher's speculation is that port 6 would be directed to position 0. If true, this would result in a full reverse for a CR servo, independent of the specific number programmed for port 1.

FRC Team CC 29-11-2015 12:56

Our bad, looks we misread what Christopher149 said.

Thanks to both of you for all of the help you have provided. Our servo now works.


All times are GMT -5. The time now is 17:06.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi