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
rightLenVandleftLenV, 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 ingetTheta, which is never called.
Get theta called on commands. rightLenV and leftLenV use this formula Encoders — Studica Robotics 1.0.0 documentation