Gazebo 9.0 restricts a cylinder's radius parameter's fractional part to two digits
I have a model which includes a cylinder, and I gave the radius 0.025
and the length 0.4
. And I'm including this model in my world file.
However, in the sim, when I click on this link, it's radius is becoming 0.03
. There's some rounding going on which I don't understand. I tried giving 0.02
and it spawns as 0.02
successfully. Also tried 0.025000
but no luck. Then I realized that it only has two digits after the comma (comma is my local standard to show floating point numbers):
Here's the link:
<link name='link_0'>
<inertial>
<mass>0.1</mass>
<inertia>
<ixx>0.00404688</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>0.00404688</iyy>
<iyz>0</iyz>
<izz>9.375e-05</izz>
</inertia>
<pose frame=''>0 0 0 0 -0 0</pose>
</inertial>
<pose frame=''>0 0 0 0 -0 0</pose>
<gravity>1</gravity>
<self_collide>0</self_collide>
<kinematic>0</kinematic>
<enable_wind>0</enable_wind>
<visual name='visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<cylinder>
<radius>0.025</radius>
<length>0.4</length>
</cylinder>
</geometry>
<material>
<lighting>1</lighting>
<script>
<uri>file://media/materials/scripts/gazebo.material</uri>
<name>Gazebo/White</name>
</script>
<shader type='vertex'>
<normal_map>__default__</normal_map>
</shader>
<ambient>1 1 1 1</ambient>
<diffuse>1 1 1 1</diffuse>
<specular>0.01 0.01 0.01 1</specular>
<emissive>0 0 0 1</emissive>
</material>
<transparency>0</transparency>
<cast_shadows>1</cast_shadows>
<laser_retro>200</laser_retro>
</visual>
<collision name='collision'>
<laser_retro>0</laser_retro>
<max_contacts>10</max_contacts>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<cylinder>
<radius>0.025</radius>
<length>0.4</length>
</cylinder>
</geometry>
</collision>
</link>
It might be that the round occurs only in the GUI for displaying information while Gazebo keeps the original value with all the decimals for all the computations. What is the out of: gz model -i -m <model_name> | grep radius?
It outputs
0.025
values. I was thinking that it might be like that yesterday, because my ROS navigation map resolution is 0.05 and in RViz, the laser reading was showing my model within a single 5cm x 5cm pixel. But I wasn't sure since the difference between rounded and non-rounded values in this resolution isn't so big.Does this mean that the value is correct and the GUI just shows the rounded for e.g. performance related stuff? I also tried exporting a single STL file of a cylinder with same specs from SolidWorks and in the GUI, it was showing up exactly like the
0.03
cylinder. Compared both to the0.02
cylinder and the difference was observable in the GUI.I was unable to find the source code that demonstrate the hypothesis but if the gz tool displays the correct value my impression is that the value is right and the GUI just round it. Makes little sense to me to lost precision for computational operations in the simulator.