Go to Post Truly good teasers should give people a good place to start guessing, while still leaving some mystery and uncertainty. - Travis Covington [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 23-02-2005, 11:37
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Robot Drifts when driving strait.

Now the robot is shipped I'm kind of tinkering with last years robot. This robot has some form of loss in the drive train on the left side and causes it to drift intermittently with the 2005 navigation code when driving strait. The encoders work but they don't seem to be used when driving strait. Anyone have some code I can try to adjust PWM's based on encoder counts?
  #2   Spotlight this post!  
Unread 23-02-2005, 23:27
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 746
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Re: Robot Drifts when driving strait.

Quote:
Originally Posted by Kingofl337
Now the robot is shipped I'm kind of tinkering with last years robot. This robot has some form of loss in the drive train on the left side and causes it to drift intermittently with the 2005 navigation code when driving strait. The encoders work but they don't seem to be used when driving strait. Anyone have some code I can try to adjust PWM's based on encoder counts?

Here is something our team was toying with...never got it finished and debugged totally...but if your using encoders this is a start for you.


Code:
long drv_left_encoder;
long drv_right_encoder;
long drv_diff_left;
long drv_diff_right;
static int DRV_DEADBAND = 5; //only correct left or right side if encoder difference is greater than deadband
static int DRV_BOOST = 10; //turbo boost if button pressed
int print_counter;
int print_counter_before;

relay1_fwd = 0; //turn off lights, not in automous mode anymore.
camera_find_color( 0 ); //turn off vision system.


 p1_y = (p1_y / 3) + ((127 / 3) * 2); //scale down Y axis
 p1_x = (p1_x / 3) + ((127 / 3) * 2); //scale down X axis
 
 left_pwm = Limit_Mix(2000 + p1_y - p1_x + 127); //limit pwm
 right_pwm = Limit_Mix(2000 + p1_y + p1_x - 127); //limit pwm

 drv_left_encoder = Get_Left_Encoder_Count(); //get encoder count
 drv_right_encoder = Get_Right_Encoder_Count(); //get encoder count
 drv_diff_left = drv_left_encoder - drv_right_encoder; //subtract left from right because I dunno if ABS is supported in this dumb PIC
 drv_diff_right = drv_right_encoder - drv_left_encoder; //subtract right from left because I dunno if ABS is supported in this dumb PIC

if ((p1_y <= 135) && (p1_y >= 120)) //reset encoder counts
	{
	Set_Left_Encoder_Count(0);
    Set_Right_Encoder_Count(0);
	drv_diff_left = 0;
	drv_diff_right = 0;
	}

#ifdef DEBUG_DRVMAN //uncomment DEBUG_DRVMAN in robot.c to get this to excute.

if (++print_counter_before >= 2)
	{
	print_counter_before = 0;
	printf( "BY=%d BLE=%d BLD=%d BRE=%d BRD=%d BLPWM=%d bRPWM=%d\r",p1_y,(int)(drv_left_encoder),(int)(drv_diff_left),(int)(drv_right_encoder),(int)(drv_diff_right),left_pwm,right_pwm);
	}

#endif

if ((p1_x <= 135) && (p1_x >= 120)) //not turning
	{
	if (p1_y >= 145) //check to see if we are driving straight forward
		{

		if (drv_diff_left >= DRV_DEADBAND) //increase power to the right drive pwm12
			{
			if (drv_diff_left > DRV_DEADBAND)
				{
				right_pwm = right_pwm + 6;
				}
			if (drv_diff_left > DRV_DEADBAND + 10)
				{
				right_pwm = right_pwm + 8;
				}
			if (drv_diff_left > DRV_DEADBAND + 20)
				{
				right_pwm = right_pwm + 10;
				}
			}
	
		if (drv_diff_right >= DRV_DEADBAND) //increase power to the left drive pwm11
			{
			if (drv_diff_right > DRV_DEADBAND)
				{
				left_pwm = left_pwm + 6;
				}
			if (drv_diff_right > DRV_DEADBAND + 10)
				{
				left_pwm = left_pwm + 8;
				}
			if (drv_diff_right > DRV_DEADBAND + 20)
				{
				left_pwm = left_pwm + 10;
				}
			}
		}

	if (p1_y <= 120) //check to see if we are driving straight backwards
		{
		if (drv_diff_left >= DRV_DEADBAND) //increase power to the right drive pwm12
			{
			if (drv_diff_left > DRV_DEADBAND)
				{
				right_pwm = right_pwm - 3;
				}
			if (drv_diff_left > DRV_DEADBAND + 10)
				{
				right_pwm = right_pwm - 4;
				}
			if (drv_diff_left > DRV_DEADBAND + 20)
				{
				right_pwm = right_pwm - 5;
				}
			}
	
		if (drv_diff_right >= DRV_DEADBAND) //increase power to the left drive pwm11
			{
			if (drv_diff_right > DRV_DEADBAND)
				{
				left_pwm = left_pwm - 3;
				}
			if (drv_diff_right > DRV_DEADBAND + 10)
				{
				left_pwm = left_pwm - 4;
				}
			if (drv_diff_right > DRV_DEADBAND + 20)
				{
				left_pwm = left_pwm - 5;
				}
			}
		}
	}
else //if we are turning, then don't try to drive straight
	{
	Set_Left_Encoder_Count(0);
    Set_Right_Encoder_Count(0);
	drv_diff_left = 0;
	drv_diff_right = 0;
	}

/*
if (p1_y >= 130 && p1_sw_trig) //forward boost, will be used later for turbo boost pushing power
	{
	pwm11 = left_pwm + DRV_BOOST;
	pwm12 = right_pwm + DRV_BOOST;
	}
*/
/*
pwm11 = left_pwm;
pwm12 = right_pwm;

#ifdef DEBUG_DRVMAN //uncomment DEBUG_DRVMAN in robot.c to get this to excute.

if (++print_counter >= 2)
	{
	print_counter = 0;
	printf( "AY=%d ALE=%d ALD=%d ARE=%d ARD=%d ALPWM=%d ARPWM=%d\r",p1_y,(int)(drv_left_encoder),(int)(drv_diff_left),(int)(drv_right_encoder),(int)(drv_diff_right),left_pwm,right_pwm);
	}

#endif
*/
}
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
  #3   Spotlight this post!  
Unread 23-02-2005, 23:35
Biff Biff is offline
Registered User
AKA: Tom Cooper
#1227 (Techno Gremlins)
Team Role: Mentor
 
Join Date: Jan 2004
Location: Grand Rapids MI
Posts: 214
Biff is a jewel in the roughBiff is a jewel in the roughBiff is a jewel in the roughBiff is a jewel in the rough
Re: Robot Drifts when driving strait.

Quote:
Originally Posted by Kingofl337
Now the robot is shipped I'm kind of tinkering with last years robot. This robot has some form of loss in the drive train on the left side and causes it to drift intermittently with the 2005 navigation code when driving strait. The encoders work but they don't seem to be used when driving strait. Anyone have some code I can try to adjust PWM's based on encoder counts?
If last years robot used drill motors, they don't drive with the same force if they are turning in opposite directions, Drive the screw in more power and speed. Last year we mounted the motors so they turned the same direction together for forward or reverse. Yes you can solve this with code. Good luck
  #4   Spotlight this post!  
Unread 25-02-2005, 14:39
bbene's Avatar
bbene bbene is offline
Team 754 Webmaster
AKA: Ben
FRC #0754 (Frostbyte)
Team Role: Webmaster
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Marinette, WI
Posts: 8
bbene is an unknown quantity at this point
Send a message via AIM to bbene Send a message via MSN to bbene Send a message via Yahoo to bbene
Re: Robot Drifts when driving strait.

We had a similar problem with last year's robot because one motor was on the wrong fuse thus causing the robot to drift.
__________________
Ben - Team 754 Webmaster/Former Student/College Mentor
Team Site
Personal Site
  #5   Spotlight this post!  
Unread 25-02-2005, 19:14
JKnox JKnox is offline
JKnox
#0820 (DeltaTech)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Toronto, Ontario
Posts: 23
JKnox will become famous soon enough
Re: Robot Drifts when driving strait.

We've had a similar problem a bunch of times. I usually found it to simply be a lack of lubrication. If the robot's been sitting around for a long period of time the gearboxes may need to be greased. The drifting might be the result of one gearbox needing more lube than the other.
  #6   Spotlight this post!  
Unread 25-02-2005, 20:46
NoodleKnight's Avatar
NoodleKnight NoodleKnight is offline
24 Hours of LeMons?
FRC #0100 (WHS&CHS Robotics)
Team Role: Alumni
 
Join Date: Aug 2004
Rookie Year: 2003
Location: Davis, CA
Posts: 320
NoodleKnight has much to be proud ofNoodleKnight has much to be proud ofNoodleKnight has much to be proud ofNoodleKnight has much to be proud ofNoodleKnight has much to be proud ofNoodleKnight has much to be proud ofNoodleKnight has much to be proud ofNoodleKnight has much to be proud ofNoodleKnight has much to be proud of
Send a message via AIM to NoodleKnight
Re: Robot Drifts when driving strait.

Quote:
Originally Posted by JKnox
We've had a similar problem a bunch of times. I usually found it to simply be a lack of lubrication. If the robot's been sitting around for a long period of time the gearboxes may need to be greased. The drifting might be the result of one gearbox needing more lube than the other.
True, but only if their tranmissions use the CIMs, like what Biff said, the Bosch Drill motors from 2004 have a winding bias, which makes them turn faster in one direction. Proper lubrication of the gearboxes may help, but you'll still have a bit of drift.
__________________
WHS/CHS Robotics - Team 100 (2003-2006):
2006- Delphi's Driving Tommorow's Technology @ Davis | Imagery Award @ SVR | 2004- SVR Finalists (w/ 691 and 1280)| 2003- Delphi's Driving Tommorow's Technology @ Sac
  #7   Spotlight this post!  
Unread 01-03-2005, 17:33
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: Robot Drifts when driving strait.

I't uses a pair of drive motors. The same as this years robots use. Its just a single motor per wheel instead of 2per.
  #8   Spotlight this post!  
Unread 09-03-2005, 10:10
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,559
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Robot Drifts when driving strait.

The cmd_drive code doesn't attempt to make sure the wheels are turning at the same velocity, just that they turn the same number of ticks. Does the robot straighten up at the end?

If you have different amounts of wheel slip on the two sides counting encoder ticks won't help at all.


Hope you guys did well at BAE.
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
Winning Robot or Quality Robot? Eric Bareiss General Forum 30 09-02-2006 13:19
Manual placement of tetras Petey Rules/Strategy 7 22-02-2005 18:04
Robot veers left when driving backwards! xxmaddjxx Technical Discussion 3 19-02-2005 04:57
Robot Collaboration Karthik General Forum 153 18-02-2004 03:40
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 10:57.

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