Can you have ros2 python launch files in pure python packages?
I created a package with:
ros2 pkg create --build-type ament_python lrs_exec
In that package I created a lcunh file according to https://docs.ros.org/en/galactic/Tuto...
The launch file is:
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
Node(
package='lrs_exec',
output='screen',
executable='resource',
name='resource_agent'
)
])
The executable is called resource.py and is in a sub-dir lrs_exec of the package lrs_exec.
Trying to run:
ros2 launch lrs_exec exec.launch.py
I get:
tompe@tpexps:~$ ros2 launch lrs_exec exec.launch.py
[INFO] [launch]: All log files can be found below /home/tompe/.ros/log/2022-01-24-15-02-45-557721-tpexps-4043650
[INFO] [launch]: Default logging verbosity is set to INFO
Task exception was never retrieved
future: <Task finished name='Task-2' coro=<LaunchService._process_one_event() done, defined at /opt/ros/galactic/lib/python3.8/site-packages/launch/launch_service.py:226> exception=SubstitutionFailure("executable 'resource' not found on the libexec directory '/home/tompe/lrs2_ws/install/lrs_exec/lib/lrs_exec' ")>
Traceback (most recent call last):
So should this work or do I have to create a specific launch package as it was created in the launch turotial? I tested with resource.py and no difference.
Above I had manually created install/lrs_exec/lib/lrs_exec. The first error message was that the directory did not exist.