Thanks for the hint @roalgoal !
I tried the following but wasn’t able to add the launch file to setup.py.
- add path to launch file in “data_files” → see error 1
- instead add path in separate variable “install_launch_files” → see error 2
- include “install_requires” → see error 3
Any idea what I’m missing here?
Also, “colcon build” creates folders outside of ros2_ws.
setup.py
from setuptools import setup
# from setuptools import find_packages
# from setuptools import Command
# from setuptools.command.develop import develop
# from setuptools.command.install import install
# from setuptools.command.egg_info import egg_info
# from distutils.dir_util import copy_tree
# from distutils.file_util import copy_file
# from glob import glob
# from os.path import join
# import os
# import shutil
# import subprocess
package_name = 'wall_follower'
setup(
# install_requires=[
# 'setuptools',
# # 'package_dependency1',
# # 'package_dependency2',
# # other dependencies
# ],
name=package_name,
version='0.0.0',
packages=[package_name],
# install_launch_files=[
# # 'path/to/launch/file1.launch.py',
# ('~/ros2_ws/launch/', ['start_wall_following.launch.py']),
# ],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml']),
('~/ros2_ws/launch/', ['start_wall_following.launch.py']),
# (os.path.join('share', package_name),
# glob('launch/*.launch.py')), # added
],
install_requires=['setuptools'],
zip_safe=True,
maintainer='user',
maintainer_email='user@todo.todo',
description='TODO: Package description',
license='TODO: License declaration',
tests_require=['pytest'],
entry_points={
'console_scripts': [
'wall_following = wall_follower.wall_following:main'
],
},
)
error 1
user:~$ colcon build --packages-select wall_fhollower && source ~/ros2_ws/install/setup.bashStarting >>> wall_follower rovide a--- stderr: wall_follower aunch.pyerror: can't copy 'start_wall_following.launcwall_folh.py': doesn't exist or not a regular file---Failed <<< wall_follower [2.39s, exited witg.launchh code 1]Summary: 0 packages finished [3.07s] h code 1 1 package failed: wall_follower
1 package had stderr output: wall_follower
error 2
user:~$ colcon build --packages-select wall_follower && source ~/ros2_ws/install/setup.bashStarting >>> wall_follower/usr/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_launch_files' warnings.warn(msg)--- stderr: wall_follower
/usr/lib/python3.8/distutils/dist.py:274: Use
rWarning: Unknown distribution option: 'install_launch_files'
warnings.warn(msg)
---
Finished <<< wall_follower [2.84s]
Summary: 1 package finished [3.43s] 1 package had stderr output: wall_follower
error 3
user:~$ colcon build --packages-select wall_follower && source ~/ros2_ws/install/setup.bashStarting >>> wall_followerTraceback (most recent call last):er - 1.2s] File "<string>", line 1, in <module> File "/usr/lib/python3.8/distutils/core.py", line 215, in run_setup exec(f.read(), g)
File "<string>", line 39
SyntaxError: keyword argument repeated--- stderr: wall_follower
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/colcon
_core/executor/__init__.py", line 91, in __ca
ll__
rc = await self.task(*args, **kwargs) File "/usr/lib/python3/dist-packages/colcon_core/task/__init__.py", line 93, in __call__ return await task_method(*args, **kwargs) File "/usr/lib/python3/dist-packages/colcon_ros/task/ament_python/build.py", line 51, in build setup_py_data = get_setup_data(self.context.pkg, env) File "/usr/lib/python3/dist-packages/colcon_core/task/python/__init__.py", line 20, in get_setup_data return dict(pkg.metadata[key](env)) File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 129, in getter return get_setup_information(
File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 241, in get_setup_information
_setup_information_cache[hashable_env] =_get_setup_information(
File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 281, in _get_setup_information
result = subprocess.run(
File "/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-c', "import sys;from setuptools.extern.packaging.specifiers import SpecifierSet;from distutils.core import run_setup;dist = run_setup( 'setup.py', script_args=('--dry-run',), stop_after='config');skip_keys = ('cmdclass', 'distclass', 'ext_modules','metadata');data = { key: value for key, value in dist.__dict__.items() if ( not key.startswith('_') and not callable(value) and key not in skip_keysand key not in dist.display_option_names )};data['metadata'] = { k: v for k, v in dist.metadata.__dict__.items() if k not in ('license_files', 'provides_extras')};sys.stdout.buffer.write(repr(data).encode('utf-8'))"]' returned non-zero exit status 1.
---
Failed <<< wall_follower [1.34s, exited with code 1]
Summary: 0 packages finished [2.00s]
1 package failed: wall_follower
1 package had stderr output: wall_follower
Command '['/usr/bin/python3', '-c', "import sys;from setuptools.extern.packaging.specifiers import SpecifierSet;from distutils.core import run_setup;dist = run_setup( 'setup.py', script_args=('--dry-run',), stop_after='config');skip_keys = ('cmdclass', 'distclass', 'ext_modules', 'metadata');data = { key: value for key, value in dist.__dict__.items() if ( not key.startswith('_') and not callable(value) and key not in skip_keys and key not in dist.display_option_names )};data['metadata'] = { k: v for k, v in dist.metadata.__dict__.items() if k not in ('license_files', 'provides_extras')};sys.stdout.buffer.write(repr(data).encode('utf-8'))"]' returned non-zero exit status 1.