Visuals
Visuals¶
The <visual>
element specifies the shape of the geometry for rendering. It is a child element from <link>
and a link can have multiple visual elements.
# Import the element creator from pcg_gazebo.parsers.urdf import create_urdf_element
# The visual element is created with an empty geometry by default visual = create_urdf_element('visual') print(visual)
<visual name="visual"> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <box size="0 0 0"/> </geometry> </visual>
# Setting the parameters for the visual element visual.origin.xyz = [1, 0, 1] visual.origin.rpy = [0.2, 0, 0.6] print(visual)
<visual name="visual"> <origin rpy="0.2 0 0.6" xyz="1 0 1"/> <geometry> <box size="0 0 0"/> </geometry> </visual>
# Setting different geometries to the visual element visual.geometry.box = create_urdf_element('box') print(visual)
<visual name="visual"> <origin rpy="0.2 0 0.6" xyz="1 0 1"/> <geometry> <box size="0 0 0"/> </geometry> </visual>
visual.geometry.sphere = create_urdf_element('sphere') print(visual)
<visual name="visual"> <origin rpy="0.2 0 0.6" xyz="1 0 1"/> <geometry> <sphere radius="0"/> </geometry> </visual>
visual.geometry.cylinder = create_urdf_element('cylinder') print(visual)
<visual name="visual"> <origin rpy="0.2 0 0.6" xyz="1 0 1"/> <geometry> <cylinder length="0" radius="0"/> </geometry> </visual>
visual.geometry.mesh = create_urdf_element('mesh') print(visual)
<visual name="visual"> <origin rpy="0.2 0 0.6" xyz="1 0 1"/> <geometry> <mesh filename=""/> </geometry> </visual>