Skip to content

Adding new 3d Meshes

Vanessa Hassouna edited this page Aug 10, 2023 · 2 revisions

When integrating a 3D mesh into the bullet world, there are several crucial steps and considerations to ensure correct placement and representation.

1. Initial Mesh Preparation:

  • Software Recommendation: Before adding a 3D mesh, it's recommended to open the object in a 3D software like Blender. This allows you to adjust various parameters accurately.

  • Rotation: While in Blender, take note of the Right-Handed 3D Coordinate Frame:

    • The X-axis typically represents the longer side.
    • The Z-axis points upwards.

    Rotate the object until it fits your requirements.

blender_before_rot blender_after_rot

  • Scaling: After rotation, ensure the scaling factor is set to 1.0. This ensures that the object doesn't appear disproportionately large or small in the bullet world. Scaling

  • Finalizing Changes: To apply rotation and scaling changes in Blender, press ctrl+A and select 'apply rotation and scaling transform'.

  • Exporting: Once adjustments are complete, save the object in the STL format.

2. Integrating Mesh in CRAM:

  • File Storage: Export the object as an STL file. Store it in your demo resource folder or at this path: ~/YOUR_CRAM_WS/src/cram/cram_3d_world/cram_bullet_reasoning/resource/

  • Coloring: To add color to the object, declare the color in the following file: ~/cram_3d_world/cram_bullet_reasoning_utilities/src/objects-database.lisp. For instance:

    (<- (%scenario-object-color :big-knife (0 1 1 1)))
  • STL File Mapping: Add a reference to the STL file in the system using a keyword (like big-knife):

    (defparameter *mesh-files*
      '(
       ....
       (:big-knife "package://cram_bullet_reasoning/resource/big-knife.stl" nil)
       ....
  • Costmap Metadata: Define costmap data for your object:

    (<- (object-type-costmap-threshold :big-knife 0.8d0))
  • Item Shape Definition: Specify the abstract shape of the item:

    (<- (%item-type-shape :big-knife :rectangle))
  • Padding Size: Define the padding size for your object:

    (<- (object-type-padding-size :big-knife 0.005d0))

3. Using the 3D Mesh in CRAM:

To use the mesh you've added, you can spawn the object with the following command:

(btr-utils:spawn-object 'big-knife-1 :big-knife
                        :pose (cl-transforms:make-pose
                               (cl-tf:make-3d-vector 1.5 0.0 1.3)
                               (cl-tf:make-identity-rotation)))

This command creates an instance of the big-knife object at the specified pose.


In summary, the process involves preparing the 3D mesh in a software like Blender, integrating it into CRAM by referencing its STL file and providing associated data, and finally, using the mesh in CRAM through specific commands.

Clone this wiki locally