Using Sensors With Ardupilot Help

Hello Ardupilot People,
I have built many quadcopters before, but this is my first time using autonomous flight. I understand how using mission planner would normal work where you select gps points and the quad flies to them. But what I’m trying to do is put a moisture sensor on my quad, have it scan an area that I tell it to fly to, and then have it land once it gets a high sensor reading. I can’t seem to figure out how to make it alter it’s course or land somewhere based on input from a sensor. I want it to be able to make the decision to land autonomously. Any help is greatly appreciated.

Can you detail the use case?
Can you use GPS
What is the size of aera : centimeter, meter, kilometer
Type of sensor , sensing distance and accuracy

I can set a quad copter to detect a bathub filled with water on a football field , is this what you intend to do, or that is different?

I want to use an exterior thermal sensor to detect water. Not sure about the accuracy of the sensor but the sensing distance will be not too high, probably around 10 or 20 feet. The area will be a bit smaller than a football field. And yes, I can use GPS. The bathtub thing you mentioned is almost exactly what I intend to do. Hope that helps clear things up. If not let me know.

In that case ,if you plan on using thermal detection for differentiating a body of water against a thermally contrasting background, you could easily setup an inexpensive FLIR infrared camera on the drone and have it controlled by companion computer.

Then you setup a search pattern with mission planner, and do a conditional landing on thermal trigger using dronekit

Here is an example of this setup, using a simple camera system and detecting a Red Ballon
QuadCopter Object Tracking on a budget

Ok and is it possible to do that with an APM 2.8 or does it have to be a pixracer? And Thank you so much sir that really helped a lot!

@Nick You need the latest features in order to get it working , so a PixRacer or PixHawk with a quadcopter 3.5 or more recent.

Glad to help, and if you like, just hit the like button :wink:

1 Like

@ppoirier those articles are great but I’m still slightly confused about one thing. I’ve read that Mavlink is a communication protocol between the vehicle and ground station, but from what i can see, mission planner by itself would work fine as a ground station. Would Mavlink required for my project, or would it work without it?

Mavlink is the communication protocol for Ardupilot, this is how Mission Planner upload mission to the Flight Controller and this is how the companion computer initiate landing using the Drone Kit (that is basically a scripting language for Mavlink).

You will need to invest time and dedication in order to make it work. The first step is to master simulator -SITL - and then control the simulated quad using a companion computer and dronekit, Once you master these concepts, you will be ready to implement the Thermal Imaging camera on the Companion Computer in order to trigger the landing.

I suggest that you look at @fnoop excellent vision landing for more explanations:
He is presently working on getting it optimized for a Raspberry PI 3

1 Like

@ppoirier That makes a lot of sense. I’ve ordered most of the parts and am waiting for them to ship. Thanks again for your help, you’re a life saver. Just wondering, what might a general overview of the code for triggering the landing look like?

It is exactly lik I wrote above:

You setup a search pattern with mission planner, and start this mission using Mission Planner control Panel, or swiching to AUTO using your xmitter.

Then the CC runs the color detection script and initiate a conditional landing on thermal trigger using dronekit

All this can be simulated on SITL, and I higly recommand you do it on simulator prior to try it on the field, just to make sure you control the system perfectly

You can go on this forum to get some more information on the DroneKit:

Good Luck !!

Hey @ppoirier,
It’s been a while, but I’m ready to start testing in SITL. I was reading about how you had set it up in that red balloon example, and I noticed you used a Linux computer. I only have a windows computer, but is it possible to use that for SITL? Or does it have to be a Linux. Thanks.

Hello Nick,

I think you can use it within Mission Planner, but you need a companion computer (RPI or other) anyway to make the python scripting work