facebookresearch / tacto

Simulator of vision-based tactile sensors.
MIT License
348 stars 75 forks source link

Best way to add an object generated using `p.createMultiBody` in pybullet to Tacto #29

Closed Olimoyo closed 2 years ago

Olimoyo commented 2 years ago

Hi,

I have object meshes from .obj files that I add to my pybullet simulator using p.createMultiBody.

What would be the best steps to follow in order to add this object to the Tacto simulator? I am not sure if there's something similar to add_object(): https://github.com/facebookresearch/tacto/blob/a21d0c4626d74a546d94859226c2fea348babb6a/tacto/sensor.py#L127

Thank you, Oliver

wx405557858 commented 2 years ago

Hi Oliver, I think the most convenient way is to add the .obj/.stl to a URDF file for loading it into TACTO.

An alternative way may be to customize the function similiar to add_object(), the most important lines are noted here, if we can load the mesh of the object file and do the register it to self.objects, it should automatically update.

https://github.com/facebookresearch/tacto/blob/a21d0c4626d74a546d94859226c2fea348babb6a/tacto/sensor.py#L160-L172

Olimoyo commented 2 years ago

Hi Shaoxiong,

Thanks for the quick response!

For my use case I think the second solutions works better. I am going to try to add a new "add_object" for .obj files to basically extract the mesh directly (maybe using something like https://trimsh.org/trimesh.exchange.obj.html).

If I understand correctly, I shouldn't need to do any of the pose transforms done with URDF file? https://github.com/facebookresearch/tacto/blob/a21d0c4626d74a546d94859226c2fea348babb6a/tacto/sensor.py#L142-L158

Oliver

wx405557858 commented 2 years ago

Hi Oliver, Makes sense. Yeah, that's just for URDF scaling and transformation.

Olimoyo commented 2 years ago

Thanks for the help!