Every time I see a PID control for a motor, it involves an Encoder, so the algorithm knows the real position of the motor or wheel. But with the robot I have, I cannot use an encoder. I only have ONE optocoupler per wheel which can count how many degrees the wheel has moved. I can use it to increment a counter, but the counter ALWAYS increment (if the wheel moves forward or if the wheel moves backward).
The first moment I saw it as an inconvenient was when I studied the Arduino PID Autotune Library. In the first figure, I would not see decrements on the INPUT.
My objective is to move a little two-wheels robot small segments driven by simple trajectories separated over time by a complete stop (straight 10 cm, stop, move right 90 degrees, stop, straight until detect obstacle...)
Could you suggest me some kind of ideas? The first idea I have is to transform the PID position control to a speed control (which is more convenient for the feedback loop I have) and keep a counter of the traveled distance to inform the speed control when to stop.