View Single Post
  #5   Spotlight this post!  
Unread 13-02-2005, 14:51
AIBob's Avatar
AIBob AIBob is offline
AI Programmer
AKA: Bob Frank DOT org
FRC #0358 (Hauppauge Robotic Eagles)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Long Island, NY (in Binghamton now)
Posts: 297
AIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to behold
Send a message via ICQ to AIBob Send a message via AIM to AIBob Send a message via MSN to AIBob Send a message via Yahoo to AIBob
Re: joystick sensitivity

Quote:
Originally Posted by Joshua May
One thing we did was add in a "deadband" to the center of the joysticks, which has really helped. The code makes use of an absolute value function that we created. Today, we'll also be adding a ramping function to the joysticks just like what was described above, I can get you that code too if you need it.

Code:
#define DEADBAND 10
 
int abs(int x)
{
if (x >= 0)
return x;
else
return -x;
}
 
if (abs((p1_y - 127)) < DEADBAND)
p1_y = 127;
 
if (abs((p1_x - 127)) < DEADBAND)
p1_x = 127;
Here is something similar, only you do not need a seperate function... abs(p1_x) can be replaced with (p1_x && 0x7F), because the last bit is the sign, like so:
Code:
#define DEADBAND 10
if (((((signed int)p1_x-127) && 0x7f) < DEADBAND) p1_x=127;
if (((((signed int)p1_y-127) && 0x7f) < DEADBAND) p1_y=127;
__________________
- from B B frank