This is very slow going: Every single feature is a problem and needs to be solved with a great effort.
However there is progress. :-)
In the last three weeks:
- I changed the board (3 times). This time with self-made boards (in a maker space). The current version uses a smaller ESP32 board which is moved away from the camera. And there is no ground plane anymore.
- Changed the motors back to smaller ones but this time with encoders.
- Changed the wheels (and chassis) to a slimmer one. The tires I use are spare portafilter parts - and the rims printed to fit them.
- Motor control with the help of the encoder input is now done with a PID controller.
- How do interrupts work with the ESP32? Fairly ok (simple examples work). But take care of the connectivity: Changes in the connection quality ie of fly wires generate lots of interrupts. Also take care on accessing the counter variable. Using them directly for "Serial.print" shows lots of garbage and/or crashes.
- How do encoders work: ie what number of ticks per revolution? Mine do not seem to conform to the "spec". Consider the motor reduction correctly.
- PID: Understand, reverse engineer and fix the pid library (https://github.com/br3ttb/Arduino-PID-Library/) to make it fit for use with motor control. E.g. with the current version errors do not dissipate when the motor is stopped thus pid output is continually != 0 but the motor does not turn (too weak for small values) and it should be stopped anyway.
- The camera problem seems to be much improved with the distance between it and the ESP32: Much less dropped packets. But the general WiFi reception seems to be even worse than before: 3 meters open line seems to be the maximum for the current design.
- The current PID control cannot correct small errors. Thus a "straight ahead" has still a small drift to the right now.
- Even with the encoders the motor control is still difficult: PWM values do not correspond linearly to speed with these motors. And there is a large gap at the low values where the motor simply does not turn.
- The tires are insufficient: much too sleek. Combined with the motor weakness they often spin freely. A simple rug is testing this to the limits. And small obstacles cannot be be surpassed.
Next stop: Try stepper motors.
Problem: Normally these are big or very big and most require much more current power.