Ultrasonic Range Finders

Hi, I have been looking into the use of ultrasonic range finders for autonomous on my robot this year, I would like to know how helpful they could be and also I am looking for a psuedo code to help me understand how to use these sensors.

By using the Search Function of the Forum, there is a plethora of Threads on using the Ultrasonic Sensors… I will chase a few down for you…

In the mean time, have a look at this Video from DSRobotics:
VEX Omni-Directional Avoider HD

It really depends on what you are trying to use them for. They can be very helpful if you want to do error-correcting in an autonomous routine (like line trackers), as encoders on the drive only give you relative location changes. We used them in Gateway when we had a vertical intake so that we knew when an object was in the right place to lower the arm and run the intake.

This year, you could use one to tell you how far from the wall you are, and consequently how close to the trough you are.

Here’s our function that checks to see if an object is in the right spot to be intaked.

bool ultra_range() {
  if(SensorValue(ultra) <= ULTRA_MAX)
    return true;
  else
    return false;
}

DSRobots code for the Autonomous Ultrasonic Avoided is located here: Quad/Four Ultrasonic Sensors & 4x Omni-Direction Wheels

I like using the Advanced Search, located under the Search on the Quick Link Bar ( or whatever VBulletin calls it )… The following links are done with an Advanced Search, where I was looking for Threads, older than a year, with the word “Ultrasonic” in it. ( I also include posts with my User Name, since I have posted quite a few times about the Ultrasonic Sensors, and it reduced the number of matches )

Some refer specifically to the Vex PIC Controller with MPLAB and MCC18 Compiler, some refer to EasyC for PIC or Cortex.

A few will give you some good background Info…

Trying to use two Ultrasonic Sensors

Ultrasonic Sensor Hard Code Help

Problem With Ultrasonic Sensor Coding

This Thread has a lot of links to other Threads in Post #3:
Need Assistance- Ultrasonic sensor

Also, look at the Sample Code included with EasyC and RobotC, or if you are using the VEX PIC Controller with MPLAB and the MCC18 Compiler, look at the Sample Code in the VEX Sensor Test located on the MPLAB Software Downloads page.