How to properly generate .vtk file from .obj file?

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
Lishitang
Posts: 1
Joined: Sun Dec 11, 2022 7:51 am

How to properly generate .vtk file from .obj file?

Post by Lishitang »

I want to load deformable object in PyBullet with function "loadSoftBody". I know that PyBullet offers example object file "torus.obj" and "torus.vtk". It works well. However, when I try to generate .vtk file by myself from .obj with the following steps, PyBullet crashes down:
1. open .obj file in Blender in Windows and export .stl file
2. generate .msh file in TetWild (https://github.com/Yixin-Hu/TetWild) in Ubuntu with command in terminal:
$ ./TetWild --input torus.stl --output torus.msh
3. open .msh file in Gmsh in Windows and export .vtk file
4. run the following Python script:
import pybullet as p
from time import sleep
import pybullet_data

physicsClient = p.connect(p.GUI)

p.setAdditionalSearchPath(pybullet_data.getDataPath())

p.resetSimulation(p.RESET_USE_DEFORMABLE_WORLD)
p.setGravity(0, 0, -10)

planeId = p.loadURDF("plane.urdf", [0,0,0])

# original .vtk file ------- success
# softBodyId1 = p.loadSoftBody("original files/torus.vtk", basePosition = [0,0,5])
# generated .vtk file ------- fail
softBodyId2 = p.loadSoftBody("generated files/torus.vtk", basePosition = [0,0,5])

p.setRealTimeSimulation(0)

while p.isConnected():
p.stepSimulation()
Then PyBullet crashes down.
pybullet build time: May 20 2022 19:44:17
startThreads creating 1 threads.
starting thread 0
started thread 0
argc=2
argv[0] = --unused
argv[1] = --start_demo_name=Physics Server
ExampleBrowserThreadFunc started
X11 functions dynamically loaded using dlopen/dlsym OK!
X11 functions dynamically loaded using dlopen/dlsym OK!
Creating context
Created GL 3.3 context
Direct GLX rendering context obtained
Making context current
GL_VENDOR=VMware, Inc.
GL_RENDERER=SVGA3D; build: RELEASE; LLVM;
GL_VERSION=4.1 (Core Profile) Mesa 21.2.6
GL_SHADING_LANGUAGE_VERSION=4.10
pthread_getconcurrency()=0
Version = 4.1 (Core Profile) Mesa 21.2.6
Vendor = VMware, Inc.
Renderer = SVGA3D; build: RELEASE; LLVM;
b3Printf: Selected demo: Physics Server
startThreads creating 1 threads.
starting thread 0
started thread 0
MotionThreadFunc thread started
ven = VMware, Inc.
ven = VMware, Inc.
Segmentation fault (core dumped)
All the files are attached in the
files.zip
(308.59 KiB) Downloaded 1201 times
file. Folder "original files" are files provided by PyBullet git repository. Folder "generated files" are files generated by myself. I search for the solution online and still cannot solve this problem.
smellrock
Posts: 1
Joined: Tue Jan 10, 2023 11:37 am

Re: How to properly generate .vtk file from .obj file?

Post by smellrock »

Hey @Lishitang, Actually I am too working on that. Please let me know if you found something. For me I used FreeCad and was able to directly convert STL into obj but failed to convert into vtk file. I will post as well as soon as I know something. all the best!
Post Reply