Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Need help with our deadspace. (http://www.chiefdelphi.com/forums/showthread.php?t=42692)

sacr3denigma 26-01-2006 14:38

Need help with our deadspace.
 
This is what we are using for our deadspace. Only problem with it is that it jumps from being 127 to say 142 without slowly getting up to speed. We would like to make this much smooth. I am fairly new at robot language but have c++ experience if that helps any. Please reply if you can help thankyou.
temp2 = (unsigned int)p2_y;

if (temp2 > (127 + DEADSPACE))
{
pwm02 = 255 - (unsigned char)(((temp2 - (127 + DEADSPACE)) * (127 / (127 - DEADSPACE))) + 127);
}
else if (temp2 < (127 - DEADSPACE))
{
pwm02 = 255 - (unsigned char)(temp2 * 127 / (127 - DEADSPACE));
}
else
{
pwm02 = 127;
}

billbo911 26-01-2006 14:57

Re: Need help with our deadspace.
 
Quote:

Originally Posted by sacr3denigma
This is what we are using for our deadspace. Only problem with it is that it jumps from being 127 to say 142 without slowly getting up to speed. We would like to make this much smooth. I am fairly new at robot language but have c++ experience if that helps any. Please reply if you can help thankyou.
temp2 = (unsigned int)p2_y;

if (temp2 > (127 + DEADSPACE))
{
pwm02 = 255 - (unsigned char)(((temp2 - (127 + DEADSPACE)) * (127 / (127 - DEADSPACE))) + 127);
}
else if (temp2 < (127 - DEADSPACE))
{
pwm02 = 255 - (unsigned char)(temp2 * 127 / (127 - DEADSPACE));
}
else
{
pwm02 = 127;
}

I believe what you are seeing is the Dead band built into the Victors themselves. This window, approx. 117 to 137, is to allow for the fact that most Joysticks don't always return to 127 at dead center, there is some variability. So, IFI designed this window to accommodate this variability. My suggestion: Calibrate the Victor to the input being used.

Other users here may suggest alternatives to this. Programming that will apply the standard slope equation, Y=MX+B, is one of them. I find that calibrating the Victor is a little easier, but by no means is it "The Best" way to do it.

gnormhurst 26-01-2006 18:09

Re: Need help with our deadspace.
 
Quote:

Originally Posted by billbo911
I believe what you are seeing is the Dead band built into the Victors themselves. This window, approx. 117 to 137, is to allow for the fact that most Joysticks don't always return to 127 at dead center, there is some variability. So, IFI designed this window to accommodate this variability. My suggestion: Calibrate the Victor to the input being used.

Other users here may suggest alternatives to this. Programming that will apply the standard slope equation, Y=MX+B, is one of them. I find that calibrating the Victor is a little easier, but by no means is it "The Best" way to do it.

I spent many hours developing a drive system that was less sensitive at slow speeds. Here is a thread that includes the code.

I also got around the fact that the Victor controllers see a value within about +/-7 units of 127 and just call it zero. If the value you want to send is less than 127, subtract an additional 7. If it is more than 127, add an additional 7:

if ( val > 127 )
val += 7;
if ( val < 127 )
val -= 7;

The Victors have a calibration procedure designed to match them to your joystick, but I like to calibrate them to specific values, so I wrote some code that would produce 127s, then 0s when I pushed one button, then 255s when I pushed another (like I was swinging the joystick through its range). I used that while I calibrated the Victors. The Victor calibration procedure is explained in the Victor data sheet.


All times are GMT -5. The time now is 11:46.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi