<p>A barometer and GPS are fairly low resolution (and noisy) methods for determining height and position respectively. As you've observed.</p>
<p>There are two other common methods for measuring height above the ground and position that, while they have limitations, give you much more precision. Sonar for height and optical flow for position. These are usually used in combination with the Barometer and GPS to provide the stability you find in DJI's products.</p>
<p>This higher precision mode will typically only work near the ground because of the range limitations of sonar. Since this is where you need the most stability however, it ends up working really well, allowing the less precise sensors to take over when you are farther away from obstacles.</p>
<p>Optical flow is the combination of downward facing cameras with software that takes the attitude and height of the craft into account and provides a relative movement of the craft. It will suffer in low light or when flying over reflective surfaces (like water).</p>
<p>You can add these sensors to ardupilot. They are relatively expensive compared to a barometer and gps, but should provide a similar level of stability when properly tuned.</p>

CC BY-SA 4.0
2021-08-04T17:01:54.873Z
Thanks for the info! Interestingly: I built another quad with a Matek running iNav with a single GPS+BAR, and it is way more solid in POSHOLD compared to PX4. I also tried Ardupilot on the PixHawk4 Mini and it is even worse than PX4. I'm really surprised by the different behavior of GPS+BAR+POSHOLD across different FC firmware and hardware. A little frustrating, but informative study. Hopefully after I spend a year learning I'll have a better idea why.
Freeman
CC BY-SA 4.0
2021-08-05T18:24:51.493Z
@PeterT Nice! I would imagine it's more down to placement or any casing of the barometer and GPS. Since barometers are measuring pressure they can be pretty sensitive to propwash moving around them in addition to being light sensitive. A newer GPS also might support some of the other satellite systems to to make it more accurate.
ipaq3115
CC BY-SA 4.0
2021-08-10T02:20:11.733Z
Pretty sure the DJI Mini's also got an IMU (accelerometer and angular accelerometer).  An IMU will tend to drift over time, but for dealing with short-term deviations (eg. a gust of wind), it's incredibly effective.
Mark
CC BY-SA 4.0
2021-08-10T20:07:13.267Z
@Mark of course, these days you can't really have a quadcopter without an IMU at it's heart. The IMU serves a different purpose though. It's all about maintaining the commanded attitude whereas the GPS/Optical flow tell you which direction you'll need to set the attitude to counteract the wind blowing you away.
ipaq3115
CC BY-SA 4.0
2021-08-04T15:16:13.357Z
2021-08-04T15:16:13.357Z
ipaq3115
<p>About a year ago I started building my own drones. I've settled into Betaflight for FPV and PX4 for photography. I've never used a &quot;real&quot; off-the-shelf drone, being a DIY'er. Recently I saw a Mavic Mini in action and its hover stability was insane. My primary two drones use a JBardwell F7 flight controller (no barometer or GPS, 7&quot; frame with 7040 props, 2806's), and a PixHawk4 Mini (GPS, barometer on a X500 frame with 1045 props, 2216's), both 4S. I realize my FPV build is specifically for that, but I would have expected PX4 to be on par with DJI since the baro and GPS.</p>
<p>In hold mode my PX4 floats around about 1m sphere outdoor in no wind, but the DJI is eerliy rock-solid.</p>
<p>Is this due to my build (parts, tuning, other) or is DJI flight control software just that badass? I don't have a mentor or a club near by with folks I can ask Qs or test builds, I'm just wingin' it based on the web.</p>

<flight-controller><betaflight><dji-mavic-mini><px4>
Hover stability: PX4 vs. DJI Mavic Mini
Freeman
# Hover stability: PX4 vs. DJI Mavic Mini

(Asked by: username_0 on 2021-07-15)

About a year ago I started building my own drones. I've settled into Betaflight for FPV and PX4 for photography. I've never used a "real" off-the-shelf drone, being a DIY'er. Recently I saw a Mavic Mini in action and its hover stability was insane. My primary two drones use a JBardwell F7 flight controller (no barometer or GPS, 7" frame with 7040 props, 2806's), and a PixHawk4 Mini (GPS, barometer on a X500 frame with 1045 props, 2216's), both 4S. I realize my FPV build is specifically for that, but I would have expected PX4 to be on par with DJI since the baro and GPS.

In hold mode my PX4 floats around about 1m sphere outdoor in no wind, but the DJI is eerliy rock-solid.

Is this due to my build (parts, tuning, other) or is DJI flight control software just that badass? I don't have a mentor or a club near by with folks I can ask Qs or test builds, I'm just wingin' it based on the web.

**Tags:** flight-controller, betaflight, dji-mavic-mini, px4

---

## 1 answers

### Answer by username_1 on 2021-08-04. Score: 5 | Accepted answer

A barometer and GPS are fairly low resolution (and noisy) methods for determining height and position respectively. As you've observed.

There are two other common methods for measuring height above the ground and position that, while they have limitations, give you much more precision. Sonar for height and optical flow for position. These are usually used in combination with the Barometer and GPS to provide the stability you find in DJI's products.

This higher precision mode will typically only work near the ground because of the range limitations of sonar. Since this is where you need the most stability however, it ends up working really well, allowing the less precise sensors to take over when you are farther away from obstacles.

Optical flow is the combination of downward facing cameras with software that takes the attitude and height of the craft into account and provides a relative movement of the craft. It will suffer in low light or when flying over reflective surfaces (like water).

You can add these sensors to ardupilot. They are relatively expensive compared to a barometer and gps, but should provide a similar level of stability when properly tuned.

> **Comments:**
> **username_0**: Thanks for the info! Interestingly: I built another quad with a Matek running iNav with a single GPS+BAR, and it is way more solid in POSHOLD compared to PX4. I also tried Ardupilot on the PixHawk4 Mini and it is even worse than PX4. I'm really surprised by the different behavior of GPS+BAR+POSHOLD across different FC firmware and hardware. A little frustrating, but informative study. Hopefully after I spend a year learning I'll have a better idea why.  
> **username_1**: @PeterT Nice! I would imagine it's more down to placement or any casing of the barometer and GPS. Since barometers are measuring pressure they can be pretty sensitive to propwash moving around them in addition to being light sensitive. A newer GPS also might support some of the other satellite systems to to make it more accurate.  
> **username_2**: Pretty sure the DJI Mini's also got an IMU (accelerometer and angular accelerometer).  An IMU will tend to drift over time, but for dealing with short-term deviations (eg. a gust of wind), it's incredibly effective.  
> **username_1**: @Mark of course, these days you can't really have a quadcopter without an IMU at it's heart. The IMU serves a different purpose though. It's all about maintaining the commanded attitude whereas the GPS/Optical flow tell you which direction you'll need to set the attitude to counteract the wind blowing you away.  

---

