North East Down (NED) gazebo frame
Hi,
I am interested in having a North-East-Down inertial frame in Gazebo. AFAIK this is not possible by just setting an option, and this question remains unanswered.
As a workaround I was trying to flip the camera 180 deg around its X axis and spawn objects in negative Z, but whenever they are below the ground plane they are switched to the positive Z in the next iteration. I tried flipping 180 deg also the ground plane but still the same behavior. Also, the camera gets moved to a "normal"position whenever I try to move it (zoom works OK though, and FPS camera kind of work as well).
Can anybody give me some advice on how to achieve this? Thank you!
EDIT: I added the world I am using to test, contains a cylinder, a inverted gravity and cameras, and a ground plane also rotated (in case it makes any difference, because the same behavior is noticed without flipping the ground plane.
<?xml version="1.0" ?>
<sdf version="1.5">
<world name="test_world">
<physics type="ode">
<gravity>0.0 0.0 9.81</gravity>
<ode>
<solver>
<type>quick</type>
<iters>50</iters>
<sor>0.8</sor>
</solver>
</ode>
<real_time_update_rate>1000</real_time_update_rate>
<max_step_size>0.001</max_step_size>
</physics>
<gui>
<camera name="user_camera">
<pose>1 0 -1 3.141592 0 0</pose>
</camera>
</gui>
<model name='unit_cylinder_1'>
<pose>0 0 -1.5 0 0 0</pose>
<link name='link'>
<inertial>
<mass>1</mass>
<inertia>
<ixx>1</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>1</iyy>
<iyz>0</iyz>
<izz>1</izz>
</inertia>
</inertial>
<collision name='collision'>
<geometry>
<cylinder>
<radius>0.5</radius>
<length>1</length>
</cylinder>
</geometry>
<max_contacts>10</max_contacts>
</collision>
<visual name='visual'>
<geometry>
<cylinder>
<radius>0.5</radius>
<length>1</length>
</cylinder>
</geometry>
<material>
<script>
<uri>file://media/materials/scripts/gazebo.material</uri>
<name>Gazebo/Grey</name>
</script>
</material>
</visual>
<self_collide>0</self_collide>
<kinematic>0</kinematic>
</link>
</model>
<include>
<pose>0 0 0 3.141592 0 0</pose>
<uri>model://ground_plane</uri>
</include>
</world>
Asked by Javi V on 2016-01-20 12:40:23 UTC
Answers
Can you describe what your goal is, or what type of output you're trying to simulate? There might be an alternative way to achieve your goal without trying to alter Gazebo's reference frames.
Asked by nkoenig on 2016-01-21 10:14:03 UTC
Comments
I am trying to set my simulation using North-East-Down frame, what I am trying to achieve is simply: http://answers.gazebosim.org/question/4514/gazebo-reference-frame-with-z-pointing-downward/?answer=12404#post-id-12404 which you already replied :)
Asked by Javi V on 2016-01-22 10:22:32 UTC
Can you describe the high level goal of the project? For example: "I want to simulate a airplane", and describe the constraints.
Asked by nkoenig on 2016-01-22 10:33:39 UTC
NED frames are common for outdoor applications. In my case, I want to simulate UAVs. Which kind of constraints you mean?
Asked by Javi V on 2016-01-22 10:49:09 UTC
It might be possible to have a gazebo plugin act as a middleman to transform frames for you. Do you have a controller that expects a certain frame? Do you need images in a certain frame? Be as descriptive of your whole problem as possible.
Asked by nkoenig on 2016-01-22 10:52:49 UTC
Basically, everything will operate in this NED frame. That means that state estimation and control is done in this frame, camera and sensor inputs are mostly related to the corresponding robot link which is also expressed in the NED frame. Basically, just a full autonomous navigation setup for outdoor UAVs.
Asked by Javi V on 2016-01-22 11:01:45 UTC
Thanks, it sounds like you have a few options: 1) create some kind of filter that converts between NED frames and gazebo frames, 2) Don't use NED, 3) Don't use Gazebo. Changing the default Gazebo frame will be extremely difficult.
Asked by nkoenig on 2016-01-22 21:29:24 UTC
If I understood right, is this just a matter of flipping gravity? I might not be fully understanding the question.
I feel like the example world in the question should be supported, but there seems to be a problem related to the ground plane. I changed the ground to be a box geometry instead and got some sort of world working:
https://www.youtube.com/watch?v=kHPKwevgw_c
Without a plane, the physics seems to work ok. But the GUI is not ready to be used upside-down.
<?xml version="1.0" ?>
<sdf version="1.5">
<world name="test_world">
<physics type="ode">
<gravity>0.0 0.0 9.81</gravity>
</physics>
<gui>
<camera name="user_camera">
<pose>-4.7 0 -1.6 3.141592 0 0</pose>
</camera>
</gui>
<light type="directional" name="sun">
<cast_shadows>true</cast_shadows>
<pose>0 0 10 3.14 0 0</pose>
<diffuse>0.8 0.8 0.8 1</diffuse>
<specular>0.2 0.2 0.2 1</specular>
<attenuation>
<range>1000</range>
<constant>0.9</constant>
<linear>0.01</linear>
<quadratic>0.001</quadratic>
</attenuation>
<direction>-0.5 0.1 -0.9</direction>
</light>
<model name='unit_cylinder_1'>
<pose>0 0 -1.5 0 0 0</pose>
<link name='link'>
<collision name='collision'>
<geometry>
<cylinder>
<radius>0.5</radius>
<length>1</length>
</cylinder>
</geometry>
</collision>
<visual name='visual'>
<geometry>
<cylinder>
<radius>0.5</radius>
<length>1</length>
</cylinder>
</geometry>
</visual>
</link>
</model>
<model name='ground_box'>
<static>1</static>
<link name='link'>
<collision name='collision'>
<geometry>
<box>
<size>100 100 1</size>
</box>
</geometry>
</collision>
<visual name='visual'>
<geometry>
<box>
<size>100 100 1</size>
</box>
</geometry>
</visual>
</link>
</model>
</world>
</sdf>
Asked by chapulina on 2016-01-22 21:49:50 UTC
Comments
@chapulina It is not only switching gravity. This would be just a workaround. Gravity switch is just a rotation about 180deg around X axis, while the actual transformation would be from East-North-Up to North-East-Down (180 deg around X and 90 around Z) and this would crete some problems if we really depend on the Earth model (WGS84 in Gazebo). Furthermore, in your video you have the same problem as me: the camera is not behaving OK.
Asked by Javi V on 2016-01-25 03:30:46 UTC
Oh I see... Then I guess the only remaining options are the ones listed by @nkoenig on the other answer...
Asked by chapulina on 2016-01-25 03:48:17 UTC
Thank you so much for looking into this anyway. It is interesting that with the box instead of the ground plane the physics work.
Asked by Javi V on 2016-01-25 08:36:49 UTC
No problem, I got really intrigued as to why your example world behaved weirdly. It looks like the ground plane is more like a collision half-space than a thin collision layer.
Asked by chapulina on 2016-01-25 16:29:32 UTC
@chapulina yes, that is what I thought. But the weirdest thing for me is that the behavior does not change if you rotate the ground plane 180deg around X.
Asked by Javi V on 2016-01-26 02:54:22 UTC
Comments
It's possible that a lot of logic in Gazebo assumes the Z axis is pointing up. Maybe you could ticket an issue in the issue tracker? It might also help if you share the world that you've created and behaves weird.
Asked by chapulina on 2016-01-20 13:04:44 UTC