Kinovarobotics / matlab_kortex

MATLAB Adaptor packages for KINOVA® KORTEX™ robotic arms
Other
10 stars 4 forks source link

"Device may be in use" error in matlab_vision_imaq #10

Closed tohruk closed 3 years ago

tohruk commented 3 years ago

Hi,

I'm trying to acquire images in MATLAB on Windows10 through the vision module, but facing the following error:

The attempt to preview failed. The error was: Error using imaqdevice/preview (line 201) Could not connect to the image acquisition device. Device may be in use. no element "rtspsrc"

Following are things I tried, but no luck so far.

I was also able to see the exact same error when I disconnect the ethernet cable on my laptop from my Kinova Gen3, so the adapter client goes something wrong. How can I narrow down the root cause? Is there any way to check if the GStreamer works? Any suggestions will be appreciated.

Environment: Windows10 MATLAB R2021a Image Acquisition Toolbox Kinova Gen3 Ultra lightweight with the firmware 2.2.0

mgelinaskinova commented 3 years ago

Hi @tohruk,

If you install GStreamer separately (select the Complete installation), can you try the following call from the directory where gst-launch-1.0.exe is installed?

_gst-launch-1.0.exe rtspsrc location=rtsp://192.168.1.10/color latency=30 ! rtph264depay ! avdec_h264 ! autovideosink_

Also, what version of GStreamer is installed?

Regards, Marc

tohruk commented 3 years ago

Hi @mgelinaskinova,

Thanks for your response. I will check the command when I have a chance to use the hardware.

Regarding the version of GStreamer, the link for gstreamer-1.0-msvc-x86_64-1.15.2.msi in the vision_imaq page is broken, so I installed latest 1.18.4 runtime from the official GStreamer website. Several subversions can be found below: https://gstreamer.freedesktop.org/data/pkg/windows/ Which runtime actually should I use?

Best, Tohru

mgelinaskinova commented 3 years ago

Hi @tohruk,

Thank you for pointing out the broken link. Version 1.15.2 was the first Windows version built with MSVC that we could use to test our vision_imaq adaptor. Based on the link you provided, the closest available version would be 1.15.90. However, I believe that long-term versions of GStreamer are even-numbered (on the minor), so it might be better to stick with 1.16.X or 1.18.X.

So, version 1.16.X would be the closest to what we used to test the vision_imaq, but since we don't use anything fancy in the adaptor, I would expect version 1.18.X to work as well.

The most important thing is to take the 64-bit MSVC build (for instance, _gstreamer-1.0-msvc-x8664-1.16.3.msi), otherwise it will not work with MATLAB. Normally you don't need the "devel" version, but depending on your test results, we might later need to use such a version as I believe it would then allow us to use the GST_DEBUG environment variable to output some of the debug stuff, which could be useful to further investigate if need be.

Best regards, Marc

tohruk commented 3 years ago

Hi @mgelinaskinova ,

Thank you for your comment. By following your suggestion, I was able to see the video stream from my Kinova Gen3. Things that I tried are uninstalling all GStreamer stuff and installing gstreamer-1.0-msvc-x86_64-1.16.3.msi and then running the command you suggested. image

C:\gstreamer\1.0\x86_64\bin>set GST_PLUGIN_SYSTEM_PATH_1_0=c:\gstreamer\1.0\x86_64
C:\gstreamer\1.0\x86_64\bin>gst-launch-1.0.exe rtspsrc location=rtsp://192.168.1.10/color latency=30 ! rtph264depay ! avdec_h264 ! autovideosink
WARNING: no real random source present!
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://192.168.1.10/color
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
Redistribute latency...
handling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:01:31.214115000
Setting pipeline to NULL ...
Freeing pipeline ...

However, I can still see the below error in MATLAB. image

How can I drill down the problem? I also tried to reboot to avoid the confliction just in case, but no luck so far. Any suggestions will be highly appreciated.

Best,

Tohru

tohruk commented 3 years ago

Any suggestions would be highly appreciated.

mgelinaskinova commented 3 years ago

Hi @tohruk,

Sorry for the delay, I haven't been able to try it myself with MATLAB.

I'm really clueless about what the issue can be since your GStreamer environment seems to work well, and you say that with the _ros_kortexvision nodelet it works as well, which is using the same GStreamer pipeline as in _visionimaq.

At this point my suggestions would be:

  1. I believe it's already the case, but just in case, make sure that no other application (robot's web app, ros_kortex_vision) is accessing the video stream at the same time, keeping in mind the 30-second delay to free up a connection. The Vision module allows only 2 simultaneous connections to the video streams (any combination of Color & Depth streams).
  2. Can you try using the same environment as mentioned in the README, mostly regarding the MATLAB version? I understand it might not be possible. Otherwise, if not possible to use the same MATLAB version, could you try it under a native Ubuntu 16.04 (I know, it's old) machine?
  3. Since you're using a standalone GStreamer application, make sure when you install the _kinova_visionimaq that you don't install the included GStreamer runtime libraries.

I realize that you've probably already tried these suggestions but until I can try it on my side with your exact same setup, I really have no idea what the problem might be.

Good luck and keep me posted.

Best regards, Marc

ammercierKinova commented 3 years ago

Hi @tohruk, Your request has been taken over by the Kinova support team. My name is Alexandre and I will be the one assisting you. I'm currently installing all software that we will need to reproduce your issue and find a solution. to be efficient in our communication, we need an email address to enter in our Support system.

Thanks, I hope we will find the problem soon.

tohruk commented 3 years ago

Hi @lstlaurent and @ammercierKinova,

Thanks for your replies. I really appreciate that. @ammercierKinova , Can you provide the official support address so that I can send you an email from my company email address?

Thanks,

Tohru

ammercierKinova commented 3 years ago

Sure no problem there it is support@kinova.ca.

your welcome.

tohruk commented 3 years ago

Will send you email soon. Thanks. - Tohru

ammercierKinova commented 3 years ago

Hi Thoruk, I have respond to you via e-mail did you receive it?

tohruk commented 3 years ago

Hi @ammercierKinova,

Yes, I'm going to try the workaround and will get back to you if I have any progress on this. Closing this issue.

Thanks,

Tohru

tohruk commented 2 years ago

For your information, I received the following workaround from technical support and now I'm able to receive a video stream from Kinova Gen3.

  1. Install IMAQ adapter.
    >> imaqregister('C:\Program Files\Kinova\Vision Imaq\kinova_vision_imaq.dll');
  2. Install the mentioned version of Gstreamer However, the link to mentioned version (gstreamer-1.0-msvc-x86_64-1.15.2.msi) is broken now, so I used gstreamer-1.0-msvc-x86_64-1.16.3.msi instead. )
  3. Copy dll files from Kinova\Vision Imaq\gstlibs to gstreamer\1.0\x86_64\bin
  4. Modify the environment variable GST_PLUGIN_SYSTEM_PATH. GST_PLUGIN_SYSTEM_PATH (gstreamer installed folder)\1.0\x86_64\bin;C:\Program Files\Kinova\Vision Imaq\kinova_vision_imaq.dll;
huhailianglut163com commented 1 year ago

Hello,First of all, thank you for your sharing.. I followed your instructions, but I am still getting an error. Could not connect to the image acquisition device. Device may be in use. Do you have any suggestions for resolving it?

huhailianglut163com commented 1 year ago

Hi @mgelinaskinova , 你好

Thank you for your comment. By following your suggestion, I was able to see the video stream from my Kinova Gen3. Things that I tried are uninstalling all GStreamer stuff and installing gstreamer-1.0-msvc-x86_64-1.16.3.msi and then running the command you suggested.感谢您的评论。按照您的建议,我能够看到来自我的Kinova Gen3的视频流。我尝试过的事情是卸载所有 GStreamer 的东西,然后安装然后 gstreamer-1.0-msvc-x86_64-1.16.3.msi 运行您建议的命令。 image

C:\gstreamer\1.0\x86_64\bin>set GST_PLUGIN_SYSTEM_PATH_1_0=c:\gstreamer\1.0\x86_64
C:\gstreamer\1.0\x86_64\bin>gst-launch-1.0.exe rtspsrc location=rtsp://192.168.1.10/color latency=30 ! rtph264depay ! avdec_h264 ! autovideosink
WARNING: no real random source present!
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://192.168.1.10/color
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
Redistribute latency...
handling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:01:31.214115000
Setting pipeline to NULL ...
Freeing pipeline ...

However, I can still see the below error in MATLAB.但是,我仍然可以在 MATLAB 中看到以下错误。 image

How can I drill down the problem? I also tried to reboot to avoid the confliction just in case, but no luck so far. Any suggestions will be highly appreciated.如何深入了解问题?我还尝试重新启动以避免冲突以防万一,但到目前为止没有运气。任何建议将不胜感激。

Best, 最好

Tohru 托鲁

My question is exactly the same as yours.

kyilmazKinova commented 1 year ago

Hi @huhailianglut163com, first of all make sure you're not using MatLab r2023. Indeed, the gen3's camera feed is not supported yet on MatLab 2023. Could you please repeat the steps described in @tohruk reply on April 13, 2022? If you're still having issues, please contact support@kinova.ca and we'll be able to support you further.

Thank you,

Fishless-lab commented 1 week ago

Hi @huhailianglut163com, first of all make sure you're not using MatLab r2023. Indeed, the gen3's camera feed is not supported yet on MatLab 2023. Could you please repeat the steps described in @tohruk reply on April 13, 2022? If you're still having issues, please contact support@kinova.ca and we'll be able to support you further.

Thank you,

Hi there, any latest release for the adaptor to support MATLAB 2023? It will be great as MATLAB 2018 is a bit outdated and does not have ROS.

martinleroux commented 1 week ago

Hi @Fishless-lab ,

Mathworks should have made a release a few weeks ago fixing the issue with the IMAQ driver for Gen3. I don't know the details of this fix, but you can contact Matlab support and they should be able to help you.

That being said, it is possible the fix is only available for Matlab 2024.

Fishless-lab commented 1 day ago

Hello,

Mathwork asked me to contact Kinova.

Regards, Faheem

On Friday, August 30, 2024, martinleroux @.***> wrote:

Hi @Fishless-lab https://github.com/Fishless-lab ,

Mathworks should have made a release a few weeks ago fixing the issue with the IMAQ driver for Gen3. I don't know the details of this fix, but you can contact Matlab support and they should be able to help you.

That being said, it is possible the fix is only available for Matlab 2024.

— Reply to this email directly, view it on GitHub https://github.com/Kinovarobotics/matlab_kortex/issues/10#issuecomment-2321428428, or unsubscribe https://github.com/notifications/unsubscribe-auth/BK4NLSMKQ4NEFRNDAM5GL23ZUB6DVAVCNFSM6AAAAABNLL5H2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRRGQZDQNBSHA . You are receiving this because you were mentioned.Message ID: @.***>

martinleroux commented 1 day ago

Hi @Fishless-lab ,

I understand being sent back-and-forth between two support groups can be frustrating, but I assure you I have an email from Mathworks telling me they resolved the issue on their side. Please contact us at support@kinova.ca, asking specifically for me (Martin) and I will share with you the contact information of the person at Mathworks who gave me the info. I just don't want to dox him in a public forum.