Gazebo 11 with ardupilot plugin vs NED

Hi, sorry for a stupid question, but I have just found out that ardupilot and gazebo use different oerientation systems. How can I sync those? It seems like my drone is turned by 90 degs in gazebo world and on the maps in Qground control?
My version of iris sdf file contains following lines
0 0 0 3.141593 0 0
0 0 0 3.141593 0 0
And I have noticed the same lines here are different in yaw value
0 0 0 3.141593 0 0
0 0 0 3.141593 0 1.57079632
Can this do the trick?
or How does the conversion work here?

Hello @LukasBrno. There are two transforms needed to convert between the frame conventions used in Gazebo and ArduPilot.

  1. Rotation of body frame from FLU in Gazebo to FRD in ArduPilot
  2. Rotation of world frame from ENU in Gazebo to NED in ArduPilot

The examples with the plugin have had missing rotation in the world mapping for some time - this only becomes apparent when aligning world maps in Gazebo and ArduPilot (with your choice of GCS) when an absolute world position is given, by say a NavSat sensor.

This PR: Models: correct transform from ENU to NED by srmainwaring · Pull Request #59 · ArduPilot/ardupilot_gazebo · GitHub has the corrected version for the most recent version of the plugin, but the same applies for the Gazebo 11 version. As you note, there should be an additional rotation about z to map the world frames from ENU to NED.

To have a vehicle in Gazebo initialised with a heading of 0 deg (north), it should be initially aligned with the Gazebo world positive y-axis. i.e. the initial pose would be

<pose degrees="true">0 0 0 0 0 90</pose>
1 Like

Hi @rhys , thank you very much for your reply. I have just tested it and it works perfectly :slight_smile:
Lukas

1 Like

Hi @rhys , once again. So this is also the reason why there is a rotation in runway sdf file? Models: correct transform from ENU to NED by srmainwaring · Pull Request #59 · ArduPilot/ardupilot_gazebo · GitHub
Just to make it aligned with the real world? So in my case when I am on the map and I have building model like this

I should be fine? because I have gazebo X heading to the east so drone starts with heading to the east.

That’s right - if you want the drone to initially have a heading of 90 deg in NED (ArduPilot) then it has an initial pose of 0 deg in ENU (Gazebo).

Ok, I was wondering why my drone was heading to west in my world and it shown that my world plane model was 40 cm under the gazebo 0s, so when my drone was inserted by gz command it bounced and turned upside down.
Sorry for stupid questions and thank you very much for help. Lukas