Go to Post The real key to drive team coaching is to tie your jacket around your waist. Got a couple championship rings that way. - TravusCubington [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 20-01-2008, 16:23
penguain penguain is offline
Registered User
AKA: Barry Preston
FRC #1997 (Stag Robotics)
Team Role: Programmer
 
Join Date: Nov 2006
Rookie Year: 2007
Location: Bishop Miege High School
Posts: 18
penguain is an unknown quantity at this point
Robot Drive for 10 seconds

unsigned int timer = 0;

//Forward for 10 seconds
if(timer < 382){
pwm01 = pwm02 = 225;
timer++;
}

since the autonomus loops every 26.2ms
10 / 0.0262 = ~382

would this work to drive the robot forward for 10s/


thanks
__________________
2007 Greater Kansas City Regional Champions
2008 Greater Kansas City Regional Finalists
  #2   Spotlight this post!  
Unread 20-01-2008, 16:29
Laaba 80 Laaba 80 is offline
Registered User
AKA: Joey
FRC #1714 (MORE Robotics)
Team Role: Alumni
 
Join Date: Dec 2007
Rookie Year: 2001
Location: San Jose, CA
Posts: 495
Laaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond repute
Re: Robot Drive for 10 seconds

I am not sure about the 382, but other than that it looks good. The only thing that I see is that on most robots the motors are faced different directions, so if that is your case, you just made your robot spin in a circle for 10 seconds. Something to look out for.
Joey
__________________
Driving Record - 75-43-8
Coaching Record - 92-65
  #3   Spotlight this post!  
Unread 20-01-2008, 16:36
penguain penguain is offline
Registered User
AKA: Barry Preston
FRC #1997 (Stag Robotics)
Team Role: Programmer
 
Join Date: Nov 2006
Rookie Year: 2007
Location: Bishop Miege High School
Posts: 18
penguain is an unknown quantity at this point
Re: Robot Drive for 10 seconds

We're not sure how we did this, that code is right for drive straight

we first tried
pwm01 = 200;
pwm02 = 54;

and it just spun
__________________
2007 Greater Kansas City Regional Champions
2008 Greater Kansas City Regional Finalists
  #4   Spotlight this post!  
Unread 20-01-2008, 16:50
d.courtney's Avatar
d.courtney d.courtney is offline
Registered User
AKA: David
FRC #0781 (Kinetic Knights)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Kincardine, Ontario
Posts: 196
d.courtney has much to be proud ofd.courtney has much to be proud ofd.courtney has much to be proud ofd.courtney has much to be proud ofd.courtney has much to be proud ofd.courtney has much to be proud ofd.courtney has much to be proud ofd.courtney has much to be proud ofd.courtney has much to be proud ofd.courtney has much to be proud of
Re: Robot Drive for 10 seconds

Have you got your IR board working yet, personally I think that having forward and stop functions mapped to two buttons is a better solution to driving forward a said time or distance then a solution like this. However this is a good start in the right direction for autonomous. If you need help with hybrid coding for the IR give a shout.
__________________
  #5   Spotlight this post!  
Unread 20-01-2008, 17:09
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,713
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Robot Drive for 10 seconds

Quote:
Originally Posted by penguain View Post
would this work to drive the robot forward for 10s/
I'd suggest stopping the motors after the 10 seconds are up.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #6   Spotlight this post!  
Unread 20-01-2008, 17:16
Mr. Freeman Mr. Freeman is offline
Put better title here.
AKA: Kellan
no team (CSM Robotics)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Colorado
Posts: 198
Mr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to behold
Re: Robot Drive for 10 seconds

Quote:
Originally Posted by Mark McLeod View Post
I'd suggest stopping the motors after the 10 seconds are up.
I'd also suggest slowing the motors down before you stop them, also speeding them up instead of just going from 127 to 255. If you don't do this and your robot is top heavy then you run the risk of tipping over. You can do this by modifying your counter slightly.

Sudocode:
pwm_2 = pwm_1;
static int counter = 0;

counter++;
if (counter <= 10)
{
pwm_1 = 137;
}
else if (counter > 10 && counter <= 20)
{
pwm_1 = 157;
}

etc...

We did this one year and it seemed to work pretty well. There might be a better way to do it, but this was simple and we wrote it in about 10 minutes.
__________________
"Time is an illusion, lunchtime doubly so."
-Douglas Adams
“Why is it that I can walk into Wal-Mart and buy boxes of bullets and black powder, but I can’t buy potassium perchlorate to do science because it can also be used to make explosives?”
-Theodore Gray
  #7   Spotlight this post!  
Unread 20-01-2008, 17:43
JohnC's Avatar
JohnC JohnC is offline
my other name is nigel
FRC #0360 (360 Revolution)
Team Role: Programmer
 
Join Date: Mar 2005
Rookie Year: 2005
Location: user_routines.c
Posts: 100
JohnC is a jewel in the roughJohnC is a jewel in the roughJohnC is a jewel in the roughJohnC is a jewel in the rough
Send a message via AIM to JohnC
Re: Robot Drive for 10 seconds

If you have access to encoders, you may want to have your robot drive a certain distance rather than for a certain length of time.

That way, you could write a function like Drive(distance, speed);
__________________
What place are we at? ... TODAI!
  #8   Spotlight this post!  
Unread 20-01-2008, 18:38
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Robot Drive for 10 seconds

They most likely reversed the polarity of one motor when they connected it to a Victor. This has been a common practice for 364 for a number of years, so in fact, setting both motors to 254 will make it drive forward.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
  #9   Spotlight this post!  
Unread 20-01-2008, 20:09
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,512
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Robot Drive for 10 seconds

One other thing to note is that your counter will need to be static.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
where can I find the code for the first 15 seconds? CompMaster Programming 2 16-02-2005 16:23
counting in seconds for the autonomous mode?? Pattyta Programming 22 31-03-2004 12:55
pic: Four Seconds CD47-Bot Extra Discussion 9 30-03-2003 15:31
Numbers for thought: Are 10 black balls worth 30 seconds? archiver 2001 6 23-06-2002 22:42
about how Drive Train push the robot... shouldn't the force accelerate the robot? Ken Leung Technical Discussion 12 26-11-2001 09:39


All times are GMT -5. The time now is 08:13.

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