Go to Post All I know is I have fun building a robot, and I have fun competing with it. If I get an award, I'm happy. If I don't, then too bad. Either way, I'm coming back next year. - Tom Bottiglieri [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 14-02-2004, 23:18
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: Robot Drifting

Quote:
Originally Posted by Mark McLeod
Remember that constant doesn't have to be restricted to integers like 1,2,3,..
It can be a #define like "#define CONSTANT 150/100" to get a value of 1.5 without using floating point #'s.
Might I point out that 150/100 will evaluate to 1, not 1.5... there is no way to store a floating point number in an integer. You can hack around it by storing an exponent, but I don't believe setting myInt to 150/100 will store 1.5...
  #2   Spotlight this post!  
Unread 14-02-2004, 23:31
Aignam's Avatar
Aignam Aignam is offline
This Space For Sale
AKA: Anthony Mangia
#1257 (Parallel Universe)
Team Role: Scout
 
Join Date: Oct 2002
Rookie Year: 2003
Location: North Brunswick, New Jersey
Posts: 877
Aignam has a brilliant futureAignam has a brilliant futureAignam has a brilliant futureAignam has a brilliant futureAignam has a brilliant futureAignam has a brilliant futureAignam has a brilliant futureAignam has a brilliant futureAignam has a brilliant futureAignam has a brilliant futureAignam has a brilliant future
Send a message via AIM to Aignam Send a message via Yahoo to Aignam
Re: Robot Drifting

I spent the entire day yesterday, and 2 hours today learning to stop our 2003 robot on a dime in a 30 by 36 box when driving from about 10 feet away. Yes, the robot drifts. Yes, it is really annoying to have to compensate for it. Yes, this is going to happen in real matches. Yes, I'm going to shut up and deal with it. Just have your driver prepare for it.
__________________
Some Thoughts to Ponder
How does a sign turn into a lady friend? Don't optional stop signs ruin the purpose? What are pneumatics? Am I really banned from 229 for life? Can walls get bigger?

Aignam. Pronounced A-Num. Mangia backwards.

NJFIRST.org | Best Thread. Ever.

AIM: Aignam | ICQ: 265237569 | E-mail: AnthonyMangia@aol.com | HTTP: www.aignam.com
  #3   Spotlight this post!  
Unread 15-02-2004, 12:00
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
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,801
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 Drifting

Quote:
Originally Posted by steven114
Might I point out that 150/100 will evaluate to 1, not 1.5... there is no way to store a floating point number in an integer. You can hack around it by storing an exponent, but I don't believe setting myInt to 150/100 will store 1.5...
#define's don't evaluate expressions.
You don't evaluate (150/100). You evaluate (x * 150 / 100).
To get a floating point effect you do all your multiplication first, then all your division.

In integer math,e.g.,

x = 150/100 * 100 = 100
but
x = 100 * 150 / 100 = 150

Just be careful to type cast the expression to the largest size you need, e.g., using all char for the above will return an incorrect result.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 15-02-2004 at 13:59.
  #4   Spotlight this post!  
Unread 15-02-2004, 12:13
Phil_Lutz's Avatar
Phil_Lutz Phil_Lutz is offline
Phil Lutz
#0851 (Froggers)
Team Role: Mentor
 
Join Date: Jan 2004
Location: El Segundo, CA
Posts: 67
Phil_Lutz is on a distinguished road
Send a message via Yahoo to Phil_Lutz
Re: Robot Drifting

You Constant (#define) can be a floating point value.
but....
when you apply it in your program the result will be an int.
ie.

#define CONSTANT 1.5

int adjust_speed(int speed_in)
(
int speed_out;
speed_out = (speed_in/CONSTANT);
return speed_out; //sends back an int
)
  #5   Spotlight this post!  
Unread 15-02-2004, 21:49
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: Robot Drifting

Quote:
Originally Posted by Phil_Lutz
You Constant (#define) can be a floating point value.
but....
when you apply it in your program the result will be an int.
ie.

#define CONSTANT 1.5

int adjust_speed(int speed_in)
(
int speed_out;
speed_out = (speed_in/CONSTANT);
return speed_out; //sends back an int
)
however, the floating-point constant forces the processor to do floating point math, which is slower. in this case, using
Code:
#define CONSTANT 3/2
is better, because the processor can use integer math, which is faster.
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
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
Controlling a FIRST robot with a Lego RCX Controller? archiver 2001 5 24-06-2002 04:19
NEW robot club archiver 2001 0 24-06-2002 03:15
Are you willing to let others take picture of your robot? Ken Leung Robot Showcase 21 10-04-2002 22:50
Kamikaze Robot Strategy... Joe Johnson Rules/Strategy 30 07-04-2002 21:42
Calling all Lawyers... ...Define "all parts" Joe Johnson General Forum 10 13-03-2002 15:12


All times are GMT -5. The time now is 04:21.

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