Let's add a copy of the "maze" world, called maze_with_charger.sdf to our "worlds" folder. Our docking station is just a cube with an image (the marker) on its side:
To place a small aruco marker on ONE side of a larger object, we are supposed to use textures, and not just textures, but ones using a mesh file, that can be created in a 3rd party program, such as Blender. This is not very convenient, so I am going to cheat. I am going to create a large 0.5x0.5x1 m "docking station", and place a smaller 0.2x0.2x0.01 m object on its side. The aruco marker is going to be applied as a texture (from .PNG file) to a smaller object, as we do not use meshes, the texture is going to be repeated on each side of the object, but... But we don't care, as only one side of the object is visible from outside (think of it as of sheet of paper attached to a docking station).
Here is the corresponding part of a maze_with_charger.world file (a complete project can be downloaded by the link above):
As the way SDF works with textures is a bit counterintuitive, let's walk through the code above.
First of all, we create a model, two "cubes" joined together, so we can move them together as well:
Then we have a larger object, which is the body of our "charging station":
Next is a smaller object: "sheet of paper" with aruco marker on it:
Note the following section, it defines textures:
We now have new files (and folders) in our project:
And as ROS2 is never easy, we also have to make corresponding changes in CMakeLists.txt:
... in package.xml:
Generally, the idea is to let the system know that we have a models folder, so we can use
There is also a file:// syntax, but no mater what I did, I wans't able to make it work.
The last line of the model can be used if you want to "move" your docking station around: