Go to Post With any dollar amount to invest I would be more interested in the number of individuals (students is too narrow) impacted than the number of teams created--after all, this is about people. - kramarczyk [more]
Home
Go Back   Chief Delphi > Other > Math and Science
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #10   Spotlight this post!  
Unread 04-12-2004, 21:52
jgannon's Avatar
jgannon jgannon is offline
I ᐸ3 Robots
AKA: Joey Gannon
no team
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Pittsburgh, PA
Posts: 1,467
jgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond repute
Re: Turn 90 Degrees

Quote:
Originally Posted by MikeWasHere05
Somehow measure the amount of time it takes for the wheel to spin one revolution at speed x.
Set it to run at speed x for the needed amount of length/time.
Here's what I would suggest. This is kinda pseudo-code, but you'll get the idea.

Code:
#define COUNT 20 //determine this number experimentally

void turn90(void)
{
   int i=0;
   int last=0;
   while(i<COUNT)
   {
      pwm01=255;
      pwm02=0;
      if(rc_ana_in01<last)
         i++;
      last=rc_ana_in01;
   }
   pwm01=127;
   pwm02=127;
}
COUNT is the number of revolutions it takes for your robot to turn 90 degrees. You have two servos connected to pwm01 and pwm02. You have a multi-turn pot on analog input 01. The value from the pot goes from 0 to 1023, and then starts over at 0 again. (That's just how the processor does it, for some reason. I dunno why they went with 10 bits instead of 8.) If the number is suddenly less than it was last time it checked, then the pot has made a complete revolution. This is more precise than measuring time, because the values needed for other angles are not 1:1, due to inertia and stall friction. If you wanted an angle of 45º, change it to while(i<COUNT/2). If you want 180º, change it to while(i<COUNT*2). I'm not sure if I'm making any sense, so ask me if you don't understand it.
__________________
Team 1743 - The Short Circuits
2010 Pittsburgh Excellence in Design & Team Spirit Awards
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2007 Pittsburgh Website Award
2006 Pittsburgh Regional Champions (thanks to 395 and 1038)
2006 Pittsburgh Rookie Inspiration & Highest Rookie Seed

Team 1388 - Eagle Robotics
2005 Sacramento Engineering Inspiration
2004 Curie Division Champions (thanks to 1038 and 175)
2004 Sacramento Rookie All-Star

_

Last edited by jgannon : 04-12-2004 at 22:01.
Reply With Quote
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Six Degrees of John V-Neun Amanda Morrison Chit-Chat 47 24-07-2007 18:11
G4 wont turn on! MattK General Forum 14 26-08-2003 09:44
College Advisor turn outs Guyute General Forum 4 20-06-2003 13:35
Yaw Rate Sensor to 90 degrees? Bruce C. Programming 4 11-02-2003 00:36
PWM Antonio Technical Discussion 21 06-01-2003 14:44


All times are GMT -5. The time now is 15:30.

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