The ABC Steps of Autonomous Flight on Multicopters
« on: July 08, 2015, 09:53:40 pm »
This will document all the steps I go through to get a good quadcopter flying in GPS modes.  There is also a lot of information that will help you get a quadcopter flying without GPS.

Know the basics of how it works so you can figure out your problems
- Start out with a multicopter that flies well in Attitude mode before adding GPS and autonomous flight
- GPS tells you where you are
- Mag sensor for direction is extremely important
- Baro helps keep altitude accurately since GPS is not good enough at that

Know your hardware.  You don't want it to just fly away do you?
- RC limitations (distance, conditions for reduced distance)
- RC failsafe
- FC failsafe
- GPS almanac download, min time to good fix, drift with change in sat coverage
- GPS limitations like being in / beside a forest or building
- Mag sensor issues with high power wiring
- Baro sensor issues (cover with open cell foam, cotton, tissue paper, etc.)
- Telemetry is handy to have for several reasons (mag calibration, settings, waypoint flight plan loading, ...)
- A way to get an extra position on your flight mode switch

Know your firmware/software.
- Mag sensor failure fallback
- Causes of failsafe
- GPS and mags must be green in Health Gadget
- How to determine when it is safe to arm (with and without a GCS)
- Return To Base (with Land)
- Ripping maps for use at a flying field without an internet connection.

Know what components can have temporary failures (besides simple hardware failure)
- GPS loss of fix, drift caused by change in satellite coverage (e.g. next to a building)
- Mag sensor issues
- Vibration induced gyro issues
- Vibration induced connection failure
- Flight battery power required to run anything powered by a (main/flexi) port

How to avoid the common failures
- FC failsafe stops the motors by default, but you can change that
- Crash into people, pets, or property
- Fly away causes (RC failsafe hold last stick positions forever, RC failsafe set wrong, mags in GPS guided flight modes, FC failsafe misconfigured)
- Install a lost model beeper
- RC Tx - Rx signal strength and directional antenna to find lost model
- Loss in an unrecoverable area (e.g. the ocean)
- Salt water is bad, fresh water not so bad
- Props breaking in the air
- Tall landing gear cause tip overs on landing
- VtolPathFollowerSettings.ThrustLimits

Steps
- Get multicopter flying well in Attitude mode
- Internal or external mag
- Motor wiring to reduce mag interference
- FC setup, GPS at 57600 and external mags
- Calibration, including mag calibration
- Do initial testing in Velocity Roam mode (and get your significant other to fly it in this mode!)
- Clicking up a waypoint flight plan
- Common modifications to the flight plan
- Uploading the flight plan to the copter
- Pick up the copter and rotate it in all 3 dimensions just before arm and takeoff
- Test in Velocity Roam mode before switching to Path Planner (waypoint) mode
« Last Edit: November 05, 2015, 09:45:54 pm by TheOtherCliff »

The ABC Steps of Autonomous Flight on Multicopters - Multicopter Basics
« Reply #1 on: July 08, 2015, 10:19:54 pm »
Background:  Multicopter Basics



https://en.wikipedia.org/wiki/File:Yaw_Axis_Corrected.svg

With a multicopter, the roll and pitch controls are accomplished by making the motors on one side run faster and the other side slower.

Design Of The Basic Quadcopter

A quadcopter is made with 4 motors as an X or +, one at the end of each line (arm).  The X format is more common than the + because it lends itself to having a camera mounted in front (between the motors).  Each motor has a twisting force (torque).  Imagine mounting a motor on a stick fuselage without any wing or tail.  As soon as the motor spins the prop, the stick fuselage spins in the opposite direction.  From this, you can see that if you have all the motors on the quadcopter spinning in the same direction, the quadcopter itself would spin in the opposite direction.  So what is done is to have 2 motors spinning in one direction and two spinning in the other direction.  This idea can be extended to any air vehicle with an even number of motors.  The Osprey has 2 motors (plus some additional controls); you can make a hexacopter (6), an octocopter ( 8 ), etc.  For larger numbers of motors, they should all be equally spaced on a circle.

Using compass directions to describe it, the NW and SE motors spin in the same direction, and the other two (NE and SW) motors spin the other way.  With this, to roll left you increase the motors on the right side (and decrease the left); since the two right side motors are spinning in opposite directions, there is no yaw effect.  Since you increase one pair and decrease the other pair, there is no thrust change.  Pitch is the same way, but front and rear.  To bank diagonally, e.g. forward left, you increase the right rear motor and decrease the left front motor.  These both cause yaw torque in the same direction, but you are increasing one and decreasing the other, so the result is no change in yaw.  To rotate in yaw, e.g. you increase both the NW and SE (diagonally opposite) motors, but decrease the other two and there is only a yaw effect.  It is even possible to design a multicopter that is not symmetric as long as you can code an equation that adjusts motor speed to have only roll and only pitch and only yaw and only thrust effects.


Design Of The Basic Tricopter

A tricopter is made with 3 motors as a T or a Y.  Because there are 3 motors, the best you can do to balance the twist (torque) of the motors is to run two CW and one CCW (or vice versa).  There will always be a "net yaw torque" spinning motion.  Furthermore, you can't spin two motors faster and one motor slower to induce a yaw because that will also cause a bank (imagine any two motors spinning and the other stopped, it would flip over).  For these reasons, the tricopter is made with the tail motor mounted on a pivot so it can move left or right to cause the yaw.  You should also note that the tail motor is slightly tilted to one side.  So if you wanted to save money by building a tricopter, be aware that you need a good strong servo that the quadcopter does not need.


Rate Mode (A Flight Mode) Can Be Done With Only Gyros

You can imagine a simple quadcopter with no brains that has only a set of mixers.  In fact it is quite possible to build one using several "V tail mixers".  The problem is that it is very difficult for a human to fly it.  If you hold a little bit of roll stick on the transmitter, it rolls faster and faster.  The most basic flight mode in the most basic multicopter flight controller (gyros only) is called Rate mode in LibrePilot terminology.  It uses gyros to sense the roll rate.  You configure the max roll rate you want, and if you hold half stick it knows to give you half of that roll rate.  If you release the transmitter stick the aircraft will stay at whatever bank angle it was when you centered the sticks because you have suddenly commanded the roll rate to be zero.  This is immensely easier to fly than without gyros at all, but it is difficult for beginners.

If the FC (Flight Controller) sees that multicopter is rolling too slowly for the given transmitter stick position, it increases the difference in motor thrust.  If too fast, it decreases it.  If you suddenly bang the stick all the way over and hold it, a careful ear can hear the motors spin faster (well one pair is faster and the other pair slower), but then slow down, once it is up to max roll rate.

Gyro sensors do not detect linear acceleration (e.g. gravity or centrifugal force) at all, so as far as the gyros are concerned, you can put the FC out on the end of a very long stiff rod, and it would work exactly the same.  Real gyro sensors do have problems with vibration though.  That is the biggest reason that you need to balance your props carefully.


Add Accelerometers For Attitude Mode (GPS Flight Uses Attitude Mode)

The next sensor to be added to the simple flight controller is the accelerometer.  Accelerometers do not detect rotations at all.  They just detect linear acceleration (e.g. gravity or centrifugal force).  Accels are used to determine the direction of "down".  That isn't as easy as it would seem.  A 10 gram weight on a scale with the scale inside a bucket shows 10 grams.  It is easy to swing the bucket in a vertical circle so that is shows 30 grams (10 + 20 of centrifugal force) at the bottom and 10 grams (-10 + 20 of centrifugal force) when upside down at the top.  Without some careful calculations, that 10 grams at the top would be misunderstood as being the direction of "down".  With some smart code, the addition of accels to the gyro info we already have will tell us which way down is.

Once we know what direction down is, we add a new flight mode that is much better for beginners.  It is called Attitude mode.  Where in Rate mode, the transmitter stick position dictates the roll rate, in Attitude mode, the stick position dictates the aircraft attitude (bank angle).  Release the transmitter sticks to zero and the aircraft comes back to zero bank angle.

GPS flight modes use Attitude mode.  FYI, they also use Cruise Control sub-mode.  This means that the GPS flight mode code doesn't have to worry about a lot of things, staying right side up, adding power to maintain altitude when adding bank angle...  Think of the GPS modes as if they were a pilot who is really good at staying where the GPS tells him, but only knows how to fly the beginner friendly Attitude mode.  For this reason, the GPS flight modes will not work if Attitude mode doesn't work.  Get Attitude mode working well before adding any GPS modes.


Tuning (PIDs)

Imagine if the FC is configured incorrectly, and when you give it half stick for a left bank, the motors only change a tiny amount.  Imagine the other side of this problem where a very tiny stick motion causes a large change in the motors, which causes the copter bank angle to rotate too fast and the FC to change the motors even more in the other direction, (repeat).  You get run away oscillation from this second case.  What is being discussed here is the tuning of the motor response to a given change in the transmitter stick position.  You should be aware of several things about that.  The first is that the code uses what is called a PID controller https://en.wikipedia.org/wiki/PID_controller.  The second is that the default PID settings work well enough to allow you to fly almost any multicopter.  The third is that tuning PID's will be discussed elsewhere.  That said, a correctly set up multicopter flying in Attitude mode should be easy to fly and do what you expect.  You should see that the bank angle immediately responds to your command.  The hardest part initially will be maintaining the altitude you want.  While I am at it, I should say that as a beginner, you should always hover the copter with the tail pointing towards you and nose away (called "tail in").  When the nose is pointed towards you, everything is backwards, e.g. left is right and forward stick makes it fly towards you.


Additional Sensors And Things Needed For Best GPS Flight Modes In Multicopters

GPS (Position)

GPS (Global Positioning System) gives you a fairly accurate position on the Earth or above it to certain specified limits.  The limits are 60000 feet (18km) and 1000 knots (514 meters per second).  That is plenty enough for us.  The FAA (USA aircraft flight organization) has done tests that show that their expensive GPS's are accurate to about 3.5 meters in real world tests.  That means that day to day, a post in the ground will only show about a 3.5m difference in location.  That means that if you click up a GPS waypoint flight in the GCS, that you had better allow for more than 3.5m on either side horizontally.  Vertical accuracy is much worse than that.  Some days and some setups are better than others, but I have found that your altitude should be at least 8m above the ground to consistently avoid touching it.  The bare minimum horizontal separation I would consider would be 5m on each side.  You can usually get away with tighter corridors than that, but a stormy day (heavy clouds can decrease / distort GPS signals) will come where you need that and even more.  You should verify this with your setup and get comfortable with your own safety zones.  I suggest that flying a rectangle exactly over the edges of some section of your Google Maps visible runway is a good safe way to test your accuracy.  Set the flight speed to one you can keep up with or make it a short course, and be out there with it so you can watch for accuracy and for problems.

GPS has many quirks.  Even on a good day, it can take 20 minutes to acquire the entire GPS almanac (list of satellites, where they are, and their direction of travel) before your first flight.  It requires a full view of the sky for best results.  Anything less than a full sky view can cause some satellites to be hidden.  When satellites come into view or leave the view, the reported position can change a significant amount (10's of meters).  Assuming the GPS is actually motionless, the coordinates the GPS gives don't jump, but will drift till it gives the final result the latest set of satellites gives.  This means "Don't fly next to buildings or indoors, or under tin roofs!"  This means "Set the GPS/aircraft powered on, outdoors, in the open, for 20 minutes before your first flight of the day.  Later flights are usually OK after only 1 minute or so; YMMV.

Several countries and coalitions have launched their own versions of GPS.  Newer GPS models can see and use them too.

The main GPS frequency is around 1.5ghz.  That is close enough to 1.3ghz FPV video that you should test your aircraft in flight trim to determine if your FPV is hurting your GPS reception.  For safety, you should extend that idea to include any transmitter on board the aircraft.  This is time consuming, but worth it.  Run GPS for 10 minutes with transmitters off, then 10 with them on.  Check the number of satellites the GPS can see.  Repeat if desired.


Magnetometer (Compass)

Lets say you plugged in the battery, armed, took off, and climbed to 1 meter (The meter is the scientific standard for this kind of thing, so get used to it.  If you are from a country that uses feet, think yard when someone says meter and you will get the idea).  Now you switch to Position Hold GPS flight mode because you have to scratch an itch.  The wind blows and the GPS tells the FC that your copter is 1 meter too far south.  The FC needs to tell the copter to fly north.  What direction is north?  Think about that.  We have not said what direction the copter is facing, and none of the sensors listed so far will say what direction the copter is pointing.  The GPS can tell what direction it is moving, but not what direction it is pointing (a copter can fly sideways or backwards), so which way should the copter bank to travel north?  We need a compass (magnetometer) to tell us that.


Barometer (Air Pressure)

It turns out that the vertical component of GPS coordinates is inaccurate, so we add a baro to smooth out the vertical component of GPS flight.  In essence, the GPS is used for initial altitude and for a long term average, but the baro is used for second to second and minute to minute accuracy.  The baro is capable of detecting an altitude difference on the order of 10cm (centimeters, 10cm is about 4 inches).


INS13 (GCS -> Configuration -> Attitude -> Settings -> Attitude Estimation Algorithm)

This is a better way of adding up all the sensor data and is required for GPS flight modes.  It also works for non-GPS flight modes.  I recommend that you start using it once you get flying and get your power wires properly twisted and your mags working right.  INS13 does not need any period of motionlessness (e.g. after power on and again at arming) to calibrate the gyros.  As a matter of fact it likes motion and can start to go a bit wrong if left completely motionless for many minutes.  It is always a good idea to rotate the copter in all three dimensions by hand, before takeoff if it has been sitting motionless for a long time (like when waiting for a good GPS fix).  If you don't, you may experience significant undesired motion (enough to cause a crash) for a second or so at takeoff.


You May Also Want To Know

Fixed Wing Constraint

If you are flying a fixed wing airplane and the wind isn't blowing too hard, you can write code to do GPS flight without mags, because the aircraft is always moving, GPS gives you the direction of motion, and the aircraft is always pointed in the direction it is moving.


Emergency Fallback For RTB

Mags are sensitive things.  To be able to see the Earth's magnetic field, the mag fields generated by the high current wiring in a quadcopter must be carefully canceled by twisting the high current +- wire pairs, even so, the mags can be fooled.  Also, if you fly in areas that have lots of iron content (auto junk yard) or mag fields, there can be problems if your wiring is already marginal.  The answer is Emergency Fallback mode.  This is usually only used with an emergency RTB.  The idea is that the FC just tells the copter to fly with a constant forward bank, and then looks at the GPS trail to see what direction it is flying and thus what direction it is pointed.


Copter Flight Without Mags

Given how accurate our gyros are and how fast our CPUs are now days, it is even possible to do away with mags if the code will just sit back and watch both the bank angle and the GPS trail.  It can say "I see that the pilot (automated or human) has added an additional 5 degrees left bank angle, and I see from the GPS data that there is an additional acceleration in the north direction, thus the copter is facing east.  Now that I know that, if we yaw in some other direction, I can just ask the gyros "how much" and add that in so that I always know where the nose is pointed."  The gyros will drift off and become inaccurate very slowly, so they are only good for immediate use, but this bank angle / GPS acceleration can correct for the gyro drift.  Wind is an issue, but it can be estimated and compensated for too.
« Last Edit: March 04, 2020, 07:48:09 pm by TheOtherCliff »

Background: Radio Frequency Issues

There are a lot of different things that you can add to a basic multicopter, and autonomous flight is just one.  You need to consider what else you may do later, so you don't paint yourself into a corner by buying a version of something now that will conflict with what you want to buy later.  In addition to the RC radio, some interesting gadgets have radio equipment involved:  FPV video, telemetry, GPS.

The term "RF band" means a range of RF frequencies from some lowest value to some highest value.
The term "RF frequency" means a single frequency within an RF band.  This concept is a little bit fuzzy because transmitters actually broadcast on a smaller band; not really a single frequency.

Channel hopping is a way of allowing many gadgets to use the same band at the same time.  That's why you and many of your friends can use modern 2.4ghz or 433mhz RC radio systems at the same flying field at the same time.  Telemetry on 2.4ghz, 915mhz, or 433mhz should also work this way, but test it before you rely on it.  Some older 433mhz RC (LRS) radios may have problems if several people use them at the same time.  Telemetry may need to be configured differently to help avoid sharing problems.  Test to be sure.

Be sure to research the frequencies and power levels it is legal for you to use in your country.  You don't want to buy a cheap eBay FPV (First Person View, video) transmitter on 1080mhz and cause problems for a full sized aircraft that is using that frequency for radio navigation!!!  Besides, it is just not nice to mess up someone else's fun just because you were too lazy to learn to play fair.

Video transmitters are bandwidth hogs.  Four 2.4ghz FPV transmitters (each configured to a 25% slice of the 2.4ghz band) will use the whole 2.4ghz band where it reportedly takes more than fifty 2.4ghz RC transmitters to use the whole band.

Don't use a channel hopping gadget and a non channel hopping gadget in the same band, at the same time, at the same flying field.  E.g. don't fly a 2.4ghz FPV transmitter at the same time someone else flies a 2.4ghz RC radio.  Older 2.4ghz RC radios may not work well, and the FPV video will get interference from the RC transmitter(s).

Probably the first thing to consider is RF conflicts that can keep you from using gadget A with gadget B.  There are some exceptions (such as channel hopping 2.4ghz, 433mhz or 915mhz "RC or telemetry systems" which actually skip around many frequencies in the band), but generally, you can't have more than one RF gadget on the same RF frequency running at the same time at the same flying field.  The good part is that many gadgets that use RF can be bought or configured to a different RF band or frequency.

Another thing you need to know is that you shouldn't have a transmitter and a receiver on the same band used close together (mounted on the same vehicle) even if you could use them at the same flying field at the same time.  (The receiver front end could get swamped and the AGC increased, and the desired signal not even seen.)  An example of what this forbids is a 2.4ghz RC (receiver) and 2.4ghz telemetry (transmitter) on the same vehicle.  There are some cases where it will work, but it must be tested to be sure.  An example of what this allows is two FPV transmitters on different frequencies in the same band on the same vehicle.  Example: 1255mhz and 1280mhz FPV transmitters.

Transmitters aren't perfect.  In addition to the frequency they are supposed to transmit, they also splatter on other frequencies.  The worst splattering occurs on odd numbered harmonics, but less and less for the higher harmonics.  E.g. 3, 5, 7 ...  The biggest example of this is that 433mhz (telemetry and LRS RC) splatters on exactly 1300mhz, which is so close to the FPV frequency 1280mhz that it causes problems.  One solution is to use a filter on the 433 transmitter antenna.  Another is to use a different frequency.

A word or two about antenna size:  The higher the RF frequency, the shorter the antenna.  Low frequency antennas are large enough to cause mounting problems with small vehicles.  A standard half wave dipole antenna is about 143/mhz meters long, so a 2.4ghz RC radio antenna is about 143/2400 = 0.06m = 60mm = 2.36 inches long.  A 433mhz antenna is about 0.33m (a foot) long.  A 1280mhz antenna is about .11m long.  A 5.8ghz (5800mhz) antenna is about 0.025m (25mm or an inch) long.  Circularly polarized antennas are about this size in diameter.

Channel hopping: multiple vehicles running are OK at the same field at the same time, but some may not work well on the same vehicle at the same time
Modern RC radios channel hop across the 2.4ghz band (2400mhz)
LRS (Long Range System) RC radios typically channel hop across the 433mhz band
Modern telemetry systems channel hop across one these bands depending on what you buy:  433mhz, 900mhz, 2.4ghz, and 5.8ghz

Single frequency: one at a time at the field on the same frequency, only one per band at a time in the same vehicle unless both are transmitters or both are receivers.
Older RC radios come on frequencies in these bands: 27mhz, 35mhz, 36mhz, 40mhz, 72mhz, etc.
FPV video transmitters come on frequencies in these bands: 433mhz (very rare), 900mhz, 1.3ghz, 2.4ghz, and 5.8ghz.  Beware and do research before buying one on a different band or one where the seller won't tell you exactly what frequency it is on.  An example that is actually a good inexpensive system is the "15ch video transmitter" and receiver system you will find on eBay.  Of the 15 channels, two (1255mhz and 1280mhz) are legal in the USA, but the other frequencies are not legal, and the illegal frequencies can be an issue.
GPS uses several bands, but the one most important are 1575 and 1228 and that may be too close to 1.3ghz to allow use of 1.3ghz FPV transmitters
Example: OK (with testing) to have e.g. two FPV transmitters, one on 1255 and another on 1280 on the same vehicle.  Not that you would want to do it, but it is not OK to have these two on the same vehicle if one is a transmitter and the other a receiver.

Wifi: Strong Wifi signals from residences or businesses or even from smart phones can cause problems.  They can use all of the 2.4g or 5.8g bands or they can be currently lightly used and not cause a problem.  One typical problem occurs if your RC radio is 2.4g and you fly a long way away (FPV) so that the vehicle is closer to residential Wifi than to the RC transmitter.  Another occurs with FPV if there is a close residence broadcasting on 5.8g and you fly 5.8g FPV a long way away.

Bluetooth:  Bluetooth is also on 2.4ghz.  It's like a weak version of Wifi.  I wouldn't put Bluetooth telemetry in an RC vehicle that uses 2.4ghz RC for control.  You might get away with it, partially because the Bluetooth is disconnected (out of range) most of the time, and only sends out connect packets infrequently.  I wouldn't use Bluetooth earbuds to listen to music while I flew with 2.4ghz radio.  The telemetry (including "I'm alive") coming back to the RC transmitter might get blocked.

(work in progress)

Frequency conflicts
- Direct conflicts
  LRS / Telemetry / FPV
- Indirect conflicts
  433/1300
  1300/GPS



Wisdom says that your RC frequency should be lower than your FPV video frequency.  The reason is that the lower frequencies travel and penetrate better.  You loose sight but still have control, you have a chance to get it back.  You loose control, but still have sight, and it will crash.

I put this here, instead of at the end, so that it would be read.  :)

There are a lot of ways that your copter can fail, and you need to know them all and make some decisions.

RC Llimitations

Distance (Max and Reduced)

Normal RC systems usually have a stated design distance that varies from 500m to 1500m.  The LRS RC systems can go a lot farther than that, and will typically be on a different RF band which can mean inter

Max expected / tested
Adding transmitters to the vehicle
Bad antenna configurations
Interference (FPV, Wifi)
 
- Failsafe modes
- Shadowing
, conditions for reduced distance)
- FC failsafe
- GPS almanac download, min time to good fix, drift with change in sat coverage
- Mag sensor issues with high power wiring
- Baro sensor issues (cover with open cell foam, cotton, tissue paper, etc.)
- Telemetry is handy to have for several reasons (mag calibration, settings, waypoint flight plan loading, ...)
- A way to get an extra position on your flight mode switch

Know your software
- Mag sensor failure fallback
- Causes of failsafe
- GPS and mags must be green in Health Gadget
- How to determine when it is safe to arm (with and without a GCS)
- Return To Base (with Land)
- Ripping maps for use at a flying field without an internet connection.

Know what components can have temporary failures (besides simple hardware failure)
- GPS loss of fix, drift caused by change in satellite coverage (e.g. next to a building)
- Mag sensor issues
- Vibration induced connection failure

How to avoid the common failures
- FC failsafe stops the motors by default, but you can change that
- Crash into people, pets, or property
- Fly away
- Loss in an unrecoverable area (e.g. the ocean)
- Salt water is bad, fresh water not so bad
- Props breaking in the air
- Tall landing gear cause tip overs on landing
« Last Edit: November 05, 2015, 09:48:54 pm by TheOtherCliff »

The ABC Steps of Autonomous Flight on Multicopters: Know Your Hardware
« Reply #3 on: July 08, 2015, 10:21:45 pm »
(work in progress)

RC limitations (distance, failsafe, shadowing, conditions for reduced distance)

Maximum Distance of the RC Radio

Maximum distance of the RC controller is the thing that most new RC pilots want to know and there are a several things that affect max distance.

RC Radio Band Affects Range

Modern radios are generally sold on the 2.4ghz RF band which is not good for distance because higher frequencies are attenuated more by things that are between the Tx and the Rx.  Things like trees and moisture in the air.  I have tested a 72mhz Futaba radio whose specs claimed 1km, to 2.4km+ (1.5miles+) on the ground.  I have had a fly away (I tripped over a knee high fence) crash in the woods probably 150m into the woods and my 2.4ghz Taranis (claims 1.5km range) was issuing "Critical range warnings" and the signal was lost if I held the transmitter close to the ground.  The moral of this story is that you will very probably use a 2.4ghz radio.  You must keep the aircraft in "line of sight" so that there are no trees, etc. blocking the radio signal.  You simply can't fly a long way into a forest (e.g. with FPV) and expect to maintain control with your normal RC radio.  If you must do that, you should at least research using a lower frequency for your RC radio (but aircraft antennas become a hassle with that).

Some good things about 2.4ghz are:
- The antennas are small
- They are designed to share a band of frequencies, and so you don't need to worry about two people flying on the same frequency at the same time
- Many include some telemetry, including Rx signal strength; that, combined with the somewhat directional Tx antenna can be a great help in locating a downed aircraft.

Park Flier vs. Full Range Radios

Park Flier RC radios are generally cheaper and quoted to be good to 500m and Full Range RC radios are generally more expensive and quoted to be good to 1000m or 1500m.  You must decide what you want.

Antenna Position

The best antenna position for strongest signal from a standard antenna is out the side, not out the tip.  Think of it as a bowstring shooting an arrow out the side.  This is true of both the transmitter and receiver.  The worst antenna position is straight out the tip.  Polarization is also an issue, even if the middles of the Tx and Rx antennas are pointing at each other, if one antenna is vertical and the other horizontal the signal will be significantly reduced.

Diversity (Two Antennas on the Rx)

These two antennas must be mounted at 90 degrees to one another for best reception.  Generally, a 90 degree V that is lying down flat is the best configuration.  This configuration gives good signal when paired with the transmitter antenna mounted horizontally.  If the aircraft is level, one or other of the Rx antennas are always in correct polarization with respect to the horizontal Tx antenna.

On Board Transmitters Can Reduce RC Range

Before flying with a new transmitter on board the aircraft, always test your RC range with the new transmitter off, and again with it on.  If the range is significantly less, you need to do some research and reconfigure it.

Try to mount your on-board-the-vehicle transmitter antennas so that they don't align with other antennas.  Example: A good configuration for RC with FPV is for the pair of 2.4ghz RC Rx antennas to be a V lying down horizontally with RC Tx also horizontal; and for both FPV antennas to be vertically polarized (assuming you are using linearly polarized antennas on the FPV; that is more common with lower FPV frequencies like 1280mhz and 910mhz).

Other Things That Can Reduce RC Range

For the current 2.4ghz RC radios, there are some typical things that reduce range below the quoted value:  Obstacles in "line of sight" that block the signal, failure to follow instructions about Rx antenna mounting, and failure to follow instructions about Tx antenna position are probably the most common.  Airframes or large components (batteries, webs of wiring) made of metal or carbon fiber can block the signal if the aircraft is banked a certain way.

Special Antennas on the Tx

Some people use special antennas on their RC Tx.  These are called high gain antennas, and the bad thing about using them is that they achieve stronger signal in one direction by giving you weaker signal in another direction.  The higher the gain, the more critical it is that the Tx antenna be pointed 90 degrees from where the aircraft is (signal is strongest perpendicular to the antenna).

LRS radios (Long Range System)

The Tx is generally purchased as a module that plugs in the RC Tx module bay, and have an antenna attached to the module.  The Rx is a separate RC receiver.  They are generally run spread spectrum on the 433mhz band (generally shouldn't be used with separate 433mhz telemetry equipment).  They run higher power and may have a higher power switch, but some of the range also comes from the fact that they use a lower frequency.

2.4ghz Range Boosters

Some people have modified and used a Wifi range booster (RF power amplifier) to increase range of a standard 2.4ghz RC radio.  Note that the telemetry that is sent by the RC radio in the aircraft is still normal range.  Note that it probably requires a special radio operators license to do this.  Check your country's regulations.

Failsafe

RC Failsafe

RC failsafe is an important topic.  If it is set wrong your aircraft can simply fly away when it is out of range.  You do NOT want it to hold the current stick positions when it flies out of range.  It will just keep flying away till the battery dies.  The minimum here is to have the throttle go to zero and the flight mode switch go to attitude mode if it flies out of range.  Or your brand of RC radio might let you set it so that the receiver stops sending servo pulses when it flies out of range.  In this case, the default setup will see the missing pulses and the FC will go into FC failsafe.  The default value for that is to stop all the motors.  Some think that a better RC failsafe might be to use Attitude mode and to reduce the throttle just enough to allow it to come down slowly with a fully charged pack, but that can mean cutting someone or something with a running prop or a running motor getting tangled in grass and overheating / starting a fire.  The best may be to set the flight mode switch to "Return To Base with autolanding and motor off" which requires a carefully set up GPS/mag system.  Even this has some perils.  If you have your system set up to set the Base location to where ever you arm, and you land and disarm/arm somewhere, then RTB will return there, which is perhaps not where you expected.

FC failsafe

FC failsafe can be used in place of RC failsafe if your RC doesn't have failsafe.  That will happen automatically if your RC receiver is designed to stop sending servo pulses when it is looses signal.  FC failsafe also occurs for other reasons, like intermittent wiring from Rx to FC.  The default is to disarm and stop all the motors.  FC failsafe is implemented as a simple change in the position of the flight mode switch.  It's usually even possible to set up an extra flight mode position that is not usable from the switch, but is engaged if the radio looses signal.  For example a 2 position switch on at least some Futabas can be set so that one switch position has the signal all the way to one side, the other switch position has the signal in the middle, and failsafe has the signal all the way on the other side.  The switch is set up as a 3 position switch in the GCS flight mode switch setup.


Sensor Limitations

GPS (GNSS in modern terms)

The coordinates that the GPS gives the FC are not perfect and so for instance a GPS position hold mode can be expected to drift.  If you have a good GPS and wait for a good GPS fix, on a good day in a good location, the drift will be minimal.  Good is basically motionless.  Not good can drift at say 1 meter per second.  If you do something really wrong like change the GPS settings to allow arming in marginal conditions, it can fly away at full throttle.

Executive summary: Before the first flight of the day, set the vehicle out in the open, powered up, for 15 minutes before the first flight.  If the next flight is within 5 hours, you can probably reduce this to 2 minutes, but test this in a safe manner to be sure.

GPS's must search all possible frequencies to determine which satellites are "visible" (above the horizon and usable).  That can take a long time.  There is a message that all GPS satellites send.  That message is a list of where each satellite is located.  That message is called the GPS Almanac.  Once the GPS has found at least one good satellite, it starts to download the almanac.  The download takes 12 minutes.  After the almanac download is complete, the GPS will know right where to find the satellites and will therefore have a better location fix.  Most GPS units have a battery or supercap to save the almanac.  A supercap (think: small battery) version like the OP GPSV9 can save the almanac for about 5 hours.  A battery version can save the almanac for days, but the almanac is generally considered only good for one day.
- GPS limitations like in / beside a forest or building or canyon or city

Mag (Magnetometer or Compass)
Mag sensors are very sensitive.  Wires put out magnetic fields that are proportionally bigger the more current flows in the wires.  For wires in loops (a plus and minus wire pair together form a narrow loop) the magnetic fields are all added together to a larger value in the center.

The way we counteract this is to twist all high current wire pairs (and the motor triplets too).  Twisting makes sure that the wires are always close together.  Also, alternate "loops" of the twisted wire have the magnetic field pointing in opposite directions so they cancel out more than wire pairs that are just held close together.

If you want to have a GPS, you must have a mag and to have a mag, you must carefully twist your high current wires.  Also avoid running any wires (even low current wires) close to the mag sensor.  Mags are so sensitive that you must calibrate your mags after your vehicle is complete and ready to fly, because of metal and magnets in the vehicle.

Here is a link to a post with all the mag info you might need to know.
- Mag sensor issues with high power wiring

Baro (Barometer or Air Pressure)
Baro sensors are very sensitive to air pressure differences.  The baro in most of the better FC's (MS-5611) is so sensitive that it can tell the difference in pressure in just a 10cm (4 inch) difference in altitude.

The enemy of baro sensors is wind of any kind.  That mainly means prop blast, but also includes the moving air from vehicle motion.

The way we fight this issue is to put open cell foam (or cotton, cloth, etc.) over the baro sensor.  That way the fast fluctuations in air pressure are reduced and all the sensor sees is the average pressure.  Some experimentation is required to determine how much to use.  Some recommend a cotton ball held on with a piece of tape.  If your FC is at the bottom of a board stack, you can just put a cube between the boards.  Make sure that your foam or whatever is pressed down firmly enough to keep air from getting in underneath it, but loosely enough to allow the tiny air passages in the material to be open.

- Baro sensor issues (cover with open cell foam, cotton, tissue paper, etc.)

Other
- Telemetry is handy to have for several reasons (mag calibration, settings, waypoint flight plan loading, ...)
- A way to get an extra position on your flight mode switch
« Last Edit: March 01, 2016, 10:53:03 pm by TheOtherCliff »

(reserved for future use) The ABC Steps of Autonomous Flight on Multicopters

(reserved for future use) The ABC Steps of Autonomous Flight on Multicopters

(reserved for future use) The ABC Steps of Autonomous Flight on Multicopters

paulj

  • *
  • 25
Re: The ABC Steps of Autonomous Flight on Multicopters
« Reply #7 on: July 08, 2015, 10:27:04 pm »
Is there a plan to get a wiki up and running? This type of information will be best located there if there is.

I am interested in autonomous flight, but never managed to spend enough time trying to track down a GPS to make it possible. I have two applications I think would be interesting:
  • An autonomous thermal soarer - once autonomous flight mode is enabled, it searches for thermals in a pre-defined area of sky, but once the lift is no longer available, lands at (or at least returns to) the launch/landing site
  • I read about someone launching a glider from a helium balloon at ~100k feet, and it used to fly down to the launch field. Since I first came across this, I have seen several others who have made this happen
  • A solar powered model which can stay up through day and night continuously, using lift in the day and stored electrical power at night

One day I would like to give these a go! I recognise I would need permission from the CAA (Civil Aviation Authority) in the UK.

Let me know if you want me to move this elsewhere - I notice you have loaded some additional messages to store the developing information since I started this reply!

ggrif

  • *
  • 178
Re: The ABC Steps of Autonomous Flight on Multicopters
« Reply #8 on: July 08, 2015, 10:55:15 pm »
Cliff, really looking forward to another tutorial from you, keep 'em coming!

Also, glad I found "you all" so quickly!

Re: The ABC Steps of Autonomous Flight on Multicopters
« Reply #9 on: July 09, 2015, 09:16:49 am »
Yea, this does eventually belong in the wiki.  :)

Wagsy

  • *
  • 87
    • Rotorpix
Re: The ABC Steps of Autonomous Flight on Multicopters
« Reply #10 on: September 26, 2015, 11:35:21 am »
Excellent write up, was a bit of work there. :-)

derekh

  • *
  • 1
Re: The ABC Steps of Autonomous Flight on Multicopters
« Reply #11 on: January 05, 2016, 07:48:48 pm »
Ditto the above post.  In about 30 minutes I just learned more about my home-built quad and flying it than in the previous six months of trial and error!  If only it was not about 20 degrees outside I would be out there flying right now.  Keep up the good work.

JHBDrones

  • *
  • 14
  • WELCOME to me, and my first time building drones
Re: The ABC Steps of Autonomous Flight on Multicopters
« Reply #12 on: January 08, 2017, 08:27:45 am »
i have a question, since iam new to all this- does the flight controller (CC3D) come with built-in GPS or do i have to buy a separate module to be able to use GPS waypoint on GCS.

Mateusz

  • *
  • 808
Re: The ABC Steps of Autonomous Flight on Multicopters
« Reply #13 on: January 08, 2017, 09:27:14 am »
i have a question, since iam new to all this- does the flight controller (CC3D) come with built-in GPS or do i have to buy a separate module to be able to use GPS waypoint on GCS.

I am afraid CC3D is just a flight controller and not autopilot. LP firmware advanced features are only supported on higher end boards with F4 mcu that has more RAM (ref https://librepilot.atlassian.net/wiki/display/LPDOC/Advanced+features)

You need Revolution and then separate Ublox GPS M6N/M7N or M8N module with built-in magnetometer HMC5883. Prefered is official DJI Naza GPS (~$39 at the moment). You need to cut cables and change connector to JST-SH 1.0 4-pin (and figure out which cable is VCC,GND,TX or RX not to mixed them up or check forum how others did that).
Alternatively you can order UBlox M8N module with magnetometer that has I2C lines, but that's a bit more tricky to set up as I2C is not meant for long communication, extra pull-up resistors might be needed if cables too long, and you need long cables to put magnetometer high on a mast away from electric currents. Also GPS module with I2C wires for mag, takes two ports main-port and flexi-port which means you lose possibility of connecting something else there. That's why I would suggest DJI Naza GPS.