Example - Creating the Nimbro-OS for usage in simspark-simulation

In this example we will construct the Nimbro-OS for the simspark simulation. Therefore we will create OBJ-files for the appearance and use the RSGCreator to write the rsg-files. The Nimbro-OS robot is created by the University of Bonn and all rights stay with them (http://www.nimbro.net/OP/). We start with creating the OBJ-files.

The appearance

The obj-files are made with the help of the CAD-files of the robot, provided by the University Bonn (https://github.com/NimbRo/nimbro-op). We use FreeCAD (https://sourceforge.net/projects/free-cad/) to convert the CAD-files to the OBJ-format, clean and reduce the so generated meshes in MeshLab (http://meshlab.sourceforge.net/) and assemble the robot in Blender (http://www.blender.org/) as described in the OBJ-section [OBJ-Files]. Then we add simple cubes for the motors (MX-64 and MX-106).


We use the fully assembled robot in Blender to determine which bodyparts should have which sizes, positions and forms in the physic simulation of simspark. Therefore we create a second scene and copy the model of the robot to it. To do this we select all objects and make a link to the other scene (Object -> Make Links -> Objects to Scene -> select the scene or make a full copy of the existing scene while creating the new one) and remove the link afterwards in the original scene by making the objects single user again (Object -> Make Single User -> Object). In this new scene we now create primitives (cube, sphere or capsule - one for each bodypart) that are close to bounding volumes to the detailed robot bodyparts. Their form, size and position we can use in the construction of the rsg-files.
For the next steps its important, that the AgentAspect-Bodypart (in this case the torso) is in the origin with all other bodypart correctly "attached" to it. The separated bodyparts will be translated so that their bounding volumes is in the origin (the bounding volume center is the position we will giving each bodypart in the rsg files). We first make a new scene with a full copy of the current one or the bounding volumes and when we finish these another full copy for the separated bodyparts. The separated bodyparts are be each in a own layer ("m" to move objects to another layer). With the bounding-volumes-scene we measure the translation of each bodypart to the torso (Location X, Y, Z translation as seen in the Properties-View ("n"-key)) as well as their sizes (Dimensions). While doing that we also measure the position of the different joints. The joints will always between two bodyparts and their position will be set with the anchor-values. These values are the relative translation to the bodypart the joint is defined in.
The so separated Blender-file can be downloaded from the files section (https://sourceforge.net/projects/rsgcreator/files/Example/) (with the scenes: Detail, Reduced, Bounding Volumes and Separated).
With these values we create the rsg-files in RSGCreator as described in the next section.

Creating the RSG-Files in RSGCreator

We use the existing rcssserver directory and create a new folder in the "rcsserver3d/rsg/agent/" or use a temporary directory before we move the robot to the correct path and create therefore a folder structure with something like "nimbro-rsg/rsg/agent/nimbro" as well as "nimbo-rsg/models" and "nimbro-rsg/materials". In both cases permissions for read/write actions should be set for these folders. We then copy the .obj-files to the "models" folder and the .mtl-files to the "materials" folder.
We start up RSGCreator and go to "File -> New Robot". While creating the new robot RSGCreator also creates the first bodypart and agentaspect. In the case of Nimbro this is the torso. We set names and values for the new robot, the appearance and the physic.


As the materials of nimbro have a lot plain black parts (the carbon) we switch the background to white to see them better ("View -> Switch Backgroundcolor" or rightclick in the 3D-View and "Switch Backgroundcolor"). Now the rsg file for nimbro is created and the first bodypart and agentaspect is visible.


Now we start adding bodyparts to the rsg files. First we add the legs and start with the hips, we go to "Add -> Add Bodypart" and fill it out as seen in the next images. Note that in the rsg-format bodyparts must be added in the right order for the joints to work, meaning that the bodypart the joint connects to needs to exist already (so hip before thigh, thigh before knee and so on). Instead of static values we could also define variables before through "Add -> Add Variable" and then using their name in the corresponding field (e.g. "$thighMass" in the mass field after adding this variable).
We go on like that and construct the rest of the leg parts. The foot has a force resistance perceptor.


Adding the new robot to rcssagent3d

As the nimbro-roboter has different joints than the neony we want a own basic-behavior for him. Therefore we need to generate new behavior files in simspark/trunk/rcssserver3d/rcssagent3d. We can simply copy naobehavior.h and .cpp and change all occurring "nao" to "nimbro" in the code as well the filename. Then we need to add these two files to the CMakeLists.txt and the main.cpp in the same folder. In the main.cpp you can either exchange the includes and usages of naobehavior with the nimbrobehavior or leave both inside and let some kind of input (e.g. console input) decide which robot the simulator shall use. After rebuilding and installing the rcssserver these changes will be done and we can start the nimbro.rsg file. If you want the models, materials, textures and rsgfiles to be installed while make, make install as well, you need to add these to the simspark/trunk/rcssserver3d/data subfolders.
The new behavior files can then be used as basis for the ai-programing as before for the nao and soccerbot.

The final result in the simspark-simulation looks like this


If the new robot has a different size than the nao-robot, there might be the problem that it is beamed partially into the ground (and therefore collids with the ground and jumps or breaks). In this case you may need to look into "simspark/trunk/rcssserver3d/plugin/soccor/beameffector/beameffector.cpp" and the "pos[2]" defintion.

The complete nimbro-rsg-files together with the .obj- and .mat-files can be found under https://sourceforge.net/projects/rsgcreator/files/Example/RSG-Files/.

Mixed Teams

If you want to use teams with different robots instead of just one type of robot per team you need to change the teamname in the behavior-file. The line containing "(init (unum 0) (teamname ...))" where ... is the current teamname needs to be changed to a the same teamname for all robots that shall play together (e.g. "MixedRobots").


Wiki: Home
Wiki: OBJ-Files