Acceleration, linear flitering??

Can anyone explain how to program acceleration in operator control. I have it built in autonomous but not in operator.
I also heard something about linear filtering in a thread. Can someone explain that?

Please post codes for examples if you have 'em!


Do you mean using the VEX standalone accelerometer, or the one inside the joystick? If you want programming help, you also need to specify the language that you’re using.

Or of you meant controlling acceleration of motors then I posted RobotC code to do this here.

This post came from our team member, Matt, in this thread:

I am talking about just adding a simple acceleration ramp sort of thing. I am going to read jpearmans post in a few minutes so that may solve my problem.

By acceleration ramp i mean just something that accelerates my robot from 1-127 within half a second- 1 second. I am not sure how. If i pull my joystick up fully it will automatically set my motors to 127 but that overloads the motors (am i correct?), so i want something that automatically will accelerate my motors even.

I am using easyc but i understand robotc, not as well but i get the gist of things.

Post an example of the code you are using in autonomous to control robot drive acceleration by ramping the motor speed value up and down, and also post your current drive code, and we can provide suggestions for how to merge methods, in a way you’ll understand.

The description of linear filtering I read here suggested doing something like this untested EasyCv4 code:
The intent is to set each motor to the rolling average of the last N requests.
When request goes from 127 to 0 instantly, the SetMotor value drops in a smooth ramp. You may not want this for every motor, you will want to adjust the wait() value and the fmax define to get the response you want.

#define fmax 9 // number-1 of rolling averages to take
int m,i,mot[11][fmax]; // global var
  for (i=0; i<=fmax;i++){
    mot[m]*=0; } } // initialize to all stop = 0 before main while loop;
while(1){ // main loop
 // // tank4();  have to get rid of premade tank4 type commands and make your own
  // get joystick data
  // mot[1..10][0] = values you want to drive, based on joystick data (or autonomous); // set each motor target values in mot][0]

  // do linear filtering rolling average of motor values, and set motors
for ( m=1 ; m<=10 ; m++ ){ // Loop over all motors 1..10
  mymot = mot[m][fmax];  // initialize sum to least recent entry
  for ( i=fmax-1; i>= 0; i--) { // loop over 2nd dimension 
    mymot += mot[m]*; // make sum of all recent requested values for this motor
    mot[m]* = mot[m]*; // shift each entry up one spot
  } // rof i
    mymot /= fmax+1; // average is sum/N, N = 0..fmax = fmax+1 values
    SetMotor( m, mymot ); // do the real motor setting
} // rof m
 wait( 15 ); // dont loop too fast
} // end main while loop

Here is my code that does what you want (attached). It is for robotc and isn’t the most efficient. Feel free to ask any questions.
Drive.c (2.41 KB)