I have a differential drive robot custom odometry and pid bad working

i use my own odometry and when i connect the pid to drive by coordinates it goes fine only for x if you connect y then it just goes forward
my code

I haven’t looked at everything, but here are two things that leap out at me:

  • In the definition of rightLenV and leftLenV, you don’t include any gear ratio, and you seem to be forgetting a factor of 2 (c=2 * pi * r).

  • You use the value of the member variable theta, which is only set in getTheta, which is never called.

Get theta called on commands. rightLenV and leftLenV use this formula Encoders — Studica Robotics 1.0.0 documentation

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.