Calculating Distance With Vision Sensor

I was wondering if anyone knew how to calculate the distance of an object using a vision sensor. Code in either Vex Coding Studio or VEXcode will be helpful. I have heard that you can calculate the distance of an object only if the sensor is angled downwards and I was also wondering if that is true. Any help is appreciated.

check this thread

2 Likes

If you wanted to calculate solely the distance from the robot to an object using the ultrasonic sensor would be better. The Ultrasonic sensor measures solely distance, and can measure up to 255 CM, from all the Ultrasonic sensors I’ve seen:

2 Likes

Ok thanks. Could you provide a website or a piece of code that finds the distance of an object using an ultrasonic sensor in VEXcode?

Here is the API documentation for it: https://api.vexcode.cloud/v5/html/classvex_1_1sonar.html

4 Likes

Do you have vexcode downloaded, it should have built in examples of how to use the Ultrasonic sensor.

1 Like

I do have it downloaded. I just figured out that once you add the device, the items in the Command Reference show up. Thank you very much!

1 Like