View Single Post
  #5   Spotlight this post!  
Unread 14-02-2007, 21:27
oddjob oddjob is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Earth
Posts: 118
oddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to behold
Re: Moderating Acceleration / Deceleration

A simple filter is one line of code. Here is a version that works with integer math:

Code:
  out = (((n-1)*out)+in)/n;
in = the input to the filter e.g. PWM value as commanded by the joystick code.
out = the filtered quantity e.g. PWM value to the wheel.
n sets the filter bandwidth. Higher values, lower bandwidth. Experiment!

Preserve the value of 'out' (make it global or static). Use separate variables for each wheel. That should get you started.