-
I'm trying to load a YCB object but I have encountered an error when loading a texture (so this question might be relevant to this discussion). I'm not sure how I can inform you correctly, so I put the encountered error, the script I used, and full scripts and data so you can reproduce it on your side. The errorThe error occurred when rendering the simulator. $ python scripts/example_load_urdf_sapien.py
[2022-11-11 14:02:01.575] [svulkan2] [warning] requested: 0, 0; available 1024-1024, 768-768
Traceback (most recent call last):
File "/homes/ota/workspace/robotics/mask_rcnn_ycb/scripts/example_load_urdf_sapien.py", line 71, in <module>
main()
File "/homes/ota/workspace/robotics/mask_rcnn_ycb/scripts/example_load_urdf_sapien.py", line 67, in main
render(scene, renderer, camera)
File "/homes/ota/workspace/robotics/mask_rcnn_ycb/scripts/example_load_urdf_sapien.py", line 51, in render
viewer.render()
File "/homes/ota/anaconda3/envs/mask_rcnn/lib/python3.7/site-packages/sapien/utils/viewer.py", line 1849, in render
self.info_window,
RuntimeError: filesystem error: cannot make canonical path: No such file or directory [/homes/ota/workspace/robotics/mask_rcnn_ycb/data/ycb/077_rubiks_cube/google_16k/texture_map.png ] An weird point is that the file does exist as: ls -la /homes/ota/workspace/robotics/mask_rcnn_ycb/data/ycb/077_rubiks_cube/google_16k/texture_map.png
-rw-r--r-- 1 ota merl 4102208 Nov 20 2015 /homes/ota/workspace/robotics/mask_rcnn_ycb/data/ycb/077_rubiks_cube/google_16k/texture_map.png Also, I can load the object via the same URDF using pybullet as: I'll put the pybullet code I used below. The SAPIEN Code I usedThe full code, named "scripts/example_load_urdf_sapien.py", is as follows: import os
import numpy as np
from transforms3d.euler import mat2euler
import sapien.core as sapien
from sapien.utils.viewer import Viewer
def init_cam(scene, cam_pos, width=640, height=480, fovx=35, fovy=35):
near, far = 0.1, 100
camera_mount_actor = scene.create_actor_builder().build_kinematic()
camera = scene.add_mounted_camera(
name="camera",
actor=camera_mount_actor,
pose=sapien.Pose(), # relative to the mounted actor
width=width,
height=height,
fovx=np.deg2rad(fovx),
fovy=np.deg2rad(fovy),
near=near,
far=far)
# Compute the camera pose by specifying forward(x), left(y) and up(z)
cam_pos = np.array(cam_pos)
forward = -cam_pos / np.linalg.norm(cam_pos)
left = np.cross([0, 0, 1], forward)
left = left / np.linalg.norm(left)
up = np.cross(forward, left)
mat44 = np.eye(4)
mat44[:3, :3] = np.stack([forward, left, up], axis=1)
mat44[:3, 3] = cam_pos
camera_mount_actor.set_pose(sapien.Pose.from_transformation_matrix(mat44))
scene.step() # make everything set
scene.update_render()
return camera, camera_mount_actor
def render(scene, renderer, camera):
viewer = Viewer(renderer)
viewer.set_scene(scene)
model_matrix = camera.get_model_matrix()
model_matrix = model_matrix[:, [2, 0, 1, 3]] * np.array([-1, -1, 1, 1])
rpy = mat2euler(model_matrix[:3, :3]) * np.array([1, -1, -1])
viewer.set_camera_xyz(*model_matrix[0:3, 3])
viewer.set_camera_rpy(*rpy)
viewer.window.set_camera_parameters(near=0.05, far=100, fovy=1)
while not viewer.closed:
scene.step()
scene.update_render()
viewer.render()
viewer.close()
def main():
engine = sapien.Engine()
engine.set_log_level("error")
renderer = sapien.VulkanRenderer()
engine.set_renderer(renderer)
scene = engine.create_scene(sapien.SceneConfig())
loader = scene.create_urdf_loader()
urdf_path = os.path.join("data", "ycb", "002_master_chef_can.urdf")
loader.load(urdf_path)
camera, _ = init_cam(scene, cam_pos=np.array([-2, 0, 0]))
render(scene, renderer, camera)
if __name__ == "__main__":
main() The PyBullet Code I usedimport os
import pybullet as p
import pybullet_data
def main():
p.connect(p.GUI) # or p.DIRECT for non-graphical version
p.setAdditionalSearchPath(pybullet_data.getDataPath()) # used by loadURDF
p.setGravity(0, 0, -10)
p.loadURDF("plane.urdf")
init_pos = [0, 0, 2]
init_orn = p.getQuaternionFromEuler([0, 0, 0])
# load model
urdf_path = os.path.join("data", "ycb", "002_master_chef_can.urdf")
p.loadURDF(urdf_path, init_pos, init_orn)
while True:
p.stepSimulation()
p.disconnect()
if __name__ == "__main__":
main() Structure of the attached scripts and data to reproduce the resultsI attached the minimal codes and data to reproduce the error. $ tree
.
├── data
│ └── ycb
│ ├── 002_master_chef_can
│ │ └── google_16k
│ │ ├── kinbody.xml
│ │ ├── nontextured.ply
│ │ ├── nontextured.stl
│ │ ├── texture_map.png
│ │ ├── textured.dae
│ │ ├── textured.mtl
│ │ ├── textured.obj
│ │ ├── textured_vhacd.obj
│ │ └── textured_vhacd.obj.convex.stl
│ └── 002_master_chef_can.urdf
├── environment.yml
└── scripts
├── example_load_urdf_bullet.py
└── example_load_urdf_sapien.py |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is caused by an extra whitespace in the |
Beta Was this translation helpful? Give feedback.
This is caused by an extra whitespace in the
textured.mtl
file. Note there is a whitespace in the error message.[/homes/ota/workspace/robotics/mask_rcnn_ycb/data/ycb/077_rubiks_cube/google_16k/texture_map.png ]
You can remove it as a temporary workaround. I'll see if I can fix it in the next release.