Go to Post The only fee our team charges is for your heart and soul. No refunds. - Koko Ed [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 24-01-2009, 17:44
ellisk ellisk is offline
Registered User
FRC #1540
 
Join Date: Dec 2008
Location: Vancouver, WA
Posts: 41
ellisk is on a distinguished road
Re: Using encoders for traction control help

Thanks for the tips. Here's examples of what I've been trying (none of which works):

Code:
float correctForSlip(float transVel, float omniVel, float realWheel, float desiredWheel)
{
	// make sure that there's enough of a difference
	const float slipThreshold = 15.0;
	if (fabs(transVel - omniVel) < slipThreshold)
		return desiredWheel;

// note for forums: code after here varies depending upon attempt

	const float adjustSlipK = -0.005; // tuned experimentally
	
	float delta = fabs(transVel - omniVel) * adjustSlipK;
	
	if (transVel < omniVel) // need to up the number
		return desiredWheel + delta;
	else
		return desiredWheel - delta;
}
That didn't work, so I tried instead:
Code:
	if (transVel != 0) {
		float decreaseMtrMultiplier = omniVel / transVel;
		return decreaseMtrMultiplier * desiredWheel;
	} else {
		const float seedSlipK = 0.001;
		return seedSlipK * omniVel;
	}
And then this fails too:
Code:
	// stupid method: increase wheel speed
	const float speedupK = 0.05;
	if (realWheel > 0)
		return realWheel + speedupK;
	else if (realWheel < 0)
		return realWheel - speedupK;
	else { // realWheel == 0
		if (omniVel > 0)
			return speedupK;
		else if (omniVel < 0)
			return speedupK;
		else // should never happen
			return desiredWheel;
	}
???? Perhaps I'm missing something here, but the "back off when a wheel is going too fast, increase when going too slow" seems to be difficult to implement correctly.

-Kevin
 


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
Implementing Traction Control for an advantage in the 2009 game DonRotolo Programming 143 27-02-2009 11:53
Help for Better Understanding of Shaft Encoders Xufer Programming 2 08-01-2007 23:14
Autonomous using encoders Mr.G Programming 11 17-01-2006 03:34
Using Shaft Encoders D.Viddy Programming 7 14-12-2004 18:27
Traction Control Algorithm Mr. Lim Programming 3 20-01-2004 14:26


All times are GMT -5. The time now is 18:38.

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