View Single Post
  #3   Spotlight this post!  
Unread 12-10-2004, 17:24
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,187
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Desensitizing Joysticks

Quote:
Originally Posted by Alan Anderson
Whenever you want to do processing on operator input (filtering, desensitizing, delta-coding, etc.), it makes the most sense to do it only when new values are available. I would definitely put it in user_routines.c, in the Process_Data_From_Master_uP() function.
What i would do is make a function that adjusts the value of the joystick depending on the input..
Code:
unsigned char Dead_Band(unsigned char input_value)
{
	unsigned char Output = 127;
	if (input_value < Dead_Band_Forward)
	{
		if(input_value > Dead_Band_Reverse)
		{
			Output = 127;
		}
		else
		{	
		Output = input_value;
		}
	}
	else if(input_value > Dead_Band_Forward)
	{	
	Output = input_value;
	}

	return Output;
}
Then i would use that in the user_routines.c file under the Default_Routine() function as your output value to whatever PWM you want it to output in.

Code:
void Default_Routine(void)..........

pwm01 = Dead_Band(p1_y);
pwm02 = Dead_Band(p2_y);