I’m trying to use Python to connect to the dobot Magician on my Ubuntu 18.04 system. I got the libDobotDll.so file from the website. I am able to detect the Dobot on ttyUSB0 using the SearchDobot function, but using ConnectDobot results in a Segmentation fault. Any help would be greatly appreciated. I have also tried recompiling the shared library with qt, using the source code provided in the the Dobot Demo v2.1, but I still have the seg fault.
Got the same problem when using the library v2.1 with python on ubuntu 18.04 and my raspberry pi.
I went through tons of version of the shared library, some precompiled and some that I compiled myself. I kept having the same problem. But I think I have the issue narrowed down, as well as a fix that I do not guarantee the reliability of.
The big problem is DobotDllType.py. I referred to the function signatures in the DobotDll.h file, and modified the corresponding functions in DobotDllType.py
The first change you need to make is in connectDobot. You need to pass a versionBuf to the api.ConnectDobot() function. Aside from that, just get rid of the master_id and slave_id being passed to basically every api function call, and it should start working normally. This worked for me, and I could get a demo as well as some of my own code running on the Dobot.
Note that making these changes on Windows might cause your program to crash. My guess is that the Windows dll file and the Linux .so files were compiled form different sources and DobotDllType was written for the windows shared library. Hope this helps.
[SOLVED] Segmentation fault in libDobotDll.so.1.0.0 under linux
Thanks @rbhirang, your solution worked for me. One extra thing I had to do was to alter DevType.Magician enum value to match one in ConnectInfo filled by ConnectDobot function.
If that would be helpful for someone…
Solved by compiling fresh
libDobotDll.so from sources provided in
Dobot Demo V2.3-en.rar under
magiciandll-master sub archive. It can be downloaded from Dobot Download Center, look for Magician Development protocol. And altered
DobotDllType.py according to instructions above.