|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#17
|
||||
|
||||
|
Re: paper: FRC #33 The Killer Bees 2013 Software - BuzzXVIII (Buzz18)
Quote:
..........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))); 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);
}
When you say halo/cheesy drive in this context... do you mean driving the steering without using the y component? |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|