|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
[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);
}
Thanks, The Charging Champions |
|
#2
|
|||||
|
|||||
|
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. |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
[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 |
|
#5
|
|||||
|
|||||
|
Re: [FTC]: Continuous Servo Keeps Rotating
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?
|
|
#6
|
|||
|
|||
|
Re: [FTC]: Continuous Servo Keeps Rotating
Quote:
|
|
#7
|
|||
|
|||
|
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. |
|
#8
|
|||||
|
|||||
|
Re: [FTC]: Continuous Servo Keeps Rotating
Quote:
Quote:
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. |
|
#9
|
|||
|
|||
|
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. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|