Okapi - Smooth Movement?

I posted yesterday about moving forward using Okapi Chassis being kind of jerky. We have mitigated that to an extent by modifying the gains (essentially tuning our PID), but it’s still not smooth. Additionally, when we move the drive forwards (chassis->moveDistance(1_ft); ), it lurches forwards rather than smoothly accelerating. Additionally, it abruptly stops, and I don’t think that a PID drive is supposed to. We used the motion from okapi, and it seems it has parameters for maximum jerk, acceleration, that sort of thing. We tried moving with that, and it was extremely smooth. Is there a way to replicate those parameters, i.e. maximum jerk, acceleration, etc. within the Okapi chassis? If not, how could I adjust my PID in order to eliminate the jerk (oscillation I think it’s called). Thanks in advance! For reference, here are our current gains and such-

    >     {0.00034, 0.001, 0}, // Distance controller gains
    >               {0.003, 0.0009, 0.00008}, // Turn controller gains
    >               {0.00038, 0.00080, 0.00008}  // Angle controller gains
1 Like

@pinecone You might pay some attention to this thread.

Hey! I’m actually working on the same thing at the moment, and I’ve ran into a problem where I’m testing moving in a straight line in order to tune my Distance controller gains, and when I try to drive straight for 24 inches, it does not stop moving forward no matter what my P value is(except 0), I’m just curious if you’ve ran into any issues like this as it’s been killing my ability to work on an auton.

1 Like

Ohhhh hey man we also ran into that issue in the beginning. We did two things, and then it seemed to not happen again. First, we found out that the motor gearset (in the motor declaration) was wrong. We were using green motors on the bot but for some reason we had them as red in the code. We fixed that, and then also updated our chassis dimensions, and it never happened again. If neither of those work, then I would recommend perhaps updating Okapilib. You can do this by going to the top panel, and on the right you’ll find a menu saying PROS. Click on this, and then I believe it’s upgrade project. You’ll just need to point it to your project folder and it’ll update everything.


Also regarding the subject, I’d really appreciate some help on this, as we made about a 56 (I think?) point auton in a 1 hour rush the other day but it only ended up getting 26pts today at the competition (it overshot one turn and that threw off the last two towers). Thanks once more!

1 Like

thank you SO MUCH for the response. I’ve spent about 4-5 hours trying to resolve this issue. When you say updating your chassis dimension what do you mean? Like the tracking wheel measurements? I’m kind of desperate at this point for a solution, would you by any chance mind uploading just the chassis builder section of your code, I’d like to be able to compare with somebodies working code.


Chassis width, wheel size, gear ratios.

So sorry, I just saw this (blame finals week) @marvin . Anyhow,
For your chassis size, do the following.
Say you have two wheels on each side. Given that your chassis is symmetrical, get a tape measure or something of that sort and measure the distance from the center of one wheel to the center of another. For me, I did the center of my Right-Front to the center of my Right-Back. This is your Chassis-Track value. Your wheel diameter is just, well, the diameter of the wheel.
Then, you just have to feed the value into the constructor.

Mine for example is as follows;

      std::shared_ptr<OdomChassisController> chassisAuton = ChassisControllerBuilder()
        {1, 12}, //left motors are ports 1 and 12
        {-10, -19}
      )  //right motors are ports 10 and 19 (reversed)

      .withGains( //initializing integrated PID system
          {0.00034, 0.001, 0}, // Distance controller gains
          {0.003, 0.0009, 0.00008}, // Turn controller gains
          {0.00038, 0.00080, 0.00008}  // Angle controller gains (helps drive straight)
      // green gearset, 4 inch wheel diameter, 9.5 inch wheelbase
      .withDimensions(AbstractMotor::gearset::green, {{3.25_in, 9.5_in}, imev5GreenTPR})
      .buildOdometry(); // build an odometry chassis

(ignore the with odometry and build odometry, you don’t need to care about those unless you have an odom chassis)

If you have gearing on your drive then you will just need to specify the gear ratio to the left of the chassis size.

For example,

    // Green gearset, external ratio of (36.0 / 60.0), 4 inch wheel diameter, 11.5 inch wheelbase
    .withDimensions({AbstractMotor::gearset::green, (36.0 / 60.0)}, {{4_in, 11.5_in}, imev5GreenTPR})

Hope that helped! Let me know if you need anything else. Also, my question is still on if anyone knows an answer C: