Week Eight (9/June/2014 - 15/June/2014)
This week we are going to study different flight modes in the APM, such as Altitude Hold, Land and stabilize mode.
Altitude Hold
In altitude hold mode, the copter maintains a consistent altitude while allowing roll, pitch, and yaw to be controlled normally. This page contains important information about using and tuning alt hold.
Overview
When altitude hold mode (aka AltHold) is selected, the throttle is automatically controlled to maintain the current altitude. Roll, Pitch and yaw operate the same as in Stabilize mode meaning that the pilot directly controls the roll and pitch lean angles and the heading.
Warning: The flight controller uses a barometer which measures air pressure as the primary means for determining altitude (“Pressure Altitude”) and if the air pressure is changing in your flight area, the copter will follow the air pressure change rather than actual altitude (unless you are within 20 feet of the ground and have SONAR installed and enabled). Below 26 feet, SONAR (if enabled) will automatically provide even more accurate altitude maintenance.
Controls
The pilot can control the climb or descent rate of the vehicle with the throttle stick.
If the throttle stick is in the middle (40% ~ 60%) the vehicle will maintain the current altitude.
Outside of the mid-throttle deadzone (i.e. below 40% or above 60%) the vehicle will descend or climb depending upon the deflection of the stick. When the stick is completely down the copter will descend at 2.5m/s and if at the very top it will climb by 2.5m/s. These speeds can be adjusted with the PILOT_VELZ_MAX parameter.
AC3.1 and later allow arming and disarming in altitude hold mode. When disarming, the copter may need to rest in the landing position for a few seconds to allow the internal calibration to indicate that the copter has landed before you are able to disarm.
If the throttle stick is in the middle (40% ~ 60%) the vehicle will maintain the current altitude.
Outside of the mid-throttle deadzone (i.e. below 40% or above 60%) the vehicle will descend or climb depending upon the deflection of the stick. When the stick is completely down the copter will descend at 2.5m/s and if at the very top it will climb by 2.5m/s. These speeds can be adjusted with the PILOT_VELZ_MAX parameter.
AC3.1 and later allow arming and disarming in altitude hold mode. When disarming, the copter may need to rest in the landing position for a few seconds to allow the internal calibration to indicate that the copter has landed before you are able to disarm.
Tuning
The Altitude Hold P is used to convert the altitude error (the difference between the desired altitude and the actual altitude) to a desired climb or descent rate. A higher rate will make it more aggressively attempt to maintain it’s altitude but if set too high leads to a jerky throttle response.
The Throttle Rate (which normally requires no tuning) converts the desired climb or descent rate into a desired acceleration up or down.
The Throttle Accel PID gains convert the acceleration error (i.e the difference between the desired acceleration and the actual acceleration) into a motor output. The 1:2 ratio of P to I (i.e. I is twice the size of P) should be maintained if you modify these parameters. These values should never be increased but for very powerful copters you may get better response by reducing both by 50% (i.e P to 0.5, I to 1.0).
Verifying AltHold performance with dataflash logs
Viewing the altitude hold performance is best done by downloading a dataflash log from your flight, then open it with the mission planner and graph the barometer altitude, desired altitude and inertial navigation based altitude estimate. This data is found in slight different columns depending upon the version and board.
APM running AC3.1: graph CTUN’s BarAlt (baro alt), WPAlt (desired altitude) and the GPS message’s RelAlt (inertial nav alt estimate)
APM running AC3.2 or Pixhawk running AC3.1 or AC3.2: CTUN’s BarAlt (baro alt), DAlt (desired alt) and Alt (inertial nav alt estimate)
The three should track well as shown below.
APM running AC3.1: graph CTUN’s BarAlt (baro alt), WPAlt (desired altitude) and the GPS message’s RelAlt (inertial nav alt estimate)
APM running AC3.2 or Pixhawk running AC3.1 or AC3.2: CTUN’s BarAlt (baro alt), DAlt (desired alt) and Alt (inertial nav alt estimate)
The three should track well as shown below.
Common Problems
- High vibrations can lead to the copter rapidly climbing as soon as altitude hold is engaged. Check the Measuring Vibration and Vibration Dampening wiki pages for details on how to measure and reduce vibrations.
- Copter slowly descends or climbs until the pilot retakes control in stabilize. Normally this is caused by not having the throttle stick in the mid position. This commonly happens when the pilot is switching into AltHold from a manual flight mode (like Stabilize) on a copter that does not hover at mid throttle. See the wiki page related to setting the mid throttle position.
- The motors seem to stop for a moment just as AltHold is engaged but then it soon recovers. This normally occurs when the pilot enters AltHold while climbing rapidly. The target altitude is set at the moment the pilot switches into alt hold but because the vehicle is rising quickly it flies above the target. The aggressive altitude hold controller then responds by momentarily reducing the motors to near minimum until the copter begins falling back to the target altitude. The workaround is to enter AltHold while the copter is flying at a stable altitude.
- Air pressure changes cause the vehicle to drift up or down by a couple of meters over longer period of time or for the altitude shown on the GCS to be inaccurate by a couple of meters including occasional negative altitudes (meaning altitudes below the home altitude).
- Momentary altitude loss of 1m ~ 2m when the copter levels out after a high speed forward flight. This is caused by an aerodynamic effect which leads to a momentary low pressure bubble forming on the top of the copter where the flight controller is mounted which leads the altitude hold controller to believe it is climbing so it responds by descending. There is no cure for this behaviour at the moment although increasing the INAV_TC_Z parameter to 7 (default is 5) reduces the effect but increases the change of Common Problem #1 listed above.
- Altitude hold becomes erratic when the vehicle is close to the ground or during landing. This can be caused by the barometer being affected by pressure changes created by prop-wash. The solution is to move the flight controller out of the prop wash effect or shield it within an appropriately ventilated enclosure.
- Sudden altitude changes caused by light striking the barometer. APM2.x sold after mid 2013 come with black tape on the inside of the case to protect against this.
Adequate Power
It is very important that the vehicle has enough power available. Without this the AltHold and attitude controllers can require more power than is available from one or more motors and will be forced to sacrifice some control which could lead to a loss of attitude or altitude.
Ideally the vehicle should be able to hover at about 50% throttle (mid stick) and anything higher than 70% is dangerous.
Warning: If you incorporate expo on your transmitter, that directly increases the size of the Alt Hold throttle dead band.
Ideally the vehicle should be able to hover at about 50% throttle (mid stick) and anything higher than 70% is dangerous.
Warning: If you incorporate expo on your transmitter, that directly increases the size of the Alt Hold throttle dead band.
Land Mode
LAND mode attempts to bring the copter straight down and has these features:
Descends to 10m (or until the sonar senses something below the copter) using the regular Altitude Hold controller which will descend at the speed held in the WPNAV_SPEED_DN parameter which can be modified on the Mission Planner’s Config/Tuning > ArduCopter Pids screen.
Below 10m the copter should descend at the rate specified in the LAND_SPEED parameter which defaults to 50cm/s.
Upon reaching the ground the copter will automatically shut-down the motors and disarm the copter if the pilot’s throttle is at minimum.
Note: APM:Copter will recognise that it has landed if the motors are at minimum but it’s climb rate remains between -20cm/s and +20cm/s for one second. It does not use the altitude to decide whether to shut off the motors except that the copter must also be below 10m above the home altitude.
If the copter appears to bounce or balloon back up a couple of times before settling down and turning the props off, try lowering the LAND_SPEED parameter a bit.
If the vehicle has GPS lock the landing controller will attempt to control it’s horizontal position but the pilot can adjust the target horizontal position just as in Loiter mode.
If the vehicle does not have GPS lock the horizontal control will be as in stabilize mode so the pilot can control the roll and pitch lean angle of the copter.
Warning! In any Alt Hold based mode including: Alt Hold, Loiter, Auto, AutoLand or RTL if your copters operation becomes erratic when you are close to the ground or landing (and also if any auto landing procedure results in bouncing or failure to turn off motors properly after landing) you probably have the fight controller situated such that it’s barometer (altimeter) is being affected by the pressure created by the copters prop-wash against the ground.
This is easily verified by looking at the Altimeter reading in your logs and seeing if it spikes or oscillates when near the ground.
If this is a problem, move the flight controller out of prop wash effect or shield it with an appropriately ventilated enclosure.
Success can be verified by flight test and by log results.
Note: APM:Copter will recognise that it has landed if the motors are at minimum but it’s climb rate remains between -20cm/s and +20cm/s for one second. It does not use the altitude to decide whether to shut off the motors except that the copter must also be below 10m above the home altitude.
If the copter appears to bounce or balloon back up a couple of times before settling down and turning the props off, try lowering the LAND_SPEED parameter a bit.
If the vehicle has GPS lock the landing controller will attempt to control it’s horizontal position but the pilot can adjust the target horizontal position just as in Loiter mode.
If the vehicle does not have GPS lock the horizontal control will be as in stabilize mode so the pilot can control the roll and pitch lean angle of the copter.
Warning! In any Alt Hold based mode including: Alt Hold, Loiter, Auto, AutoLand or RTL if your copters operation becomes erratic when you are close to the ground or landing (and also if any auto landing procedure results in bouncing or failure to turn off motors properly after landing) you probably have the fight controller situated such that it’s barometer (altimeter) is being affected by the pressure created by the copters prop-wash against the ground.
This is easily verified by looking at the Altimeter reading in your logs and seeing if it spikes or oscillates when near the ground.
If this is a problem, move the flight controller out of prop wash effect or shield it with an appropriately ventilated enclosure.
Success can be verified by flight test and by log results.
Stabilize Mode
Stabilize mode is APM:Copter’s most used manual flight mode. This page provides tips for flying in stabilize and methods for tuning your copter to fly optimally in stabilize mode.
Overview
Pilot’s roll and pitch input control the lean angle of the copter. When the pilot releases the roll and pitch sticks the vehicle automatically levels itself.
Pilot will need to regularly input roll and pitch commands to keep the vehicle in place as it is pushed around by the wind.
Pilot’s yaw input controls the rate of change of the heading. When the pilot releases the yaw stick the vehicle will maintain it’s current heading.
Pilot’s throttle input controls the average motor speed meaning that constant adjustment of the throttle is required to maintain altitude. If the pilot puts the throttle completely down the motors will go to their minimum rate (MOT_SPIN_ARMED) and if the vehicle is flying it will lose attitude control and tumble.
The throttle sent to the motors is automatically adjusted based on the tilt angle of the vehicle (i.e. increased as the vehicle tilts over more) to reduce the compensation the pilot must do as the vehicle’s attitude changes.
In AC3.0.1 and earlier versions the copter can only be armed in Stabilize or ACRO.
Warning: it is very important to master flying in stabilize before moving on to other flight modes and it is highly recommended that the pilot is always able to easily and rapidly switch back to stabilize mode from other flight modes in case of unexpected or undesirable flight behavior. .
Pilot will need to regularly input roll and pitch commands to keep the vehicle in place as it is pushed around by the wind.
Pilot’s yaw input controls the rate of change of the heading. When the pilot releases the yaw stick the vehicle will maintain it’s current heading.
Pilot’s throttle input controls the average motor speed meaning that constant adjustment of the throttle is required to maintain altitude. If the pilot puts the throttle completely down the motors will go to their minimum rate (MOT_SPIN_ARMED) and if the vehicle is flying it will lose attitude control and tumble.
The throttle sent to the motors is automatically adjusted based on the tilt angle of the vehicle (i.e. increased as the vehicle tilts over more) to reduce the compensation the pilot must do as the vehicle’s attitude changes.
In AC3.0.1 and earlier versions the copter can only be armed in Stabilize or ACRO.
Warning: it is very important to master flying in stabilize before moving on to other flight modes and it is highly recommended that the pilot is always able to easily and rapidly switch back to stabilize mode from other flight modes in case of unexpected or undesirable flight behavior. .
Tuning
ANGLE_MAX controls the maximum lean angle which by default is 4500 (i.e. 45 degrees)
ANGLE_RATE_MAX controls the maximum requested rotation rate in the roll and pitch aixs which by default is 18000 (180deg/sec).
ACRO_YAW_P controls how quickly copter rotates based on a pilot’s yaw input. The default of 4.5 commands a 200 deg/sec rate of rotation when the yaw stick is held fully left or right. Higher values will make it rotate more quickly.
Stabilize Roll/Pitch P controls the responsiveness of the copter’s roll and pitch to pilot input and errors between the desired and actual roll and pitch angles. The default of 4.5 will command a 4.5deg/sec rotation rate for each 1 degree of error in the angle.
The higher the P the faster the copter will be asked to turn to get to the desired angle.
A high P will cause the copter to oscillate back and forth like a seesaw a few times a second.
A low P will cause the copter to move very slowly. A very low P will cause the copter to feel unresponsive and could cause a crash if the wind disturbs it.
Rate Roll/Pitch P, I and D terms control the output to the motors based on the desired rotation rate from the upper Stabilize (i.e. angular) controller. These terms are generally related to the power-to-weight ratio of the copter with more powerful copters requiring lower rate PID values. For example a copter that accelerates very quickly might have Rate Roll/Pitch P number of 0.08 while a more sluggish copter might use 0.18.
Rate Roll/Pitch P is the single most important value to tune correctly for your copter.
The higher the P the higher the motor response to achieve the desired turn rate.
Default is P = 0.15 for standard Arducopter.
Rate Roll/Pitch I is used to compensate for outside forces that would make your copter not maintain the desired rate for a longer period of time.
A high I term will ramp quickly to hold the desired rate, and will ramp down quickly to avoid overshoot.
Rate Roll/Pitch D is used to dampen the response of the copter to accelerations toward the desired set point.
A high D can cause very unusual vibrations and a “memory” effect where the controls feel like they are slow or unresponsive.
Values as low as 0.001 and as high as .02 have all been used depending upon the vehicle.
See the AC2_attitude_PID for more detailed tuning information.
AC3.1 (and higher) includes AutoTune which may allow you to automatically determine the best Stabilize and Rate PID values.
ANGLE_RATE_MAX controls the maximum requested rotation rate in the roll and pitch aixs which by default is 18000 (180deg/sec).
ACRO_YAW_P controls how quickly copter rotates based on a pilot’s yaw input. The default of 4.5 commands a 200 deg/sec rate of rotation when the yaw stick is held fully left or right. Higher values will make it rotate more quickly.
Stabilize Roll/Pitch P controls the responsiveness of the copter’s roll and pitch to pilot input and errors between the desired and actual roll and pitch angles. The default of 4.5 will command a 4.5deg/sec rotation rate for each 1 degree of error in the angle.
The higher the P the faster the copter will be asked to turn to get to the desired angle.
A high P will cause the copter to oscillate back and forth like a seesaw a few times a second.
A low P will cause the copter to move very slowly. A very low P will cause the copter to feel unresponsive and could cause a crash if the wind disturbs it.
Rate Roll/Pitch P, I and D terms control the output to the motors based on the desired rotation rate from the upper Stabilize (i.e. angular) controller. These terms are generally related to the power-to-weight ratio of the copter with more powerful copters requiring lower rate PID values. For example a copter that accelerates very quickly might have Rate Roll/Pitch P number of 0.08 while a more sluggish copter might use 0.18.
Rate Roll/Pitch P is the single most important value to tune correctly for your copter.
The higher the P the higher the motor response to achieve the desired turn rate.
Default is P = 0.15 for standard Arducopter.
Rate Roll/Pitch I is used to compensate for outside forces that would make your copter not maintain the desired rate for a longer period of time.
A high I term will ramp quickly to hold the desired rate, and will ramp down quickly to avoid overshoot.
Rate Roll/Pitch D is used to dampen the response of the copter to accelerations toward the desired set point.
A high D can cause very unusual vibrations and a “memory” effect where the controls feel like they are slow or unresponsive.
Values as low as 0.001 and as high as .02 have all been used depending upon the vehicle.
See the AC2_attitude_PID for more detailed tuning information.
AC3.1 (and higher) includes AutoTune which may allow you to automatically determine the best Stabilize and Rate PID values.
Verifying performance with dataflash logs
Viewing the stabilize mode performance is best done by downloading a dataflash log from your flight, then open it with the mission planner and graph the ATT message’s Roll-In or DesRoll (pilot desired roll angle) vs Roll (actual roll) and Pitch-In or DesPitch (desired pitch angle) vs Pitch (actual pitch angle). These two should track well as shown below.
Common Problems
- new copter flips immediately upon take-off. This is usually caused by the motor order being incorrect or spinning in the wrong direction or using an incorrect propeller (clockwise vs counter-clockwise). Check the rc connections for your apm2 or pixhawk.
- copter wobbles on roll or pitch axis. This usually means the Rate P values are incorrect. See Tuning section above for some hints as to how to adjust these gains.
- copter wobbles when descending quickly. This is caused by the copter falling through it’s own props wash and is nearly impossible to tune out although raising the Rate Roll/Pitch P values may help.
- copter yaw right or left 15degrees on take-off. Some motors may not be straight or the ESCs have not been calibrated.
- copter always tends to fly in one direction even in a windless environment. Try SaveTrim or AutoTrim to level the copter.
- copter does not maintain altitude or does not stay perfectly still in the air. As mentioned above this is a manual flight mode and requires constant control of the sticks to maintain altitude and position.
- occasional twitches in roll or pitch. Normally caused by some kind of interference on the receiver (for example FPV equipment placed too close to the receiver) or by ESC problems that may be resolved by calibrating them.
- sudden flips during flight. This is nearly always caused by mechanical failures of the motor or ESCs.
All flight mode information refer to ArduCopter