Hi all,
I switched my sensor to an IR model made for LEGO Mindstorms by mindsensors.com, and I am a little happier with it than the old ultrasonic because it can detect the can at a larger distance even though the value gets less accurate quickly at almost 3 ft.
I’ve made 3 can retrieval recordings of the build with IR on different floors and with different cans and distances to prove it “worked at home.”
Playlist:
https://www.youtube.com/playlist?list=PLmb0WjGtyZZSiwR0p2Xg8zPOj5CM8D4oH
I’ve learned a bit about the profile differences between the two sensors such as the IR is more pinpoint and required slowing down the robot and increasing sample rate to get a good spread of readings. By good spread I mean a series of sequentially retrieved distance values at different sensor angles while rotating past the can that drop down from far hit a min, and then go back up.
Both low off ground (2cm) and high (8cm) mountings were not great and I settled on (5cm) and very slight upward tilt found by live test. I also created a table of real distance vs measured distance and added a formula to correct the output value.
The sonar with its quickly expanding cone loses the can at a shorter distance though it has a softer spread of values than the IR.
Overall, a shiny cylindrical object is a difficult item to spot for both sensors especially at greater distances due to the tiny sliver of can that directly faces back to the sensor.
This was done in RobotC, an old but great environment for advanced programming of Lego NXT, EV3, and VEX robots.
I’ll upload the code to my github under CanDoChallenge.
Thanks,
Jim