Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Klampt Visual Meshes With Materials #178

Open
patricknaughton01 opened this issue Jan 31, 2024 · 2 comments
Open

Klampt Visual Meshes With Materials #178

patricknaughton01 opened this issue Jan 31, 2024 · 2 comments

Comments

@patricknaughton01
Copy link
Contributor

Running into an issue visualizing meshes with materials in Klampt (Python 3.8.10, klampt version 0.9.1).

Example script:

from klampt import vis, WorldModel
import time

wm = WorldModel()
robot_model = wm.loadRobot("assets/industreal/urdf/industreal_franka_klampt_visual.urdf")
vis.add("world", wm)
vis.show()
while vis.shown():
    time.sleep(0.05)

Error message:

WorldModel::LoadRobot: assets/industreal/urdf/industreal_franka_klampt_visual.urdf
log4cxx: Could not open file [./log4cxx.xml].
KrisLibrary::logger(): URDFParser configured as default
URDFParser: Link size: 19 
URDFParser: Joint size: 14 
log4cxx: Could not open file [./log4cxx.xml].
KrisLibrary::logger(): Geometry configured as default
Geometry: Loading 12 meshes from assets/industreal/urdf/../../urdf/franka_description/meshes/visual/link0.obj into Group 
Geometry: Loading 4 meshes from assets/industreal/urdf/../../urdf/franka_description/meshes/visual/link3.obj into Group 
Geometry: Loading 4 meshes from assets/industreal/urdf/../../urdf/franka_description/meshes/visual/link4.obj into Group 
Geometry: Loading 3 meshes from assets/industreal/urdf/../../urdf/franka_description/meshes/visual/link5.obj into Group 
Geometry: Loading 17 meshes from assets/industreal/urdf/../../urdf/franka_description/meshes/visual/link6.obj into Group 
Geometry: Loading 8 meshes from assets/industreal/urdf/../../urdf/franka_description/meshes/visual/link7.obj into Group 
Geometry: Loading 5 meshes from assets/industreal/urdf/../../urdf/franka_description/meshes/visual/hand.obj into Group 
URDFParser: Done loading robot file assets/industreal/urdf/industreal_franka_klampt_visual.urdf 
***  klampt.vis: using Qt5 as the visualization backend  ***
QtBackend: initializing app as Klamp't visualization
WARNING: QApplication was not created in the main() thread.
vis: creating GL window
######### QGLWidget setProgram ###############
#########################################
klampt.vis: Making window 0
#########################################
######### QGLWidget Initialize GL ###############
QGLWidget.paintGL: hit an exception?
Traceback (most recent call last):
  File "/home/patrick/.venvs/uc_venv/lib/python3.8/site-packages/klampt/vis/backends/qtbackend.py", line 276, in paintGL
    res = self.program.displayfunc()
  File "/home/patrick/.venvs/uc_venv/lib/python3.8/site-packages/klampt/vis/backends/vis_gl.py", line 37, in displayfunc
    glcommon.GLPluginProgram.displayfunc(self)
  File "/home/patrick/.venvs/uc_venv/lib/python3.8/site-packages/klampt/vis/glprogram.py", line 483, in displayfunc
    GLRealtimeProgram.displayfunc(self)
  File "/home/patrick/.venvs/uc_venv/lib/python3.8/site-packages/klampt/vis/glprogram.py", line 142, in displayfunc
    self.prepare_screen_GL()
  File "/home/patrick/.venvs/uc_venv/lib/python3.8/site-packages/klampt/vis/glprogram.py", line 178, in prepare_screen_GL
    GL.glMatrixMode(GL.GL_PROJECTION)
  File "/home/patrick/.venvs/uc_venv/lib/python3.8/site-packages/OpenGL/error.py", line 228, in glCheckError
    raise GLError(
OpenGL.error.GLError: GLError(
        err = 1281,
        description = b'invalid value',
        baseOperation = glMatrixMode,
        cArguments = (GL_PROJECTION,)
)

Assets directory: assets.zip

Version that works with urdfpy:

from urdfpy import URDF


robot = URDF.load("../assets/industreal/urdf/industreal_franka_visualization.urdf")
robot.show(cfg={
    "panda_joint1": -1.7574766278484677,
    "panda_joint2": 0.8403247702305783,
    "panda_joint3": 2.015877580177467,
    "panda_joint4": -2.0924931236718334,
    "panda_joint5": -0.7379389376686856,
    "panda_joint6": 1.6256438760537268,
    "panda_joint7": 1.2689337870766628,
    "panda_finger_joint1": 0.04,
    "panda_finger_joint2": 0.04
})
@patricknaughton01
Copy link
Contributor Author

Updated assets directory: assets.zip

@krishauser
Copy link
Owner

krishauser commented Jan 31, 2024

Not sure what's happening. Here's what I get (I added the tag <klampt flip_yz="1" /> within the tags)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants