Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Dead zone for RC control (http://www.chiefdelphi.com/forums/showthread.php?t=43472)

JJMax7 07-02-2006 15:11

Dead zone for RC control
 
I'm using the arcade drive controls through Easy C, but the current controller the drivers want to use doesn't center itself very well, so I need to know if there is anyway to put a dead zone into the code. Thanks for the help.

Chris_Elston 08-02-2006 15:44

Re: Dead zone for RC control
 
Quote:

Originally Posted by JJMax7
I'm using the arcade drive controls through Easy C, but the current controller the drivers want to use doesn't center itself very well, so I need to know if there is anyway to put a dead zone into the code. Thanks for the help.


I think you have two choices:

1. See this Post and use the drive ( ); function. "built in deadband".

2. Make your own "arcade" control by mixing the port1_x and port1_y with a SETPWM. Then using IF statements so that the mixed values from the joystick have to be greater than your deadband, else SetPWM 127.

JJMax7 15-02-2006 17:37

Re: Dead zone for RC control
 
I figured out a really easy way to do it. Turns out I just didn't think it through. I made a simple If-Else statement. If the joystick values are between then set pwms as 127 else tank drive. Worked well enough.

ida_noeman 15-02-2006 18:16

Re: Dead zone for RC control
 
A very readable way to do it is to make an inline function like this:
Code:

#define STOP 127
#define DEAD_ZONE 15 // or any other number, fool around with this to make it work as you want it to
#define IN_DEAD_ZONE(x) (x <= DEAD_ZONE + STOP && x>= STOP - DEAD_ZONE)

This would work with something like this:
Code:

if (IN_DEAD_ZONE(p1_y))
p1_y = STOP;



All times are GMT -5. The time now is 01:33.

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