Ezward / Esp32CameraRover2

EzRover is a framework for building and programming inexpensive differential drive robots. The framework includes closed loop speed control, pose estimation and go to goal behavior. Behaviors can be added in JavaScript. The first hardware instantiation uses an ESP32cam, an L9110S DC Motor Driver and a cheap Robot Car chassis.
MIT License
35 stars 7 forks source link

Speed control is broken on Esp32Cam if ENABLE_CAMERA is not defined #7

Open Ezward opened 3 years ago

Ezward commented 3 years ago

There was a previous commit that create a new preprocessor symbol, ENABLE_CAMERA, that must be defined for the camera support to be fully compiled into the rover's C++ code. By default this is defined in platformio.ini. When it is not defined, the camera api is turned into function that just return failure, exception for getCameraPropertiesJson() which is the method underlying the status/ endpoint. When camera is enabled, it return all the camera properties and an enabled property with value of "true". When camera is disabled, it only returns enabled with value of "false". So that's the context. The bug is that if ENABLE_CAMERA is not defined, then speed control does NOT work. The issue seems to be the interrupts are not firing, so the encoder never counts any ticks. This is likely because the camera internals may turn on interrupts, but if we don't initialize it, they never get turned on.

Ezward commented 3 years ago

I did the experiment where I disabled the camera and used polling for the encoder ticks. If found a bug in the code related t polling and once that was fixed, the code again worked. So we can correctly read the pins, but we are not getting interrupts from the pins. So it does seem to be an interrupt issue.