vispy / vispy

Main repository for Vispy
http://vispy.org
Other
3.31k stars 617 forks source link

IndexError: list index out of range [Only when running with ROS2] #2627

Open AjinJayan opened 2 days ago

AjinJayan commented 2 days ago

I am running 6dpose estimation inference script, it runs successfully without any errors when executed as a standalone Python script. By when running with ros2, ie., calling script inside ros2 node, the following error occurs. This error is happening at the pose refinement stage where it renders scene.

The error occurs at the line "used_program.draw("triangles", model.index_buffer)" inside renderer.py. I also tried changing app backends and gl backends, but same error


WARNING: OpenGL version could not be determined, which might be a sign that OpenGL is not loaded correctly.
2024-09-09 14:01:55,310 - WARNING - OpenGL version could not be determined, which might be a sign that OpenGL is not loaded correctly.
Traceback (most recent call last):
File "/home/rack/Workspace/projects/xrm/install/xrm_perception_iris/lib/xrm_perception_iris/perception.server.v2.py", line 283, in
main()
File "/home/rack/Workspace/projects/xrm/install/xrm_perception_iris/lib/xrm_perception_iris/perception.server.v2.py", line 273, in main
executor.spin()
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 294, in spin
self.spin_once()
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 794, in spin_once
self._spin_once_impl(timeout_sec)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 791, in _spin_once_impl
future.result()
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/task.py", line 94, in result
raise self.exception()
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/task.py", line 239, in call
self._handler.send(None)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 437, in handler
await call_coroutine(entity, arg)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 391, in _execute_service
response = await await_or_execute(srv.callback, request, srv.srv_type.Response())
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 107, in await_or_execute
return callback(*args)
File "/home/rack/Workspace/projects/xrm/install/xrm_perception_iris/lib/xrm_perception_iris/perception.server.v2.py", line 239, in srv_task_callback
self.perception.inference_call(request)
File "/home/rack/Workspace/projects/xrm/install/xrm_perception_iris/local/lib/python3.10/dist-packages/xrm_perception_iris/pipeline/pipeline_v2/init.py", line 85, in inference_call
self.pipeline.inference_call()
File "/home/rack/Workspace/projects/xrm/install/xrm_perception_iris/local/lib/python3.10/dist-packages/xrm_perception_iris/pipeline/pipeline_v2/pipeline.py", line 139, in inference_call
self.gdrnpp1.inference(self.data.color.copy(), self.data.depth.copy(), target_obj )
File "/home/rack/Workspace/projects/xrm/install/xrm_perception_modules/local/lib/python3.10/dist-packages/xrm_perception_modules/models/gdrnpp/get6dpose.py", line 64, in inference
poses = self.gdrn_predictor.postprocessing(data_dict, out_dict)
File "/home/rack/Workspace/projects/xrm/install/xrm_perception_modules/local/lib/python3.10/dist-packages/xrm_perception_modules/models/gdrnpp/predictor_gdrn.py", line 216, in postprocessing
self.process_depth_refine(data_dict, out_dict)
File "/home/rack/Workspace/projects/xrm/install/xrm_perception_modules/local/lib/python3.10/dist-packages/xrm_perception_modules/models/gdrnpp/predictor_gdrn.py", line 281, in process_depth_refine
self.ren.draw_model(
_**File "/home/rack/Workspace/projects/3rdparty/gdrnpp_ws/gdrnpp/lib/render_vispy/renderer.py", line 407, in draw_model
used_program.draw("triangles", model.index_buffer)
File "/home/rack/.pyenv/versions/gdrnpp/lib/python3.10/site-packages/vispy/gloo/program.py", line 543, in draw
canvas.context.flush_commands()
File "/home/rack/.pyenv/versions/gdrnpp/lib/python3.10/site-packages/vispy/gloo/context.py", line 172, in flush_commands
self.glir.flush(self.shared.parser)
File "/home/rack/.pyenv/versions/gdrnpp/lib/python3.10/site-packages/vispy/gloo/glir.py", line 584, in flush
self._shared.flush(parser)
File "/home/rack/.pyenv/versions/gdrnpp/lib/python3.10/site-packages/vispy/gloo/glir.py", line 506, in flush
parser.parse(self._filter(self.clear(), parser))
File "/home/rack/.pyenv/versions/gdrnpp/lib/python3.10/site-packages/vispy/gloo/glir.py", line 824, in parse
self._parse(command)
File "/home/rack/.pyenv/versions/gdrnpp/lib/python3.10/site-packages/vispy/gloo/glir.py", line 798, in _parse
ob.attach(*args)
File "/home/rack/.pyenv/versions/gdrnpp/lib/python3.10/site-packages/vispy/gloo/glir.py", line 1803, in attach
self.deactivate()
File "/home/rack/.pyenv/versions/gdrnpp/lib/python3.10/site-packages/vispy/gloo/glir.py", line 1774, in deactivate
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, stack[-1])
IndexError: list index out of range**_
The following exception was never retrieved: cannot use Destroyable because destruction was requested
[ros2run]: Process exited with failure 1
djhoese commented 1 day ago

I am running 6dpose estimation inference script, it runs successfully without any errors when executed as a standalone Python script. By when running with ros2, ie., calling script inside ros2 node, the following error occurs.

I don't know what "6dpose estimation inference" is. Does it matter for this issue? I don't know what "ros2" is. The warning at the top says that the OpenGL version couldn't be determined and then you're getting a low level OpenGL error. It is likely that your OpenGL/video driver isn't properly installed or configured on this machine.

djhoese commented 1 day ago

It also looks like you are mixing 3 or more different python environments. Is that intentional?

/home/rack/.pyenv/versions/gdrnpp/lib/python3.10/
/home/rack/Workspace/projects/3rdparty/
/home/rack/Workspace/projects/xrm/
/opt/ros/humble/local/lib/python3.10/

Or I guess the Workspace ones are just "editable" installs of those packages?

AjinJayan commented 1 day ago

yes, workspace are for the editable installs.

djhoese commented 20 hours ago

My original questions still stand. I don't know what "ros2" is, but it looks like OpenGL is not properly configured.