How to run a package from .exe instead of "ros2 run"? (or: What exactly does ros2 run do?)

asked 2019-03-13 06:57:47 -0500

uPrizZ gravatar image

updated 2019-03-13 07:00:28 -0500

Hey guys,

I am trying to run a package from it's compiled .exe file. Obvisouly it's "missing" all the ROS2 dll's first, which I can solve by copying all the necessary dll's from install/bin folder to the directory of my .exe... First question:

Is there any way to automate the deployment process for ROS2 (copy all necessary .dll's to the directory)

Now after I did that, I noticed that it still doesn't work. It opens a console, which doesn't display anything, and my GUI and then shortly after that it closes everything again.

How to make my exe runnable after having all dll's copied?

Thank you very much

edit retag flag offensive close merge delete

Comments

If you've setup everything correctly, there should not be any manual steps needed. Copying "dlls to the directory" is certainly not something that should be necessary.

I would advice you to show your CMakeLists.txt here.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-13 09:15:57 -0500 )edit

Well, when I build my project, it creates an Executable in "install/Lib/<project>" which perfectly runs with "ros2 run <project> <node>". I can also navigate my ROS2-sourced command line to that folder and type "start node.exe". BUT, what won't work is to go to that folder (not in cmd but in my windows explorer), double-click the .exe and run it like that. Because this first tells me that there are dll's missing (which I can copy to the folder), and then makes my programm crash on startup (which doesn't happen - as I said - when I run everything from within a sourced ROS2 console).

uPrizZ gravatar image uPrizZ  ( 2019-03-13 10:18:26 -0500 )edit

@gvdhoorn: Could you tell me how there are "no manual steps needed"? If I try to start the demo_nodes_cpp - talker/publisher node from its executable it also asks me for the dll's, so I think that's normal. I am not sure what this has to do with my CMakeLists.txt. But anyway here it is:

https://pastebin.com/ZG6n5LXr

I guess the problem is just that, even if all the dll's are in the executables folder, it still has the problem that the ros2 installtion is not sourced when I don't start it out of a ros2 console. But how can I make the executable runnable out of the box (without needing to have a ros2 console etc.)

uPrizZ gravatar image uPrizZ  ( 2019-03-14 10:07:02 -0500 )edit