將YCB模型庫中的obj格式文件導入VREP並保存爲ttm文件

之前在Gazebo裏做了個機械臂抓取的仿真環境,最近開始和其他小夥伴們一起學習,大家統一都用VREP了,VREP支持導入urdf,但是不知道爲什麼寫好的urdf導入後模型的顏色都沒了,另外考慮到導入模型後爲了進行碰撞檢測的計算,還是需要手動把模型簡化不能直接用原來複雜的mesh文件,所以打算一個一個手動的把YCB數據集裏的模型都導入進來然後調整好模型,存成ttm方便以後用。

一、下載YCB模型

網址在此
YCB包含:

Data are collected by two state of the art systems: UC Berkley’s scanning rig and the Google scanner. For the data collected with the UC Berkley’s scanning rig (which is made up of RGB and RGB-D cameras and was also used for BigBIRD), we provide:

  • a mesh generated with Poisson reconstruction
  • a mesh generated with volumetric range image integration
  • textured versions of both meshes
  • Kinbody files for using the meshes with OpenRAVE
  • point cloud of the object generated by all the viewpoints
  • 600 High-resolution RGB images
  • 600 RGBD images

For the data collected with the Google scanner, we provide:

  • 3 meshes generated (with 16k, 64k, and 512k polygons)
  • textured versions of each mesh Kinbody files for using the meshes with OpenRAVE

在直接通過導入mesh到VREP的時候發現,只有Google Scanner的模型還有顏色,其他模型的顏色都沒了,不知道爲什麼,所以就先用google scanner的了。

二、 導入到VREP中

“File > Import > Mesh”,然後選擇下載下來的textured.obj文件,就可以在VREP中看到模型了。
這裏寫圖片描述
這時導入的是含有很多三角網格的模型,如果直接用這個來進行碰撞檢測等計算會非常非常慢,所以下面需要提取這個模型的凸殼(convex hull),用這個凸殼來代替原模型參與計算。

三、凸殼提取

“選定模型 > Add > convex hull of selection”,然後就可以看到計算出的凸殼了。
這裏寫圖片描述
下面需要把凸殼隱藏顯示原模型外觀,並設置使用凸殼來進行碰撞檢測的計算。
首先拖動原來的Simple random shape到生成的Simple convex shape上,然後設置二者的Scene Object Property。
首先設置凸殼的:
1. 勾選Body is respondable和Body is dynamic
2. 根據凸殼計算一下mass和inertia
3. 取消勾選所有的Object Special Properties
4. 設爲model base
5. 隱藏外觀
然後設置原模型的:
1. 勾選select base of model instead
2. 把亮度調高
這裏寫圖片描述
到這裏模型就可以用了。

四、保存模型

“File > Save model as”,命名然後保存就可以了,以後就能直接從左側模型庫裏直接拖動添加。
這裏寫圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章