Display Images on Cube Faces

asked 2018-05-01 02:44:52 -0500

GuillaumeHauss gravatar image

updated 2018-05-01 12:20:45 -0500

Hi all, I'm using Aruco markers to localize my robot in its environment. I've set up models for each aruco marker, and use a PNG file as texture.

However, it seems there is a "bug" in the display. When looking forward to the aruco, the image is displayed correctly. (see first image). And when I go behind the marker, the image is inverted, like a central symmetry (see second image).

Why is that? Do I need to specify the texture for each face of the cube in the aruco model? If yes, how do I do that?

Thank you very much for your help !

First image image description

Second image image description

EDIT Here is my material file

material ArucoVisualMarker0/Marker
{
    technique
    {
    pass
    {
        texture_unit
        {
            texture aruco_mark_0.png
        }
    }
    }
}

and here is my model.sdf file.

<?xml version='1.0'?>
<sdf version='1.5'>
    <model name='aruco_visual_marker_0'>
     <pose>0 0 0 0 0 0</pose>
         <link name='marker'>
     <pose frame=''>0 0 0 0 0 3.14</pose>
      <visual name='visual'>
          <geometry>
               <box>
                    <size>0.3 0.3 1e-05</size>
               </box>
          </geometry>
          <material>
              <script>
                  <uri>model://aruco_visual_marker_0/materials/scripts</uri>
                  <uri>model://aruco_visual_marker_0/materials/textures</uri>
                  <name>ArucoVisualMarker0/Marker</name>
              </script>
       <a mbient>1 1 1 1</ambient>
       <diffuse>1 1 1 1</diffuse>
       <specular>0 0 0 1</specular>
       <emissive>1 1 1 0</emissive>
       <shader type='vertex'>
         <normal_map>__default__</normal_map>
       </shader>
     </material>
     <pose frame=''>0 0 0 0 0 0</pose>
     <cast_shadows>1</cast_shadows>
     <transparency>0</transparency>
   </visual>
   <collision name='collision'>
     <laser_retro>0</laser_retro>
     <max_contacts>10</max_contacts>
     <pose frame=''>0 0 0 0 0 0</pose>
         <geometry>
           <box>
            <size>0.3 0.3 1e-05</size>
          </box>
        </geometry>
        </collision>
     </link>
     <static>1</static>
     <allow_auto_disable>1</allow_auto_disable>
   </model>
  </sdf>
edit retag flag offensive close merge delete

Comments

Would you mind posting the model/materials for the aruco marker? Is this using an ogre material, or a material from a collada file, or something else?

sloretz gravatar imagesloretz ( 2018-05-01 11:58:43 -0500 )edit

If using an Ogre material, I think that having the plane along the XZ (or YZ) plane instead of the XY plane as shown on the screenshots may solve the issue. Take a look at the `Textured shapes` model for an example.

chapulina gravatar imagechapulina ( 2018-05-01 12:16:52 -0500 )edit