Encoders with Arm?

I don’t know how many other teams are having this issue, but our arm is currently lifting extremely crooked. We have a 7:1 ratio for the arm and driving each side of it off of 3 motors. The gear train goes 12:36:12:84:12. Motors are attached on the all of the 12 tooth pinion gears, and the arm is attached to the 84 tooth gear and a shaft without a motor. We are currently trying to use integrated encoders on our final output gear. Our program is calculating the ticks every 50 milliseconds and adds or subtracts 1 for every five that it is off. If anyone has a solution, or any suggestions, that would be great. Any help would be appreciated.

have a shaft that connects the two sets of motors like this

A picture of the gearbox may help.

  1. Make sure there’s no extra friction in the gear box.
  2. Make sure all your motors are geared the same.
    3.make sure if you have spacers going all the way across each axle that you aren’t forcing extra spacers inside the towers.

Listening to the way you have coded stabilization for your lift seems a bit rudimentary. Some PID will definitely help. There are already a lot of resources online for PID, but here’s some basic stuff:


task stabilizeLift(){
     while(true){
          float kp = 1; //proportional
          float ki = 1; //integral
          float kd = 1; //derivative
          //1 is a placeholder. Tune these values until it doesn't oscillate

          float integral;
          int lastError;
          float derivative;
          //Some variables needed later

          int error = SensorValue(encoderLeft) - SensorValue(encoderRight);
          //Simple error calculation

          integral += error;
          //As in calculus the integral is the summation of the error; this increases how fast you correct
          derivative = error - lastError;
          //Rate of change of the error; reduces oscillation
          

          power = kp*error + ki*integral + kd*derivative;

          motor[left] = 100 - power;
          motor[right] = 100 + power;
          
     wait1msec(15);
     }
}

@mwang17
I had actually just started to look into some PID stuff, I was just looking for some options. For a project last year, I used that same basis of a code to make sure the robot was driving straight and for a certain distance, but PID looks a lot more accurate, thank you

You might not need full PID. Pretty often just a P loop will work fine. PID is definitely more reliable though – it’s just harder to tune properly.