Go to Post If it were easy it wouldn't be worth triple the points, right? - SenorZ [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 22-01-2015, 19:21
loganzip loganzip is offline
Registered User
FRC #2838
 
Join Date: Feb 2014
Location: USA
Posts: 8
loganzip is an unknown quantity at this point
RobotC Servo Autonomous

I am part of FTC Team 7828 the Robo Ducks. I have been not able to figure out how to program servos during autonomous. Anyone know how to do that? If, so how would you program that for RobotC?
  #2   Spotlight this post!  
Unread 23-01-2015, 10:44
dvanvoorst dvanvoorst is offline
Registered User
FRC #2771 (Code Red)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Grand Rapids, MI
Posts: 61
dvanvoorst is an unknown quantity at this point
Re: RobotC Servo Autonomous

First of all you need to know if you're using standard servos or continuous rotation servos. And then make sure you define them accordingly in your motor and servo setup. If you're unsure, you can tell by manually turning the servo. If it only goes part way around, it's a "standard" servo. If you can spin it all the way around continuously, then it's a continuous rotation servo.

To move a standard servo to particular position, you simply assign a position to the servo like this:
servo[servo1] = 160; // changes the position of servo1 to 160

A continuous rotation servo is a little different. The value for a continuous rotation servo is actually a speed and direction indication.
A value of 127 is "neutral". Values 0 - 126 indicate the reverse speed, and 128 - 255 indicate forward speed. I believe you need to get several values away from 127 before the servo actually starts to turn though.
servo[servo1] = 90; // spin in reverse fairly slowly
servo[servo1] = 150; // spin forward fairly slowly
servo[servo1] = 127; // stop spinning

Note that continuous rotation (CR) servos will not hold their position when you "stop" them. So if, for example, you were using it to wind something up, once you assign a value of 127, it would allow the mechanism to unwind if there is a force applied.

Also, in autonomous programming, you'll want to wait a short time after setting a standard servo value to give it time to reach its position. Experimentation can tell you how long to wait, but waiting for 1 second is a good starting point.

And, always remember that the help in RobotC can be very helpful.

Last edited by dvanvoorst : 23-01-2015 at 10:48.
Closed Thread


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 02:44.

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