Developer

FPV Racing using Arducopter

3689663048?profile=original

Hi All,

This is intended to help people who are interested in using Arducopter for FPV Racing and/or mini quads.

Personally I started using Arducopter because I wanted to fly FPV and get aerial video of my 4wd trips. I also wanted the comfort of RTL and Loiter to get me out of trouble and help me learn. Arducopter's focus at the time was autonomous flight and I was told that we don't have time to focus on manual flight, other boards like the KK were for that stuff. My argument has always been that making Arducopter capable of aggressive manual flight provides the foundation of robust autonomous flight.

Three years later so much has changed. Arducopter is expected to handle the most serve weather conditions the hardware can fly in, while carrying out a way point mission with the grace of the most skilled pilot (I don't believe we are quiet there yet). This has come about by focusing on achieving the best control we understand is possible. This focus on the basics of control means that Arducopter is a very capable FPV and acrobatic controller.

There have been a number of advancements over the last three years that have taken us to this point.
1. Introduction of the Rate D term,
2. Earth frame to body frame conversion,
3. The Stability Patch,
4. IMU filtering understanding and improvements,
5. Our first stabilized ACRO http://diydrones.com/profiles/blogs/acro-for-ardupilot-3-1,
6. The Onion rewrite,
7. The post Onion ACRO rewrite,
8. Autotune,
9. Thrust linearisation and current limiting,

And on the immediate list of things to do

10. Conversion to Quaternion attitude controller,
11. One Shot support.

Some of the key people that have taken an active interest in ACRO and it's development over the last 3 years are Robert Lefebvre (responsible for the first stabilized ACRO algorithm), Randy Mackay, Jonathan Challinger, Paul Riseborough, Josh Welsh, Bob Doiron and many people I can't name who gave feedback and risked their copter testing ACRO.

So enough of the reminiscing about old times.

My role on the Development team focuses primarily on the control and navigation code in arducopter. While many people see Arducopter as targeted at larger copters and autonomous missions, I have found small powerful quads to be the best test platform for this development. Copters in the 250 to 300 size range not only crash well, there agility and power make them very sensitive to controller design and tuning. Further, the standards we aspire to, are reaching a level where the only way to properly test them is with FPV and a combination of on board video and logging. On top of all that, they make testing FUN :)

So this has been my primary test platform for the last 12ish months (after one of many hard landings):

3689663123?profile=original

Name: QAV 250
Weight: 624g
Motors: Baby Beast 2206 2150 kV
Battery: 1300 mAh, 3s
Props: HQProp 5x4.5 Bullnose
Power: 480 W
Current: 40A continuous and full throttle
Thrust: 1.68 kg Thrust at full throttle

My setup on the QAV is relativly low power compared to what some of the best pilots are flying so I decided to build something a little more extreem while ensuring I didn't need to continuously replace puffed batteries and burnt out ESC's and motors. I came up with this:

3689662984?profile=original

Name: My kids call it Willy for some reason (don't ask me!)
Weight: 940g
Motors: Sunny Sky 2208 2600 kV
Battery: 2200 mAh, 4s
Props: Gemfan 6x4.5, Gemfan 6x4 Bullnose, HQProp 6x4.5, APC 6x4E Speed, Quanum 6 x 4.5 Carbon (still experimenting)
Power: 1.4 kW continuous, 2 kW for short bursts
Current: 120 A continuous, 160 A for short bursts
Thrust: 4kg continuous, +6kg for short bursts
Has a custome 200A 4s power module based arround the ACS758ECB-200U-PFF-T.

Setting up an FPV racer

Vibration

Vibration is a major issue on these copters. They tend to be small, light, stiff, operate at high speed and rpm, with relatively large surfaces under the props. This means that lots of vibration is created and it is directly transfered to the base of the autopilot. There are two main sources of vibration, the first is when the high pressure wave created by the prop hits the top of the arm. The second happens during fast forward flight. When the blade of the propeller travels forward into the airstream it creates significantly more lift than when it is traveling with the airstream. This causes a torque on the shaft of the motor twice for every time the propeller rotates. Both of my copters create enough vibration to cause clipping on the accelerometers at full throttle.

My personal rule is I don't add vibration dampening unless it is needed and most of the time it is caused by loose screws or overly flexible frames. While my QAV 250 doesn't experience enough clipping to need any special attention, Willy creates an amazing amount of high frequency clipping that can destroy our attitude estimation (the autopilot doesn't know what direction is up). The solution I use (thanks Paul) is four 11 mm squares of Latex Foam. The foam below doesn't come with tape so I add thin double sided tape to each side before I cut it into squares.

Vibration handling
http://www.hobbyking.com/hobbyking/store/__26457__Anti_Vibration_foam_Orange_Latex_190mm_x_140mm_x_6mm.html
or
http://www.hobbyking.com/hobbyking/store/__26456__Anti_Vibration_Foam_White_Latex_Foam_.html

Below is my vibration isolation in Willy, it is worth pointing out how I kept the cables away from the Pixhawk and ensured any cables connecting to the Pixhawk had a nice bend to minimize vibration transfer from the frame.

3689663138?profile=original

Another serious source of vibration is vertical slop in the motor bell. This means that as the motor rotates the magnetic force that rotates the bell also causes it to jump up and down against the thrust of the propeller. Without the propeller attached this sounds like sand in the bearings. You can easily feel this my moving the bell up and down with your hand. If you feel a small amount of movement or hear a tick every time you move the bell, then you need to adjust the bell on the shaft. I do this with a press I made with the help of Sneezy:

3689663071?profile=original

It is based on this device and some square steal tube.
http://www.hobbyking.com/hobbyking/store/__11447__Turnigy_Pinion_Removal_Tool.html

If I find a problem motor I loosen off the grub screw and very carefully press the bell down over the shaft until I no longer detect any vertical movement of the bell.

ESC Setup

Larger copters don't require the fast response of Simon K and BLHeli and can result in sync loss or burnt motors or ESC's. It is especially important to ensure the ESC can handle not only the average current your motors draw but also the much higher peak currents caused by the aggressive response of the Simon K and BLHeli firmware. The only significant advantage these firmware provide large copters, especially lightly loaded, is active breaking.

For small FPV racers Simon K and BLHeli provide massive benefits. These copters have high powered motors and small propellers that are more an capable of taking advantage of the faster response time these firmware offer. There are three areas these firmware offer significant improvements.

The first is the removal or reduction of input filtering. This means that your commanded input to the ESC is directly passed to the motor without a slow ramp. The slow ramp up on standard ESC's keeps the peak currents from becoming too large and damaging the ESC and motor. That is why we need to make sure your ESC and motor can handle these short but high current spikes.

The second is active breaking. If you take your ESC and pump the throttle you will notice that the motor speed up much faster then they slow down. This is especially obvious on large props that are very lightly loaded because the drag on the propeller is very small and their momentum large, they don't tend to slow down quickly causing control and tuning problems. On small copters active breaking causes the motors to slow down almost as quickly as they speed up. The result is significantly more control torque on the air frame, provided with less delay.

The final improvement is One Shot (also an advantage of CAN bus ESC's). These ESC's speed up the communication between the autopilot and the ESC. The reduced latency makes it possible to have higher PID gains and tighter control. It is sort of like reading this blog post and being able to skip all the woffle to get to the good bits. :)

This is a screenshot of my BLHeli setup. You can see I have enabled Damped Light. This is the active breaking feature of BLHeli. Arducopter doesn't support One Shot yet but we are working towards that and I will let you know how this improves control when we get it going.

3689663214?profile=original

Center of Gravity (CG)

It is very important to get the CG right on any copter. The smaller the copter the more precise you should try to be. For a dedicated racing copter there it may be worth moving the CG slightly forward to counter what I understand is referred to as Propeller-Flapping-Torque. This is the tendency for the propellers to want to rotate away from the incoming airflow like an umbrella on a windy day. You can see the effects of this in forward flight by comparing the motor outputs. You will see that during fast forward flight the rear motors tend to have a higher setting than the front motors. A slightly forward CG can even up this imbalance and let you get the most power out of your motors.

The ideal CG changes based on exactly how you are using your copter. During tuning the CG should be as close to perfect as possible. For racing you may get small improvements by moving it forward. High powered racers that fly at 60 degrees pitch or more don't seem to experience as much Propeller-Flapping-Torque because the airflow is closer to 90 degrees to the propeller disk.

Camera Tilt and Field of View (FOV)

Until recently most copters didn't offer any significant camera tilt out of the box. As an FPV pilot I quickly realized that hovering, especially attempting to land, is the most difficult thing to do because of the limited field of view provided by the camera. As soon as I started moving forward my mind automatically fills in the world around me from the objects that I have recently passed by. For slow cruising around zero tilt is fine however as I started moving faster I found myself constantly looking at the ground. The obvious solution to this problem is tilting the camera back and making use of a camera with a large FOV.

As I started flying around object more confidently I started to shoot through holes and under trees. I needed to adjust for the wide FOV as I found that objects I thought I easily passed under would clip my rear props as they passed by with the annoying delay in fun. Unfortunately the larger FOV also limits the details I can see. This has caused a number of branches to suddenly appear in front of me in, what a second earlier, looked like a lovely open tunnel for me to fly through.

I am currently experimenting with 2.8 mm and 3.6 mm lenses on my FPV cameras and printed camera mounts at approximately 30 degrees. Fast forward flight is great but landing is very difficult because I get a view of nothing but sky. I have found the way to get around this is to come into landing by skimming along the ground then doing a turn to wash off speed while dropping the throttle to put me on the ground. However I am still experimenting to work out what I like and I am sure everybody will need to fine their own personal preference for the copter they fly.

Interesting Features of Arducopter

Now we get to the nuts and bolts but before I go too much further I would like to highlight the difference between FPV Acrobatics and FPV racing. FPV Acrobatics requires lightning fast roll and pitch rates combined with crisp yaw rates. FPV racing benefits from very controlled, smooth, turns with maximum stability. For this reason, maximum rates, acceleration and expo settings can be very different between the two. In general an FPV racer will be much easier for a beginner to fly than the same copter set up as an FPV Acrobatic quad.

Basic setup

There are a number of parameters that control how the copter will handle in ACRO.
ACRO_BAL_PITCH : Rate of pitch auto leveling in Trainer mode.
ACRO_BAL_ROLL : Rate of pitch auto leveling in Trainer mode.
ACRO_EXPO : applied to roll and pitch.
ACRO_RP_P : maximum rate of roll and pitch. It is multiplied by 45 to get degrees per second. Acrobatics will get as high as 20 while Racing will benefit from numbers like 6 or 8.
ACRO_TRAINER : This turns on angle limiting and self leveling. You can also set this using a ch7/8 switch. This is great for learning!!
ACRO_YAW_P : Like ACRO_RP_P, this defines the maximum yaw rate.
RC1_DZ, RC2_DZ, RC4_DZ : is the stick dead zone for Roll, Pitch, and Yaw. These are way too high for ACRO and need to be reduced to something like 5. Be careful though if you make them too small they may prevent Autotune from running because Autotune will think you are making a correction if the stick input exits this dead zone.
MOT_SPIN_ARMED : This should be set to a high enough value to ensure the motors are spinning assertively and can't be stalled easily. If you have an ESC that will reliably restart your motors after they are stalled then you can safely go a little lower. Make this too high and you reduce the usable thrust range, too low and you risk stalling a motor and crashing.
RATE_RLL_FILT_HZ, RATE_PIT_FILT_HZ, INS_GYRO_FILTER : These are the main filter setting used in the control loops of Arducopter. The smaller quads need more bandwidth and lower delays to achieve acceptable control-ability. I use a setting of 40 Hz on each of these filters, however, I suspect I may need to increase this to 80 Hz on roll for my high powered quad (Willy).


Thrust linearization setup

This is how Arducopter addresses the oscillation we see when we apply full throttle. There are two mechanisms that cause this oscillation.

The first is the small dead zone at the top of the ESC throttle range. This is somewhere between 7.5% and 2.5%. It is like driving an old car with play in the steering wheel. Once the controllers get into this region they don't get any response from the motors until they get large enough to get out of this range. The result is a fast oscillation from side to side. We remove this dead zone using the MOT_THST_MAX variable. By setting this to 0.95 we are instructing Arducopter to use only the first 95% of the ESC range.

The second is the tendency for propeller thrust to be proportional to the square of RPM and therefore ESC input (roughly speaking). This effectively increases the gain of the Rate loops as the throttle is increased. The increased gains can become unstable and cause oscillation. The thrust curve is approximated using the MOT_THST_EXPO parameter. This parameter changes for different propeller/ESC/battery combinations but for 5 to 6 inch props 0.65 is a good number.

The thrust is also dependent on your battery voltage and the gain of the Rate loops is adjusted to account for this. The parameters MOT_THST_BAT_MAX and MOT_THST_BAT_MIN defines the voltage range over which the algorithm will adjust the gain. I simply set these parameters to 4.2 x cell count and 3.3 x cell count.


Autotune

So you have finished building your copter, done all the calibrations, and had a bit of fun flying it around. Now you want to tune it up to get the most out of the little beast.

I don't think I need to go into too much detail about how to do Autotune. I personally set ch7 to Autotune, AUTOTUNE_AXES to 1, 2 or 4 (I do each axis on a fresh battery), and AUTOTUNE_AGGR to 0.1 for roll, 0.05 for pitch and 0.1 for Yaw. I find that Roll and Yaw can benefit from a slightly more aggressive tune while Pitch doesn't need it. However, I suspect I can improve the performance of Roll using a more optimal tune (0.05) if I get the filter settings correct.

To ensure a good Autotune, make sure your CG is perfect, be patent and wait for a very calm day (or be willing to repeat it when you get a calm day), and always set the axis being tuned 90 degrees from the wind. The only other suggestion I can make here is if your copter starts to build up speed in one direction or another use a short stick input between twitches to bring the copter to a stop.

Input shaping

Input Shaping is the term used to describe the adjustments we make to the pilots input to ensure the copter is able to follow the pilots commands perfectly. This lets us have a copter that reacts to external disturbances very aggressively but feels very docile to fly. There are 4 parameters of interest here ATC_ACCEL_P_MAX, ATC_ACCEL_R_MAX, ATC_ACCEL_Y_MAX and RC_FEEL. The ACCEL parameters define the maximum rotation acceleration the copter will be asked to achieve while RC_FEEL softens the feel of STABILIZE mode. Autotune will make measurements during the tune and set ATC_ACCEL_P_MAX, ATC_ACCEL_R_MAX, ATC_ACCEL_Y_MAX. You may increase these if you have a very high powered copter however, at hover you may see a little bounce back because it is only able to achieve the full control authority when your throttle is high. For racing you may want to reduce these to make the copter more predictable in the turns.

Saturated Yaw Headroom

This is new for Arducopter, the parameter MOT_YAW_HEADROOM controls how Arducopter prioritizes Roll, Pitch and Yaw when the combined request exceeds the ESC range available. The Stability Patch manages how the Roll, Pitch, Yaw, and Throttle commands are passed to each ESC. When the demands exceed the available ESC range (saturation), Roll and Pitch are prioritized to ensure the copter can stay level (there is no point providing throttle if the copter is upside down). MOT_YAW_HEADROOM determines how much ESC range is made available to Yaw during saturation.

During high speed cornering the copter can stall some or all of the propellers. When this happens the Stability patch can become saturated as it attempts to keep the copter under control while the lift from each propeller is changing dramatically. During this time the copter can spin out though loss of yaw control or drop an arm excessively through loss of roll or pitch control. How the copter varies depends on the CG, speed, and pilot inputs. By adjusting the MOT_YAW_HEADROOM parameter the pilot can adjust the tendency of the copter to spin out vs drop a motor.

I find the fastest way to break into a sharp corner is by rolling the copter 90 degrees then pitching the copter up 90 degrees while looking at the apex of the corner. This creates a massive amount of turbulence but gets me accelerating out of the corner very quickly. I personally find that loss of yaw control is completely disorientating, while dropping a motor can be easily recovered provided my focus point doesn't leave the FOV of my camera. By adjusting MOT_YAW_HEADROOM I can equalize the moment experience in Roll, Pitch and Yaw during high speed hair pin maneuvers.

Current limiting

You may have noticed that many pilots are pushing batteries, ESCs, and motors way beyond their current ratings. This provides the pilots with small bursts of power, however, if this power is applied too long the heat builds up and the smoke forever leaves one component or another. The parameter MOT_CURR_MAX lets you set a maximum continuous current draw based on the specification of your equipment. If the current exceeds the desired maximum the throttle is reduced over 2 seconds until the current is back at safe levels.

And we are done

Well, I hope that is helpful. In the future I hope we see more small Arducopter boards. The development team is very focused on providing the best control we can squeeze from these sensors and we use these small copters as a primary development platform. Currently Arducopter isn't even on the list of FPV Racing Autopilots but I hope we can change that.

Finally I would like to share a situation that always gives me a little smile. When flying FPV with a few friends, there is always the occasional loss of video. This may be because the transmitter failed or because another pilot turned on their copter to the same frequency as mine. When this happens there is normally a panic as the pilot rips off their goggles shouting "I have lost my video", looking for their copter. Pilots on the ground pulling out batteries in case it is their transmission that have caused the problem. When this happens to me I say in a relaxed voice "I think you are on my channel" or "Oh crap, my video transmitter just gave out". I switch to loiter or RTL, I take my goggles off as my eyes adjust to the light. Well, the Arducopter pilots understand, but it is quiet novel for pilots of other systems :)

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • i have fast small oscillations on the roll axis on my high powered racer with pixracer, havent figured it out yet after reading all of this and trying different things....looking for any thoughts on this

  • HI,
    has anyone started doing fast auto missions w/ their racers?  I've been trying to tune mine up for fast auto, and am having trouble reaching high speeds.. 
    To start, I'm trying to increase the "speed up", and it won't go any faster than about 6 meters per second.  I have the parameter set to 10, and have even increased it to 20 meters per second. 
    And, I don't know how fast it is going, but in stabilize, it is very very fast..  at least several times faster than the ~6 meters per second I can get it to go up in auto. 
    So..  are there other parameters that affect the speed in auto??
    I could imagine for horizontal speed there might be angle limits, etc, but for just vertical, I can't figure out why it won't give it more power.

  • Leonard, I've tried following this blog for setting up a small quad (360mm) with pixracer, but it's already very out of date due to the cool work you've done on motor refactor, learning hover etc.  Any chance of an update or a 3.4 version?

  • Developer

    Hi Scott,

    I think the GPS would be find but you may have compass issues from the currents in the battery directly below the compass on the GPS. You may find that the internal compass has less interference. You would have to try it and see.

  • I've got another question... 
    I'm wondering if it would be OK to mount my GPS/Compass on top of my battery w/ Velcro.  (battery is on top of my frame)
    My copter is pictured on the first page if this thread.. Only pic that's not Leonard's.  It's changed a lot since then, but same general idea...

    Currently, my GPS/Compass is on a mast, which is only a couple mm above the battery.  But, it breaks in hard crashes.. not often, but still trouble. 

    So, since it is so close to the battery already, would it hurt to physically mount it on top of the battery?  It's on a piece of grounded copper PCB, for an extended ground plane. 

    I can see potential issues..
    Mounting position would change a little, since it is removable.
    And, would the battery cause interference? it would be on the end of the battery opposite the wires, but still, I don't know how much EMF a lipo causes.

    thanks for any advice!

  • Leonardthall,
    Whenever you have time, could you review my logs about the issue I mentioned on 3/24?

    I don't know if I can post attachments here, so I put them in a thread here:

    http://diydrones.com/forum/topics/auto-control-in-loiter-stronger-t...

    Take your time, and thank you.

    Scott

  • Developer
    Blacklist324,
    I have no idea if the px4 stack supports one shot. I do know it doesn't support most of the features I have described in this post. So acro and fpv on the px4 stack questions need to be posted elsewhere.

    It does look like oneshot will be supported in the next release of Arducopter and active breaking can be used with arducopter now.
  • Hi Leonardthall, 

    Would a pixhawk, loaded with px4 stack, be able to run active braking and oneshot using the qgroundcontrol GCS ?

  • Thanks, I'd really appreciate it.  I'd love to get this solved!!
    I think I need to get some better logs..   Yesterday I had it on and armed for long periods, but only short flights, etc.. 
    I'll get back to you when I've got more data, and thank you!

  • Developer

    Hi Scott,

    That shouldn't happen. Can you send me a dataflash log where this has happened. This may be a number of things but I will be able to tell you what is happening with a log.

    Thanks!!

This reply was deleted.