Open-STEM / XRP_MicroPython

The main programming tool for use with your Experiential Robotics Platform (XRP) Robots!
https://open-stem.github.io/XRP_MicroPython/
12 stars 2 forks source link

Random Ultrasonic Spikes #18

Closed milespearlman closed 1 year ago

milespearlman commented 1 year ago

When the robot was about 30cm away from an object and the ultrasonic was overall reading accurately, the sensor will randomly spike for about 3 cycles, usually + or - about 20cm but sometimes even more.

image

image

milespearlman commented 1 year ago

Note that this occurred only when the motors were on.

ksiegall commented 1 year ago

Wait this only happens when the motors are on? can you try to reproduce this bug now that I've fixed some of the issues associated with the encoders?

Edit: bug is easily reproduceable and definitely still happens without the motors on, and without interference from the encoders

ksiegall commented 1 year ago

Ok so I've reverted an older change to the rangefinder code to remove the source of this error. The trade off is that the rangefinder code is now back to being blocking, which means that it interrupts the flow of the program for potentially up to 30ms (which should basically never be that extreme). This isn't a permanent solution but it does make the code functional until the other implementation has been fixed.