Go to Post ....a red-light-of-death. - Kevin Watson [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 13-02-2004, 10:50
AsimC AsimC is offline
Registered User
#0871 (West Islip Robotechs)
 
Join Date: Feb 2003
Location: West Islip, NY
Posts: 51
AsimC will become famous soon enough
Robot Drifting

Our team is having trouble with our robot drifting to the right while driving straight. We feel that is because one drill motor is running in reverse. I know there is a way to compensate for in in the programming but im not really sure how to do it. Would the Current Sensors help in programming the motors? Any suggestions or examples of code would be very helpful to us. Thanks alot.
__________________
WEST ISLIP ROBOTECHS - Team 871

-2004 SBPLI REGIONAL CHAIRMANS AWARD WINNERS!
-2003 SBPLI Regional Finalists with 545 and 566
-2002 SBPLI Rookie All-Star
-Former Student Team Leader and Programming Head
  #2   Spotlight this post!  
Unread 13-02-2004, 11:03
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Robot Drifting

Quote:
Originally Posted by AsimC
Our team is having trouble with our robot drifting to the right while driving straight. We feel that is because one drill motor is running in reverse. I know there is a way to compensate for in in the programming but im not really sure how to do it. Would the Current Sensors help in programming the motors? Any suggestions or examples of code would be very helpful to us. Thanks alot.
The easiest way to do this is to have to enocders on the dirve wheels. FIgure out using those how much faster the one motor is turning than the other. From that figure out how much of a reduction in PWMs you need to make them balance and store that value in a #define. Use the define as an addition/subtraction to what you would normally be putting out on the fast side. If the difference between the motors ever changes, just change the #define value, recompile, and download.

Here is a quick example:
Code:
// Somewhere t the top of the file. Comp is short for compensation
// This is the amount of difference in PWMs that makes the motors approzimatly even
#define COMP_SPEED 15
 
 
// In some function that use the motors.
// Go forward. pwm02 is on the slow side
pwm01 = 255;
pwm02 = 255 - COMP_SPEED;
 
// At some later point in the function.
// Go in reverse.
pwm01 = 0;
pwm02 = 0 + COMP_SPEED; // The 0 isn't nessecary, it's just there to illustrate the point
That isn't the optimal solution, of course. The best idea is to have your program monitoring the enocoders and if it sees one side going faster than the other when it shouldn't be, it autonomatically corrects. But, that is more complicated and you should be able to get away with the first solution.
__________________


Last edited by Ryan M. : 13-02-2004 at 11:05.
  #3   Spotlight this post!  
Unread 13-02-2004, 11:36
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,745
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Robot Drifting

I don't think that'll work quite like you intend. It'll work fine for autonomous mode dead reckoning, but not for normal driving, really. I'd think in normal driving, the difference would scale with the speed of the motors, and you'd need a more complicated function to figure out the compensation.

In addition, your reverse compensation isn't right. Remember, when you're going in that direction, the motor that's normally going in reverse is now going forwards. It's now the one that needs to be compensated. The reverse direction should be:

pwm01 = 0 + COMP_SPEED;
pwm02 = 0;
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
  #4   Spotlight this post!  
Unread 13-02-2004, 11:36
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,906
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 AsimC
Our team is having trouble with our robot drifting to the right while driving straight. We feel that is because one drill motor is running in reverse. I know there is a way to compensate for in in the programming but im not really sure how to do it. Would the Current Sensors help in programming the motors? Any suggestions or examples of code would be very helpful to us. Thanks alot.
There are lots of ways to handle this.

The right/left drivetrains are rarely 100% balanced, so you should always be able to adjust for it in the code as necessary. Be aware that every time you adjust the drive system (replace a wheel, fix the alignment) you need to revisit the code adjustment.

An easy method is to first assume the difference is linear and adjust the more powerful side down to match the less powerful side as a percentage of full power. These will of course be different for driving forwards and backwards, so add an if statement for that.




e.g.,
stronger side power = current power - (current power/full power * constant)


weaker side power = current power

The simplest way to select constant is:


- Run the robot at full power and note which side lags.
- Pick a value for constant above, put it into the code and run the robot again.
- Repeat until you are driving straight.

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.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 13-02-2004 at 11:57.
  #5   Spotlight this post!  
Unread 13-02-2004, 11:51
Matt Adams's Avatar
Matt Adams Matt Adams is offline
b(o_o)d
FRC #1525 (Warbots)
Team Role: Engineer
 
Join Date: Dec 2003
Rookie Year: 2000
Location: Arlington Hts. IL
Posts: 375
Matt Adams has a reputation beyond reputeMatt Adams has a reputation beyond reputeMatt Adams has a reputation beyond reputeMatt Adams has a reputation beyond reputeMatt Adams has a reputation beyond reputeMatt Adams has a reputation beyond reputeMatt Adams has a reputation beyond reputeMatt Adams has a reputation beyond reputeMatt Adams has a reputation beyond reputeMatt Adams has a reputation beyond reputeMatt Adams has a reputation beyond repute
Send a message via AIM to Matt Adams
Post Re: Robot Drifting

Software fixes to mechanical problems... eek!

If your robot is drifting... there's one quick thing that you should look at right away... this is a very typical situation, but it can often (but not always) be adjusted by shifting your weight distribution.

The drill motors do not run in the same speed forward and backward, if this is what you're using, (or even if you're not) perhaps you could shift some weight around your robot to the side opposite of where you're drifting... i.e. if you're drifting to the right, try to move some weight on the left side.

Mind you that in reverse, drifting will be more significant if you're evenly balanced via weight in forward. Maybe you'll balance this by software in reverse, since you can try to avoid needing to drive accurate and pushing in that direction.

In general, try to do as much as you can mechanically, and don't try to kill your robot's power input through software... your drivers wil want every ounce of it!

Good luck!

Matt
__________________
Matt Adams - Engineer at Danaher Motion
Team 1525 - Warbots - Deerfield High School

Last edited by Matt Adams : 13-02-2004 at 13:54.
  #6   Spotlight this post!  
Unread 13-02-2004, 11:58
Unsung FIRST Hero
JVN JVN is offline
@JohnVNeun
AKA: John Vielkind-Neun
FRC #0148 (Robowranglers)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 2000
Location: Greenville, Tx
Posts: 3,159
JVN has a reputation beyond reputeJVN has a reputation beyond reputeJVN has a reputation beyond reputeJVN has a reputation beyond reputeJVN has a reputation beyond reputeJVN has a reputation beyond reputeJVN has a reputation beyond reputeJVN has a reputation beyond reputeJVN has a reputation beyond reputeJVN has a reputation beyond reputeJVN has a reputation beyond repute
Re: Robot Drifting

I can't believe all the solutions which have been mentioned so far as the "simplest".

The SIMPLEST solution, is to teach your driver to live with it, and account for the drift when he/she is on the field. It's not that difficult...

Human controlled, dynamically adjusted voltage scaling. (Also known as HuCDAVS), is a simple control method that involves holding one joystick a little bit further forward than the other.

John
__________________
In the interest of full disclosure: I work for VEX Robotics a subsidiary of Innovation First International (IFI) Crown Supplier & Proud Supporter of FIRST
  #7   Spotlight this post!  
Unread 13-02-2004, 12:04
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,906
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 JVN
Human controlled, dynamically adjusted voltage scaling. (Also known as HuCDAVS), is a simple control method that involves holding one joystick a little bit further forward than the other.

John
Sadly, HuCDAVS have been ruled illegal by FIRST during autonomous mode.

I will note that we don't usually apply this software fix when our HuCDAVS is operable.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 13-02-2004 at 12:07.
  #8   Spotlight this post!  
Unread 13-02-2004, 19:22
AsimC AsimC is offline
Registered User
#0871 (West Islip Robotechs)
 
Join Date: Feb 2003
Location: West Islip, NY
Posts: 51
AsimC will become famous soon enough
Re: Robot Drifting

Quote:
Originally posted by Mark McLeod
e.g.,
stronger side power = current power - (current power/full power * constant)
weaker side power = current power
When you say current power...where am i getting this number from?
__________________
WEST ISLIP ROBOTECHS - Team 871

-2004 SBPLI REGIONAL CHAIRMANS AWARD WINNERS!
-2003 SBPLI Regional Finalists with 545 and 566
-2002 SBPLI Rookie All-Star
-Former Student Team Leader and Programming Head
  #9   Spotlight this post!  
Unread 13-02-2004, 21:12
Rich Kressly's Avatar
Rich Kressly Rich Kressly is offline
Robot/STEM troublemaker since 2001
no team (Formerly 103 & 1712. Now run U.P. Robotics (other programs))
Team Role: Mentor
 
Join Date: Oct 2001
Rookie Year: 2001
Location: Pennsburg, PA
Posts: 2,045
Rich Kressly has a reputation beyond reputeRich Kressly has a reputation beyond reputeRich Kressly has a reputation beyond reputeRich Kressly has a reputation beyond reputeRich Kressly has a reputation beyond reputeRich Kressly has a reputation beyond reputeRich Kressly has a reputation beyond reputeRich Kressly has a reputation beyond reputeRich Kressly has a reputation beyond reputeRich Kressly has a reputation beyond reputeRich Kressly has a reputation beyond repute
Re: Robot Drifting

Quote:
Originally Posted by JVN
I can't believe all the solutions which have been mentioned so far as the "simplest".

The SIMPLEST solution, is to teach your driver to live with it, and account for the drift when he/she is on the field. It's not that difficult...

Human controlled, dynamically adjusted voltage scaling. (Also known as HuCDAVS), is a simple control method that involves holding one joystick a little bit further forward than the other.

John
Amen. We've always had tremendous success using the "learn to deal with it method."
__________________
technology, innovation, and invention without a social conscience will only allow us to destroy ourselves in more creative ways
  #10   Spotlight this post!  
Unread 13-02-2004, 22:12
team222badbrad's Avatar
team222badbrad team222badbrad is offline
3D Printing Specialist
AKA: Bradley Rigdon
FRC #0222 (The Tigertrons)
Team Role: Mentor
 
Join Date: Sep 2001
Rookie Year: 2000
Location: Tunkhannock, PA
Posts: 1,091
team222badbrad has a reputation beyond reputeteam222badbrad has a reputation beyond reputeteam222badbrad has a reputation beyond reputeteam222badbrad has a reputation beyond reputeteam222badbrad has a reputation beyond reputeteam222badbrad has a reputation beyond reputeteam222badbrad has a reputation beyond reputeteam222badbrad has a reputation beyond reputeteam222badbrad has a reputation beyond reputeteam222badbrad has a reputation beyond reputeteam222badbrad has a reputation beyond repute
Send a message via AIM to team222badbrad
Re: Robot Drifting

Simple solution?

next year make sure both motors are running in the same direction...

or if time/design allows fix it before ship date!

we have been doing this for 2 years now
__________________
Tigertrons are on Facebook!

http://www.printo3d.com

16th FIRST season for me.
  #11   Spotlight this post!  
Unread 13-02-2004, 22:52
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,906
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 AsimC
When you say current power...where am i getting this number from?
That's your normal pwm output value.

This is a more concrete example using a joystick value to drive:
Code:
int temp; // use to hold signed pwm value (-127 to 127) for simpler math
 
pwm13 = p1_y; // (or whatever your normal power calculation is)
temp = pwm13 - 127;  // convert to human math:) 
temp = temp - (temp/127 * 10);
pwm13 = temp + 127; // convert back to normal 0-254 range
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #12   Spotlight this post!  
Unread 14-02-2004, 16:15
AsimC AsimC is offline
Registered User
#0871 (West Islip Robotechs)
 
Join Date: Feb 2003
Location: West Islip, NY
Posts: 51
AsimC will become famous soon enough
Re: Robot Drifting

Thank you so much. Im going to try it on tuesday when we get back to working on the bot and hope it works.
__________________
WEST ISLIP ROBOTECHS - Team 871

-2004 SBPLI REGIONAL CHAIRMANS AWARD WINNERS!
-2003 SBPLI Regional Finalists with 545 and 566
-2002 SBPLI Rookie All-Star
-Former Student Team Leader and Programming Head
  #13   Spotlight this post!  
Unread 14-02-2004, 17:38
Adam Y.'s Avatar
Adam Y. Adam Y. is offline
Adam Y.
no team (?????)
 
Join Date: Mar 2002
Location: Long Island
Posts: 1,979
Adam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to behold
Send a message via AIM to Adam Y.
Re: Robot Drifting

Can the drill motors polarity be reversed on one of them? Check the cans for the positive above the one brush. Also is one tire gaining more traction than the other. I noticed today that an extreme of what you are describing happened in last years robot. The frame was so warped that the robot was actually swerving since one wheel was not getting enough traction.
__________________
If either a public officer or any one else saw a person attempting to cross a bridge which had been ascertained to be unsafe, and there were no time to warn him of his danger, they might seize him and turn him back without any real infringement of his liberty; for liberty consists in doing what one desires, and he does not desire to fall into the river. -Mill
  #14   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...
  #15   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
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 03:59.

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