Hi, I am trying to run the Intelligent Object Avoidance code but is is not working right, the robot will hit a wall then it will stop moving, and the dervo will keep turning right and left
any suggestion how to fix that?
*I tested the sensor through easy_distance_sensor.py
and it seems to be working correctly
Can you tell us if you use Python 3? It should be run with Python 3 and not the 2.
From your explanation it seems like the robot keeps on moving forward even though it has hit something, while the servo keeps on rotating as if nothing was detected with the distance sensor.
Also, do you have your distance sensor connected to the
Yes i used Python3 and yes the sensor are connected to I2C.
Does is matter which I2C ? I have two of them
Yeah the robot will keep moving even if it hit an obstacle. I also said
I tested the sensor through easy_distance_sensor.py
and it seems to be working correctly it shows me values of how far obstacles are from the sensor
Well then, I think I also have to test it. I’m adding the pending label to this thread for organizational purposes.
I’ll be back with an answer as soon as I can get my hands on it.
No, it doesn’t matter which I2C port you choose, it’s the same.
Thanks for doing that, i am waiting for your reply, and i will try to debug the code to check where the problem is.
I’ve been playing with this project for a while already and it seems like it does not work as it should be - so you were right.
I’m investigating whether this was caused by an update brought to the library or if there is a more hidden issue that didn’t appear when it had been initially programmed.
Either way, I’ll be back with a bug-fix for it.
The fix on this project is awaiting an approval from one of our team members. You’re free to test the proposed solution on GitHub:
Once we get it approved, you’ll be able to pull in the new changes on your Pi.
Thanks for doing that, i will try to test it now. i am just trying to test the proposed solution.
Ok, I tested the code, its way better than before. But i noticed 2 problems, tell me if you have the same
The first is sometimes the robot will turn even though there is nothing in front of it or even right or left. Which kind made the robot goes in loop of 4x4 meter.
The second is that the after running it for a while, it started to hit a wall and kept moving!
I haven’t encountered these 2 issues yet - and I’ve “played” with the robot for hours around the house.
The algorithm takes measurements with the distance sensor of it’s surroundings on a 120 degrees window - the total number of measurements is 12 (one at each 10 degrees increments). Then with an unsupervised algorithm (K-Means) it detects the direction to which the distance to a given object is the highest. This makes me wonder if it’s the shape of room that makes it behave this way you described.
Regarding the 2nd issue, while I haven’t encountered it yet, I speculate it’s caused by a timing issue.
In the next few days, when I’ll get some time on my hands, I’ll try to see if there’s an actual timing issue and I’ll also add some verbosity to the output in order for you to get more insight of what it happens. When I’m done with these changes, I’ll let you know here.