Ask Your Question
0

how to install a python file with ament_cmake

asked 2020-10-17 09:55:32 -0500

updated 2020-10-17 10:33:25 -0500

I have an ament_cmake package that is mostly c++ but it also contains a python script in the "package_dir/script" folder (following the ROS1 directory convention). My expectation is that the script could be invoked using "ros2 run" and also could be referenced from launch files as an executable node.

Would it be possible to install this python file as an executable script from this ament_cmake package? If that is possible, what would be the cmake "install" function I should use for the python file or the scripts directory?

Should I instead create another separated ament_python package for that single script?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-10-17 18:24:13 -0500

This is the solution I found for that issue:

install(PROGRAMS
        scripts/myscript.py
        DESTINATION lib/${PROJECT_NAME})
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

2 followers

Stats

Asked: 2020-10-17 09:55:32 -0500

Seen: 57 times

Last updated: Oct 17