Reputation: 11
i have ros2 foxy package . There is a python file which should be run using ros2 launch command and the issue is with hod should the python file be added to the ros2 package. the file path is as below :
ros2_ws/src/makiman/src/startup/gas.py
setup.py file :
from setuptools import setup
import os
from glob import glob
package_name = 'makiman'
setup(
name=package_name,
version='0.0.0',
packages=[package_name],
data_files=[
('share/ament_index/resource_index/packages', ['resource/' + package_name]),
(os.path.join('share', package_name), ['package.xml']),
(os.path.join('share', package_name), glob('launch/*.launch.py')),
('share/' + package_name, ['src/startup/gas.py']),
],
install_requires=['setuptools'],
zip_safe=True,
maintainer='mohseni',
maintainer_email='[email protected]',
description='TODO: Package description',
license='TODO: License declaration',
tests_require=['pytest'],
entry_points={
'console_scripts': [
'compute_node = makiman.gas:main'
],
},
)
ros2_ws/src/makiman/launch/test_gas.launch.py content is :
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
compute_node = Node(
package="makiman",
executable="startup/gas.py",
output="screen",
emulate_tty=True,
)
ld = [compute_node]
return LaunchDescription(ld)
the gas.py file has +x permission .
the package has been built with the command : colcon build
the source the install/setup.zsh
then : ros2 launch makiman test_gas.launch.py
it returns the error : **launch.substitutions.substitution_failure.SubstitutionFailure: executable 'startup/gas.py' not found on the libexec directory '/home/mohseni/ros2_ws/install/makiman/lib/makiman' **
the content of the directory /home/mohseni/ros2_ws/install/makiman/lib/makiman is compute_node file
Upvotes: 0
Views: 328