gelsightinc / gsrobotics

GelSight SDK for robotic sensors
GNU General Public License v3.0
80 stars 24 forks source link

ximea.xiapi read camera image sometimes crush #16

Open CarlDegio opened 1 year ago

CarlDegio commented 1 year ago

I use showimage and show3d in ros2. Current gsdevice code use:

from ximea import xiapi
self.cam = xiapi.Camera(self.dev_id)
self.cam.read()

this sometimes occur:

global cap_v4l.cpp:1119 tryIoctl VIDEOIO(V4L2:/dev/video2): select() timeout.
ERROR! reading image from camera!

it seems that the problem is read image from camera failed. Is there any solution? Such as read image by opencv?

debrashure commented 1 year ago

I am in the process of updating the repository to only support the GelSight Mini device. I plan to check the code in tonight. I will test the ros2 example. Are you using the Mini on Linux? If so, it shouldn't be using the ximea api.

CarlDegio commented 1 year ago

yes, I use mini on linux. I have push a ros2 package version: https://github.com/CarlDegio/gelsight_ros2. two nodes use gsdevice so ximea api is used by default.

debrashure commented 1 year ago

I just updated the repository and none of the code uses ximea. If you update and reinstall gelsight, the issue should go away.

CarlDegio commented 1 year ago

Thank you! I will try it later

CarlDegio commented 1 year ago

the change seems good. But the crush is still exist. And it just happened randomly and frequently. just like this:

ERROR! reading image from camera!
...
AttributeError: 'NoneType' object has no attribute 'shape'
[ WARN:0@23.288] global cap_v4l.cpp:872 requestBuffers VIDEOIO(V4L2:/dev/video2): failed VIDIOC_REQBUFS: errno=19 (No such device)

Do you have any suggestions for this, like the frequency to read, or the usb cable.

CarlDegio commented 1 year ago

At present, I found that it is likely that the usb plug is not in good status.

debrashure commented 1 year ago

If the lights are not staying on all the time, that would indicate a USB problem.

CarlDegio commented 1 year ago

If the lights are not staying on all the time, that would indicate a USB problem.

Yes, I believe I have found the reason. The mini usb on gelsight is not tight. Some contact will lead it offline.

debrashure commented 1 year ago

Please send an email to mini@gelsight.com with the serial number of the Mini and a short description of the problem. You can cc me at debra_shure@gelsight.com to make sure we take care of the issue.

Thank you, Debbie

debrashure commented 1 year ago

@CarlDegio were able to resolve your issue ???

CarlDegio commented 1 year ago

Yes, Basically solved. I found that as long as I don't touch it during running (such as fixed), it basically functions normally. But maybe the miniUSB lock strength on the sensor still needs to be strengthened.

debrashure commented 1 year ago

Yes, you are correct, the USB connection needs to be reinforced. We are working on making it better. If you should run into any issues going forward, please don't hesitate to reach out. Thanks again for your feedback.