How to make a drone complete still in air (anti drift/glide)

Hi!

I have got my drone working with a PD controller (that Ive made myself) that keeps the desired angle. But now I want to take it to the next step and make it complete still in the air. Does anyone have any good tips on how to make it still? Right now I am testing a PID and a PD model on the accelerometer but it doesnt seem to be any promising.

I have looked a little bit into the DJI Phantom 4 and it uses vision to stabilize, is that something that is possible to do with arduino?

Also I have a GPS that is about to be wired on once I get my PCBs, but is it reliable to use a NEO6m to stabilize? Ive heard that GPS error margin is +- 4m.

I also have a Ultrasonic sensor that I am pretty familiar with, maybe it is possible to use that indorors to make it stable? But outdoors maybe GPS is a must?

Thanks beforehand!
Best regards Max

What is a Hypersonic sensor?

Oops, meant ultrasonic :smiley:

Without knowing anything about the sensor (there are many different kinds), it is impossible to give good advice. Please read the sections about "how to ask a question" in the forum intro threads.

Please explain precisely what you mean by this:

"Not moving at all from a position" is not possible.

I mean for the human eye to not drift away, that if you drop that steering lever (adjusts the desired angle atm) it will stay in that position and not move. If the drone is still on the floor and I add throttle to it it will only move upwards and not horizontaly.

Do you believe that this is a new problem?

No, I am wondering if someone has a smart idea to help me guide the project. This is about innovation, fun and exploring. Please, dont

Not possible. You need to set reasonable limits on the allowed motion. As a start, you could experiment with using GPS outdoors, in order to learn the control techniques.

Absolutely! Innovate, explore, and have fun! Let us know how it goes.

You have to be realistic about the world. Everyone wants a stable drone, probably millions of users out there... do you believe that if someone had a unique, innovative solution, it would not find its way to a product or web site somewhere? Do some actual research.

That’s not the next step, that’s a few big steps.

Your next step is to get angle mode working.

Many flight control systems have angle mode. One approach is a second set of PID loops to use angle as the error and the stick as input.

Or you can use one PID system, all that changes is what you are controlling.

In rate mode, you match the gyro rates of rotation to the stick positions. You claim to have done this.

In angle (aka stabilised) mode, use the accelerometer and match the angles of pitch and roll to the stick positions. Drive to eliminate error with PID on those inputs and outputs.

Betaflight and Silverware are open source; a bit of digging will turn up the control loops, very easy to see in Silverware at least.

Station keeping is much harder and will inevitable mean using some means of sensing your position. Optical or GPS or whatever.

The IMU cannot be used effectively to maintain Earthly position. So you’ll need an additional something.

First get stable angle mode control working. You’ll have to anyway, so do. Then you can circle back to staying in one place and altitude.

Or not. Staying in one place is no fun. :expressionless:

a7

2 Likes

Thanks for your response! I got Acro working but the problem is that I am a very bad pilot so when I tried to fly it it was like having a marble on a plate and try to keep it in the middle with a very bad joystick (I ordered the new ones but they havent arrived yet :slight_smile: ). So I went back to auto level mode for now.

I see. I have not kept track of your progress. I did not realise you have already programmed the auto level (angle) mode.

I have not used angle mode except in emergency circumstances. I now find it harder to fly angle mode, and of course angle mode severely limits the "flight envelope".

In about 2/3 my aircraft the accelerometer is disabled entirely.

Please plan to fly a camera with the ability to end up with video you can show. Off. There are some low-quality parts you can put together to record entirely nice enough video.

I fly a < 4 gram 3.7 volt camera and transmitter and receive it with a combo video receiver / DVR.

a7

1 Like

Absolutly! The plan is to mount a GoPro and take some awesome photos/videos!

Well the GoPro is a nice idea for awesome stuff but I am thinking more along this line:

which also does not transmit, but is way cheaper for when you still haven’t figured out the software and/or how to fly… you should probably plan on some crashes.

For fun but also for diagnostic purposes. It is possible to observe from the ground and tune a quadcopter control system, but flight footage from on board makes some flaws easier to see, understand and correct.

In tuning or flying…

a7

1 Like

Hi @lordmax2

Congratualations on getting your drone flying! :smiley:

To implement position hold (aka loiter mode), you'll require a magnetometer and GPS, (in addition to a gyroscope and accelerometer).

The magnetometer is used to generate your aircraft's heading with respect to north, but it needs to be calibrated and also tilt compensated to account for the pitch and roll angles of the drone itself.

I'd suggest using UBlox NEO6M GPS's proprietry UBX protocol, since this allows you to obtain the longitude and latitude values from a fixed length data structure. This is much more efficient than parsing NMEA strings. Here's a Youtube tutorial on how to do this: https://www.youtube.com/watch?v=TwhCX0c8Xe0.

In position hold mode, you take a snapshot of longitude and latitude of your desired position. This becomes your stake in the ground. The longitude and latitude of the aircraft's current position is then used to calculate the distance (say in metres) and bearing (in degrees/radians with respect to north) from this desired position. This can be calculated using fancy formuli such as the Haversine, but over such tiny distances it's far easier, as well as computationally less expensive to assume that the Earth is flat and use equirectangular approximation instead. Equirectanglar approximation is just another name for using the Pythagorus' Theorem to calculate the distance (hypotenuse) between two points: http://www.movable-type.co.uk/scripts/latlong.html.

From a control systems point of view the magnetometer can be used keep your aircraft's yaw heading locked in position, but also allows you to calculate the difference between drone's current heading and bearing required to bring it back to the desired position. This difference, in conjuction with the distance can be used to drive outer GPS roll and pitch PD control loops that in turn drive the inner PID loops used to control the aircraft's angle. Usually these outer PD control loops' "setpoints" are set to 0, because the distance of the aircraft from the desired positon should be exactly that, zero. The control loop "inputs" being the roll and pitch distance. The outer control loops' "D" term is also required, since it will give the drone a little kick in the right direction, if it's blown off course by wind.

Essentially you're locking the yaw angle and replacing the pilot's roll and pitch angle stick commands with values derived from the GPS instead.

1 Like

Thank you!
I am using a BNO055 9-dof and right now I am using the same PD controller to controll the yaw position as roll and pitch. I also have a NEO6m GPS module witch Ive been using a little bit. I have ordered some new PCBs that should arrive this week to get everything nice and fasten. I will keep you updated once I get this model up and running :slight_smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.