Additional Sonar

I’m hoping someone might be willing to help me a bit.

I want to add four extra sonar sensors to a quad to assist with collision avoidance. We’ll be using a small quad indoors for some inspection work and I would like to attempt to use sonar to create a minimum distance around the quad which if breached will see a controlled influence on the pitch/roll commands to back it off from the wall or to block any further control inputs that would reduce the distance. We’re talking about a 1-2metre distance from Boiler Tubes.

To save me a lot of work I wouldn’t mind if anyone here who knows their way round the code would perhaps list where I need create extra code and variables to add in the extra sensors. The ability just to read a value from the extra four sensors would make start.

I program PLC’s for a living so I’m coming from that background. I’ve just loaded up the Editor as explained in the wiki and I’m at the stage where I can compile the latest code and upload to the APM. I’m here hoping that someone can save me a bit of work picking through the code.

For anyone interested, we will be using Multicopters to inspect the inside of Gas Turbine HRSG Transition ducting. I’m interested in using APM or Pixhawk as I have that working on one of my own Quads, and since the software is open source it makes it easy to tweak for our use.

Cheers

Mike

by using ultrasound, you will get echoes and problems, unless you have a very slow ping rate.
I’d suggest you should go for led/laser based distance sensors.

[quote=“Andre-K”]by using ultrasound, you will get echoes and problems, unless you have a very slow ping rate.
I’d suggest you should go for led/laser based distance sensors.[/quote]

We’re going with the Sonar approach and whatever filtering we need to use. Too many holes for a laser to vanish into I’m afraid. Both have their issues, we’ll be going with Sonar in the first case.

What I’m looking for is where exactly in the code do I have to visit to add in an extra sensor.

OK, you’ll need to fire ping front, left, up, rear, right, down, with delay between (not all at once) no extra filtering should be needed.
I believe you want to input your avoidance data to the spot where optical flow meter injects input.

[quote=“Andre-K”]OK, you’ll need to fire ping front, left, up, rear, right, down, with delay between (not all at once) no extra filtering should be needed.
I believe you want to input your avoidance data to the spot where optical flow meter injects input.[/quote]

I notice that on the MAXBOTIX website there is a tutorial showing a method of chaining sensors so that they fire in sequence without the need for requiring an external triggering source.

Quote from the website ’ The next method is AN Output Constantly Looping. The first sensor will range, then trigger the next sensor to range and so on for all the sensor in the array. Once the last sensor has ranged, it will trigger the first sensor in the array to range again and will continue this loop indefinitely.

So what I need now is an understanding of how I create the additional 5 analogue inputs on the APM. There will be the way that I would configure them, and then there will be an approved method that fits in with how the code has been developed. Any pointers would be appreciated.

This user was playing with just that: you may ask him how it went: diydrones.com/profile/JonasV
I’d use another microcontroller, that controller should then do sanity check on that data too, to offload APM, ,and act as a I2C slave that APM can read.