View Single Post
  #2   Spotlight this post!  
Unread 26-07-2013, 21:15
JamesTerm's Avatar
JamesTerm JamesTerm is offline
Terminator
AKA: James Killian
FRC #3481 (Bronc Botz)
Team Role: Engineer
 
Join Date: May 2011
Rookie Year: 2010
Location: San Antonio, Texas
Posts: 298
JamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to behold
Re: paper: FRC #33 The Killer Bees 2013 Software - BuzzXVIII (Buzz18)

Quote:
Originally Posted by apalrd View Post
In any case, the Radius component should be active from 0 to 90 degrees, plus a little for driver forgiveness. I am aware that above 90 slightly more turning power is possible, but I didn't really care.
Ok... the key here is anything above 90 you didn't care... the original code reflects how I illustrate in this diagram below... so if the user went above 90 it would start to drop back down to 0 like this:
..........0
....-45.....45
-90.....+.... 90
....-45.....45
...........0

here is that implementation using atan2;

Code:
	//Find arctan of wheel stick relative to vertical (i.e. swap the x and y components)
	const double theta = atan2(wheelx,fabs(wheely));

	//Find the magnitude of the wheel stick
	double r = sqrt(((wheely * wheely) + (wheelx * wheelx)));
This should have identical functionality to what you have written... assuming this is how you intended to do it. It is a great idea and can offer forgiveness if user accidentally goes past 90... or if they don't want to push up it would still work if the stick Y was accidentally done below center.

Now then assuming this is true... both calls to interp_2d() are no longer needed as they will always return 1.0. Especially the Radius Enablement curve. So really the theta and r (magnitude) are the heart of the culver drive. Just using these by themselves can be a nice sweet substitute for anyone's function that takes an x-axis. I'll give this a shot in our drive and perhaps post it on you tube this weekend... the other cool thing is doing it like this... after obtaining the normalized value (i.e. theta * r )... it can be used with Ether's equations for even greater control of the distribution of the curve.

Here's a little snip of that...
Code:
if (AnalogEvents)
{
	//Now to use the attributes to tweak the value
	//First evaluate dead zone range... if out of range subtract out the offset for no loss in precision
	//The /(1.0-filter range) will restore the full range
	
	double Temp=fabs(Value); //take out the sign... put it back in the end
	Temp=(Temp>=key.FilterRange) ? Temp-key.FilterRange:0.0; 

	Temp=key.Multiplier*(Temp/(1.0-key.FilterRange)); //apply scale first then
	if (key.CurveIntensity<=1.0)
		Temp=key.CurveIntensity*pow(Temp,3) + (1.0-key.CurveIntensity)*Temp; //apply the curve intensity
	else
		Temp=pow(Temp,key.CurveIntensity); //apply the curve intensity

	//Now to restore the sign
	Value=(Value<0.0)?-Temp:Temp;

	std::vector<std::string>::iterator pos;
	for (pos = AnalogEvents->begin(); pos != AnalogEvents->end(); ++pos)
		m_controlledEventMap->EventValue_Map[*pos].Fire(key.IsFlipped?-Value:Value);
}

Quote:
Originally Posted by apalrd View Post
R allows us to return to 0 when the stick is centered, and the math works out such that you can drive it like a halo/cheesy drive if you want (although that's not quite ideal, the math works out the same).
When you say halo/cheesy drive in this context... do you mean driving the steering without using the y component?
Reply With Quote