# Differences between simulation and real drone

**URL:** <https://discuss.px4.io/t/differences-between-simulation-and-real-drone/29923>\
**Category:** PX4 Autopilot\
**Created:** [November 29, 2022, 1:07pm UTC](https://discuss.px4.io/t/differences-between-simulation-and-real-drone/29923 "2022-11-29T13:07:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![salmarc](https://discuss.px4.io/user_avatar/discuss.px4.io/salmarc/32/10894_2.png) [@salmarc](https://discuss.px4.io/u/salmarc)\
**Post date:** [November 29, 2022, 1:07pm UTC](https://discuss.px4.io/t/differences-between-simulation-and-real-drone/29923/1 "2022-11-29T13:07:53Z")

</div>

Hi guys,  
I have customized the firmware to add the control of tilting multirotors, like voliro [https://youtu.be/Sgd0i87r9-0](https://youtu.be/Sgd0i87r9-0) and this one [https://youtu.be/tZ\_93HusKnI](https://youtu.be/tZ_93HusKnI).  
I have created the simulator in Gazebo for both types and it works in different flight modes (tested in stabilized, altitude, position, mission and offboard). This is an example of a simulation of a flight in position flight mode ([Flight Review](https://review.px4.io/plot_app?log=c323d9f3-d3ce-48ff-8160-bfc686f10f26)).  
Today we tested the firmware on the real drones (the same kinematic as the simulated ones) but I had a strange behavior:

1. both drones fly really well in stabilized
2. when i switch to altitude, the drone like voliro has a problem with the yaw. Specifically, it always rotates only in one direction independently from  
the value of the stick. This is strange because it works fine in stabilized. Does the altitude flight mode change something on the yaw control?
3. In position flight mode, both drones have problems staying still in hovering and subsequently diverging toward some directions. Even while diverging, if I try to correct the position with the radio controller, the drone follows the right direction but when I release the sticks, it goes around (sometimes also increasing the velocity). Moreover, it has the same problem on the yaw as in altitude (so I’m thinking that could be a problem of the allocation matrix, but it’s strange that this problem is not present in stabilized mode). This is a log from one of today’s experiments, where we used the Optitrack motion capture system for the position feedback ([Flight Review](https://review.px4.io/plot_app?log=2659558f-4152-4cbb-a466-4a8848b12c26)).  
In the end, I add that these drones fly well with the normal standard firmware, so the problem must be in my customization.  
Do you see something in the logs that I’m missing?

---

<div class="post-metadata">

**Author:** ![junwoo0914](https://discuss.px4.io/user_avatar/discuss.px4.io/junwoo0914/32/12312_2.png) [@junwoo0914](https://discuss.px4.io/u/junwoo0914)\
**Post date:** [December 1, 2022, 11:45pm UTC](https://discuss.px4.io/t/differences-between-simulation-and-real-drone/29923/2 "2022-12-01T23:45:14Z")

</div>

Regarding point 2, yes the altitude mode does affect yaw control (compared to stabilized)!

I know this is super unintuitive as well, but at least it is explained here: [Discord](https://discord.com/channels/1022170275984457759/1031649249450020945/1031865454861484052)

I got to learn about this while tuning a quad, where I experienced yawing (like you observed) as soon as I switched to altitude mode!

---

<div class="post-metadata">

**Author:** ![salmarc](https://discuss.px4.io/user_avatar/discuss.px4.io/salmarc/32/10894_2.png) [@salmarc](https://discuss.px4.io/u/salmarc)\
**Post date:** [December 2, 2022, 12:03am UTC](https://discuss.px4.io/t/differences-between-simulation-and-real-drone/29923/3 "2022-12-02T00:03:10Z")

</div>

@junwoo0914 thank you very much. Then the problem with the yaw can be also related to the feedback.  
Do you have any thought about the third problem?

---

<div class="post-metadata">

**Author:** ![junwoo0914](https://discuss.px4.io/user_avatar/discuss.px4.io/junwoo0914/32/12312_2.png) [@junwoo0914](https://discuss.px4.io/u/junwoo0914)\
**Post date:** [December 2, 2022, 12:17am UTC](https://discuss.px4.io/t/differences-between-simulation-and-real-drone/29923/4 "2022-12-02T00:17:51Z")

</div>

> [@salmarc](#):
>
> I add that these drones fly well with the normal standard firmware

What do you mean? Do you have a log with that?

Also it would be nice to know how your custom controller is different (is it still using MPC parameters for position controller? Etc)
