Go to Post Let's sheathe the pitchforks and douse the torches for another two months, shall we? - Taylor [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-05-2011, 05:27 PM
tjakowenko tjakowenko is offline
Registered User
AKA: Tom Jakowenko
no team (Pirates of the Pythagorean)
Team Role: Mentor
 
Join Date: Oct 2009
Rookie Year: 2009
Location: Hartford, ct
Posts: 12
tjakowenko is an unknown quantity at this point
how do you code a servo to run continuously

We are using a servo to move an arm and want to command the servo to turn until triggered to stop. We're not sure how to do this using either set() or setAngle. Those commands will move the motor a fractional rotation, but not spin continuosly. Can someone provide a little insight as to command a servo from a pwm output to turn continuously, at different rates of speed and in different directions?

Thanks in advance...
Reply With Quote
  #2   Spotlight this post!  
Unread 02-05-2011, 07:03 PM
BornaE's Avatar
BornaE BornaE is offline
Registered User
FRC #0842 (Formerly 39)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Gilbert, Arizona
Posts: 359
BornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant future
Re: how do you code a servo to run continuously

There are 2 types of servo's,
Standard ones, and Continuous rotation servos.

Standard servos can only do ~180 degrees of motion.(some have more range some have less)
so each PWM value corresponds to a position of the servo horn.

Continuous rotation servos, as the name implies, can rotate continuously. Each PWM servo corresponds to a rotation speed.

There is no way of making a regular servo rotate continuously.
__________________
-Borna Emami
Team 0x27
Reply With Quote
  #3   Spotlight this post!  
Unread 02-05-2011, 07:10 PM
McGurky's Avatar
McGurky McGurky is offline
Geek
AKA: Kyle McGurk
FRC #1716 (Redbird Robotics)
Team Role: College Student
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Houghton, MI
Posts: 291
McGurky is just really niceMcGurky is just really niceMcGurky is just really niceMcGurky is just really nice
Re: how do you code a servo to run continuously

well there are actually ways to modify the servo to rotate continuously.


Unfortunately due to <R47>, you may not legally modify a servo.

however, you may infact be able to find a continuous rotation servo on servocity.com or other sites that meets the 4W power requirements.


Good luck
__________________
RTFM -Read The First Manual

You already are who you are, I may be able to show you a fancy trick or two, but the term "Better" is relative to the potential you already have.
Take a look at my website/Blog!
Reply With Quote
  #4   Spotlight this post!  
Unread 02-06-2011, 03:28 PM
ianonavy ianonavy is offline
Programming Mentor/Alumnus
AKA: Ian Adam Naval
FRC #3120 (RoboKnights)
Team Role: Mentor
 
Join Date: Dec 2010
Rookie Year: 2008
Location: Sherman Oaks
Posts: 32
ianonavy is an unknown quantity at this point
Re: how do you code a servo to run continuously

http://www.wbrobotics.com/javadoc/ed...ilibj/PWM.html

My team was having a similar issue. We decided to replace the continuous servo with a motor, but we had an untested idea to program a continuous rotation servo. I believe that there is a setSpeed(double speed) method in the PWM class, which the Servo class extends. If there isn't one, you'll have to play around with setRaw(int value). This is the code I found in the library itself:

Code:
final void setSpeed(double speed) {
        // clamp speed to be in the range 1.0 >= speed >= -1.0
        if (speed < -1.0) {
            speed = -1.0;
        } else if (speed > 1.0) {
            speed = 1.0;
        }

        // calculate the desired output pwm value by scaling the speed appropriately
        int rawValue;
        if (speed == 0.0) {
            rawValue = getCenterPwm();
        } else if (speed > 0.0) {
            rawValue = (int) (speed * (getPositiveScaleFactor()) +
                    (getMinPositivePwm()) + 0.5);
        } else {
            rawValue = (int) (speed * (getNegativeScaleFactor()) +
                    (getMaxNegativePwm()) + 0.5);
        }

        // send the computed pwm value to the FPGA
        setRaw(rawValue);
}
This method is actually meant to be used with speed controllers, but in theory it should work with a continuous rotation servo. Once again, we've never tested this, so it's up to you whether or not you want to try it. If you do, please post the results as I think it could benefit a lot of people.

Good luck!
Reply With Quote
  #5   Spotlight this post!  
Unread 02-06-2011, 10:00 PM
tjakowenko tjakowenko is offline
Registered User
AKA: Tom Jakowenko
no team (Pirates of the Pythagorean)
Team Role: Mentor
 
Join Date: Oct 2009
Rookie Year: 2009
Location: Hartford, ct
Posts: 12
tjakowenko is an unknown quantity at this point
Re: how do you code a servo to run continuously

Thanks for the insight. We have been able to usine the HiTech motor on a application that only move 120 degrees.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 07:37 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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