Log in

View Full Version : null zone


Xufer
13-02-2004, 20:46
where in the code is 127 defined as the null zone?

im trying to set a null zone for the joystick so i can apply a "parabola" to decrese the sensitivity for fine driving. but first off i need to set this null zone so its not a true parabola, because more than 2 points would be touching the x-axis in one spot.

nonetheless, Where is the 127 nullzone defined ?

Richomundo
13-02-2004, 20:58
where in the code is 127 defined as the null zone?

im trying to set a null zone for the joystick so i can apply a "parabola" to decrese the sensitivity for fine driving. but first off i need to set this null zone so its not a true parabola, because more than 2 points would be touching the x-axis in one spot.

nonetheless, Where is the 127 nullzone defined ?


its in the reference guide, however today i adjusted the sensitivity by making a very simple program code:

here is what i used.
the only problem is its a single speed code for the window motor.

you can change the values to make it more or less sensitive.
****************************
/* you can also change sensitivity here*/
/* if statements to raise and lower the arm */
if (p2_y > 180)
{relay1_fwd=1;
relay1_rev=0;}
else if (p2_y < 74)
{relay1_fwd=0;
relay1_rev=1;}
else
{relay1_fwd=0;
relay1_rev=0;}
/* ********************** */
the 1st if statement says if the joystick is above 180, then send a signal to relay 1 to make the window motor go. since iats a relay it only goes one speed.
sorry if i didnt answer your question
but thats how we did it.

The Lucas
13-02-2004, 21:16
Quote from Innovation First website:
"The Victor 884 has a deadband with respect to the PWM signal, which is approximately 117 to 137 (127 center). "

So the null zone is in the Speed Controller, you can't change the 127 center. However you can make the deadband bigger in code. I recommend calibrating your speed controllers to adjust them to your joysticks. Instructions are on the website

Xufer
14-02-2004, 01:50
Yea, see the fun thing is as soon as i posted my little problem where my head wouldnt work, the problem was solved, ill post the code tomarrow for the nullzone aand when i finish the parabola for the joystick ill post that aswell it should be funny to see working heh

--thanks for the help.

Ryan M.
14-02-2004, 07:58
Yea, see the fun thing is as soon as i posted my little problem where my head wouldnt work, the problem was solved,...Confessional debugging. :) Works every time.

Xufer
14-02-2004, 10:02
As promised I said id post it in the morning and its morning... Im not exactly sure if it works yet i cant tels the speed untill i can use it on the "real" robot which is getting some "fine" tuning. Im going to go "program" things...

COFFEE POT... oh its too early.


pwm01 = p1_y;
if (p1_y >= 120 && p1_y <= 133)
{pwm01 = 127;}
else if (p1_y < 120 && p1_y > 133)
{pwm01 = 1/1635.6 * p1_y * p1_y - 0.16149181 * p1_y * p1_y + 9.10002;}

/******************/

pwm02 = p2_y;
if (p2_y >= 120 && p2_y <= 133)
{pwm02 = 127;}
else if (p2_y < 120 && p2_y > 133)
{pwm02 = 1/1635.6 * p2_y * p2_y - 0.16149181 * p2_y * p2_y + 9.10002;}

Xufer
14-02-2004, 10:35
Ok. it works ! yea, anyway thanks again guys. Any questions about it id be glad to answer.

-Xufer

Xufer
15-02-2004, 09:55
Sorry wasnt paying attention when i posted that it was off the backup file. heres the working version.



pwm01 = p1_y;
if (p1_y >= 120 && p1_y <= 133)
{pwm01 = 127;}
else if (p1_y < 120 && p1_y > 133)
{pwm01 = (1/1635.6 * (p1_y * p1_y) - 0.16149181 * (p1_y * p1_y) + 9.10002);}

/******************/

pwm02 = p2_y;
if (p2_y >= 120 && p2_y <= 133)
{pwm02 = 127;}
else if (p2_y < 120 && p2_y > 133)
{pwm02 = (1/1635.6 * (p2_y * p2_y) - 0.16149181 * (p2_y * p2_y) + 9.10002);}


Sometimes numbers are fun... not today.

Ryan M.
15-02-2004, 12:33
Sorry wasnt paying attention when i posted that it was off the backup file. heres the working version.



pwm01 = p1_y;
if (p1_y >= 120 && p1_y <= 133)
{pwm01 = 127;}
else if (p1_y < 120 && p1_y > 133)
{pwm01 = (1/1635.6 * (p1_y * p1_y) - 0.16149181 * (p1_y * p1_y) + 9.10002);}

/******************/

pwm02 = p2_y;
if (p2_y >= 120 && p2_y <= 133)
{pwm02 = 127;}
else if (p2_y < 120 && p2_y > 133)
{pwm02 = (1/1635.6 * (p2_y * p2_y) - 0.16149181 * (p2_y * p2_y) + 9.10002);}


Sometimes suqre numbers are fun... not today.A warning about this code. You use floating points in the equations. The way C works, temporary results in an equation are subject to the same limitations that the final result will be. (I.E. if you are going to ended storing the result in an unsigned char, then none of the stuff that occurs in the equation should pass 0 or 255 either, because it will wrap around.) So, your results will probably be fairly inaccurate.

Also, it may be right, but just in case, the equation is complex, make sure that it is being evaluated the way you think it is.

Somebody correct me if I'm wrong. :)

--EDIT--
Well, not all compilers work this way. I don't konow about this compiler. :)

Tom Bottiglieri
15-02-2004, 12:54
check out this thread. I havent actually used this tool yet, but it seems to be what you are looking for...

lookup table (http://www.chiefdelphi.com/forums/showthread.php?t=24554)