ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

ROS with DLL or WinROS with Wine?

asked 2013-08-26 04:57:25 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hello all,

This is my first question feel free to ask me edit it. I am integrating a 3rd party USB sensor into a Kuka Youbot. I am currently prototyping on a Dell machine before moving code to the Youbot. This is all in ROS Fuerte. The API is contained inside a .DLL with a optional .LIB, I also have various header files (C++) for dynamic linking. I have been trying to find a DLL opening function in Ubuntu C++/python or a DLL wrapper/converter without luck.

My current ideas are using either Winelib to compile with DLL opening or WinRos with Wine to run the node on Ubuntu. I have no idea if writing a node for WinRos and porting it to Wine would work what so ever?

Thanks for any info/help

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-08-28 00:11:21 -0600

mirzashah gravatar image

updated 2013-08-28 00:16:30 -0600

Ah interesting. Your question threw me off for a second as the Kuka Youbot has full ROS support

However I realized you were referring to a USB sensor. It seems that you're saying that they gave you a .lib+.dll. That implies that they did not provide source code...which is unfortunate as you could likely just port it to Linux then. Alas this is a common problem and there are straightforward ways to handle it.

Yes, you're not going to find some sort of magic "DLL opener". The problem is is that library utilizes the Win32 subsystem versus a POSIX subsystem. The binary representation of Windows libraries and executables uses "Portable Executable (PE)" whereas Linux is ELF...their program structure, organization, and system call conventions are totally different. Therefore to open a Win32 DLL in Linux, all Win32 calls have to be intercepted dynamically and emulated in a POSIX subsystem. Everything else can be run as normal. Luckily that's exactly what WINE does.

Though WINE can have a reputation for not working 100% with complex applications, the good news is that it will likely work well with this as the driver is for a simple USB sensor. This is because it will most likely use only very basic aspects of the Win32 api (serial port, network sockets, file i/o) which are very stable in the NT kernel and have not changed much over the years.

Note that Winelib is just a way to compile Windows applications on Linux...i.e. it's a crosscompiler from Linux to Windows. Though both are x86 ISA, they use POSIX and Win32 subsystems respectively so all system calls and binary representation of executables/libraries is different. You could also open a Windows much, pop open Visual Studio, and compile the program you desire.

Your second idea makes more sense.

  • Write a pure Windows program that links against the USB Sensor API as well as WinROS's port of roscpp. Either do it in Windows with Visual Studio and copy over the .exe + .dll and run with WINE. Or you can use Winelib and compile it in native Linux environment. Read the values with the API, publish ROS messages.
  • Run that program with WINE alongside your other nodes on your Ubuntu machine.

If for some reason WINE gives you problems, test the executable on a Windows machine to make sure you implemented it correctly and that you can publish to topics. If it does work in Windows and not with WINE, it's probably easiest to just run a stripped down Windows VM running that single ROS node. There are tools that let you take a Windows image and strip it down to a barebones headless machine. It's an ugly solution, but virtualization will cost you negligible performance overhead. Even without a stripped down Windows VM, it shouldn't be a problem on a modern machine.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-08-26 04:57:25 -0600

Seen: 1,321 times

Last updated: Aug 28 '13