Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorials:advanced:cram-meshes [2022/03/30 14:12] vanessatutorials:advanced:cram-meshes [2022/05/09 09:59] (current) – [Add the mesh to CRAM] vanessa
Line 1: Line 1:
 ====== Prepare the 3D mesh====== ====== Prepare the 3D mesh======
-Open your mesh in Blender or any other Software of your wishes.+There are a few things to watch out for when adding a 3d mesh to the bullet world. 
 +In order to take into account scaling, rotation and file type, it is recommended to first open the object in Blender or another suitable software. 
 +Now look at the rotation and consider the Right-Handed 3D Coordinate Frame we are working in. The X-axis is mostly the long side and Z-axis goes up. Just rotate the object to your liking. 
 +{{ :tutorials:advanced:blender_before_rot.png?400 |}} {{ :tutorials:advanced:blender_after_rot.png?400 |}}
  
 +After the rotation is done check the scaling factor of the object. You will need to hit the scaling factor on 1.0 otherwise the object is weirdly big or small in the bullet world. 
 +{{ :tutorials:advanced:blender_properties.png?400 |}}
 +To apply your changes on the object hit ctrl+A and click on apply rotation and scaling transform.
 +Now save the object as an stl.
  
-{{:tutorials:advanced:blender_before_rot.png?400|blender before rotation}}+====== Add the mesh to CRAM======
  
-{{:tutorials:advanced:blender_after_rot.png?400|blender after rotation}}+Export as stl and save it either in your demo resource folder or~/YOUR_CRAM_WS/src/cram/cram_3d_world/cram_bullet_reasoning/resource/
  
-{{:tutorials:advanced:blender_properties.png?400|}} + 
-check scaling factor = 1.0 and apply rotation and scaling to the object by hitting ctrl+A +To add some coloring on the object one must declare it here~/cram_3d_world/cram_bullet_reasoning_utilities/src/objects-database.lisp: 
-TODO+ 
 +  ;; Colors for different object types the same for all scenarios
 +  (<- (%scenario-object-color :big-knife    (0 1 1))) 
 +   
 +Add your object here, so the system can use the correct stl file for the keyword of your willIn this example it is big-knife. The keyword is important since it is used as a reference within the system: 
 +./cram_3d_world/cram_bullet_reasoning/src/items.lisp: 
 + 
 +  (defparameter *mesh-files* 
 +    '( 
 +     .... 
 +     (:big-knife "package://cram_bullet_reasoning/resource/big-knife.stl" nil) 
 +     .... 
 +     
 +Add your object here for the costmap metadata: 
 +./cram_3d_world/cram_btr_spatial_relations_costmap/src/knowledge.lisp:113: 
 + 
 +  (<- (object-type-costmap-threshold :big-knife 0.8d0)) ; 0.99d0)) 
 +   
 +Add your object here for the abstract item-shape: 
 +world/cram_btr_spatial_relations_costmap/src/knowledge.lisp:052:   
 + 
 +  (<- (%item-type-shape :big-knife :rectangle)) 
 + 
 + 
 +Add your object here for the padding size: 
 +./cram_3d_world/cram_btr_spatial_relations_costmap/src/knowledge.lisp:087:   
 + 
 +  (<- (object-type-padding-size :big-knife 0.005d0)) 
 +   
 +======How to use the mesh======   
 +Now you are able to spawn your object by: 
 +  (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)))