What is range_finder_g.distance(MM) value if it doesn't detect an object?

I understand that range_finder_g.value() returns -1 if the rangefinder doesn’t find an object, but I would like to know what range_finder_g.distance(MM) returns in the same situation.

Thanks,
Randall

Sounds like a simple and good experiment to try out and document in your engineering notebook!

5 Likes

hahaha correct! ok I’m on it

ok this is first year I’m teaching Robotics and so I appreciate the hint at a best-practices-teaching-tip! I assume then that you have your students, as they come across a problem (that you decline to answer for them–for me that would be: “I don’t know, now stop bothering me, I need to get back to my own attempts”), conduct experiments of coding of their own design, and record ALL results, which will all be “failures” except for the final experiment. I love it

2 Likes

While I didn’t realize you were also a mentor/coach. Nearly always the best way to learn is to do. There may need to be some concepts given along the way. For example, I might suggest to the student that writing a simple program that outputs the values of the 2 different calls would be good. Perhaps the student doesn’t know how to display values to the screen/terminal/controller which could lead to some instruction or additional research on the student’s part. Such a program could then be easily changed when the student then asks “What color does the optical sensor return when shown a mirror?” or some other hilarious edge-case.

3 Likes

As a student this is also a good thing to remember. In my first year or robotics I was able to learn this “if you have a question that you can experiment and solve on your own, do it”. By finding the solution it helps you understand the robot and when you document it in your notebook it shows the judges that you aren’t handed an answer, you work for it. This has helped me greatly in my last 4 years in robotics. And continues to help me this year.
Although of course if you can’t figure it out, ask your mentor for some help.

(Your mentors also will be more willing to help you if you have already tried to find the answer)

4 Likes