0
$\begingroup$

Rosanswers logo

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?


Originally posted by Pablo Iñigo Blasco on ROS Answers with karma: 2982 on 2020-10-17

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

This is the solution I found for that issue:

install(PROGRAMS
        scripts/myscript.py
        DESTINATION lib/${PROJECT_NAME})

Originally posted by Pablo Iñigo Blasco with karma: 2982 on 2020-10-17

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.