I am trying to do that but don't know how to link that to the
pixhawk to do an alt hold or to change sense or path of motion.
To retrieve a distance from the sensor, you trigger the sensor with a
HIGH PULSE, but
before that you want to precede that with a LOW PULSE so you would be
starting clean, with HIGH PULSE,
so like 1- LOW PULSE delay(2);
2- HIGH PULSE delay(5);
3- LOW PULSE delay(5);
then using the same pin you read the signal which is a high pulse whose
duration is the time in microseconds from sending
the ping to receiving its echo from the object you are measuring. You
divide by two because the ping traveled to the object
and it's echo traveled back again. to convert to inches you divide by
74, to convert to cm you divide by 29
so its like this
inches = duration/2/74, Note this might be different for your sensor
check your data sheet for the conversion factor,sensitivity to
temp and its effect on speed of sound.
cm = duration/2/29;
so this gives you distance from the object to the sensor.
Now you have four sensors,
Sensor_1 determines if there is enough clearance in front
Sensor_2 determines if there is enough clearance in bottom
Sensor_3 determines if there is enough clearance in Right Side
Sensor_4 determines if there is enough clearance in Left side
except if you are using all sensors as redundant sensors, that is like a
or to compare if the readings are correct. Does it make sense to you?
My question to you is how do you incorporate this into pixhawk, I dont
know yet its lingo.