Message thread on Webots Programming

python-getRangeImage function for kinect cameraby farinaz alamiyan (19) 2018-12-16 13:34:33
O.S : windows 10
Webots: Free Pro R2018b

Hi,
I try to get the depth image of a Kinect camera using Python. The webots can detect Kinect device successfully and can enable it too. but, when I try to use getRangeImage function to get the depth values, the controller is crashed.
My code is as follows:


self.kinectrange=self.getRangeFinder("kinect range")
self.kinectrange.enable(timestep)
image=self.kinectrange.getRangeImage ()

What is the problem?
Thanks in advance
Re: python-getRangeImage function for kinect cameraby Fabien Rohrer (Webots PRO - 1324) 2018-12-17 10:15:30
Hi,

I just checked and there is indeed a weird crash in the python controller library there, but only if you call the getRangeImage() call before any Robot.step() call.

Meanwhile we could provide a better fix, I adapt your snippet to workaround this issue:

self.kinectrange=self.getRangeFinder("kinect range")
self.kinectrange.enable(timestep)
self.step(timestep)
image=self.kinectrange.getRangeImage ()

Sincerely,
Fabien Rohrer
Re: python-getRangeImage function for kinect cameraby farinaz alamiyan (19) 2018-12-18 07:39:28
Dear Fabien
Thank you a lot for your answer

I followed your suggestion but the problem still hasn't been solved!
Please let me know if there is any other solution.

Regards
Re: python-getRangeImage function for kinect cameraby Fabien Rohrer (Webots PRO - 1324) 2018-12-18 13:19:58
Hi,

Just to inform you that we tried again, on R2018b, macOS and windows, and we can reproduce the issues, but it can be solved with the workaround I mentioned in my previous post.
I continue to think that my workaround is good.

Could you share with us your controller?

Sincerely,
Fabien Rohrer
Re: python-getRangeImage function for kinect cameraby farinaz alamiyan (19) 2018-12-22 08:26:06
Hi,
The attached file is my controller.
Thanks

Attachment: my_controller.py.
Re: python-getRangeImage function for kinect cameraby Fabien Rohrer (Webots PRO - 1324) 2019-01-14 12:50:04
I just tried your controller on R2019a and it is working. As expected, I can reproduce the original issue if I comment line 40. So I consider my workaround as working.
Could you upgrade to R2019a, please?

We decided to close this forum, so if you are still stuck with this, please ask your question here: https://stackoverflow.com/questions/tagged/webots

Sincerely,
Fabien Rohrer

Re: python-getRangeImage function for kinect cameraby David Mansolino (Webots PRO - 358) 2019-01-23 09:49:32
Hi Farinaz,

Just to let you know that we have identified and fixed the original problem in:
https://github.com/omichel/webots/pull/126

The fix will be included in the next version of Webots.

Sincerely,
David

Forum closed

This forum is closed, please ask technical questions about Webots on Stack Overflow or open a support ticket.

LIVE CHAT OFF

Send us an e-mail.

mail us
Chat with us ×