ROS on Windows: error loading controller as a plugin.
Hi all,
I developed custom controllers as plugins of ros_control package. Everything works smoothly on ROS Noetic in Ubuntu. Currently, I'm trying to port the same packages in Windows. All the packages compile in Windows, and I can generate the controller as a .dll library in the right folder. The problem arises when I try to load the controller; I always get the same error:
[ERROR] [1668438174.709061300]: Could not load class 'positioncontrollers/NameOfTheController': Failed to load library C:/pathtocontroller/nameofthecontroller.dll. Make sure that you are calling the PLUGINLIBEXPORTCLASS macro in the library code and that names are consistent between this macro and your XML. Error string: Could not load library (Poco exception = C:/pathtocontroller/nameofthe_controller.dll)
[ERROR] [1668438174.709787900]: Could not load controller 'nameofthecontroller' because controller type 'positioncontrollers/NameOfTheController' does not exist.
The controller is present as .dll in the directory where ROS is looking for. PLUGINLIBEXPORTCLASS is properly called, and all the names are consistent otherwise, the plugin should not work in Ubuntu. Does anyone have a similar problem?
Looking forward to any reply! Thanks!
Enrico
Asked by enricovilla on 2022-11-15 06:21:22 UTC
Answers
UPDATE: the error above was misleading. In my case, the custom controller used a library as a dependency. The library was compiled as .dll; the only way I found to make the controller work was to copy the .dll locally to the folder devel/bin. This fixes the error.
Asked by enricovilla on 2023-01-16 06:23:21 UTC
Comments