How can I use yaml config files without having to rebuild after changing the config file?
I am looking for a way to have the same behaviour as in ROS1 where config files could be changed without having to rebuild the package. According to this answer, it should be possible with the symlink install. However, I haven't been able to achieve this. Additionally, it suggests to use global paths rather than install paths, but I would like to keep my config files within the package they belong to.
My current setup and method is the following on ROS2 foxy Linux:
Directory structure:
- my_package/
- my_package/
- config/
- my_package.yaml
- launch/
- resource/
- _init_.py
- package.xml
- setup.cfg
- setup.py
setup.cfg:
[develop]
script-dir=$base/lib/caterra_motor_controller
[install]
install-scripts=$base/lib/caterra_motor_controller
setup.py:
## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD
from setuptools import setup
import os
from glob import glob
package_name = 'my_package'
setup(
name=package_name,
version='0.0.0',
packages=[package_name],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml']),
(os.path.join('share', package_name, 'launch'), glob('launch/*')),
(os.path.join('share', package_name, 'config'), glob('config/*.yaml')),
],
install_requires=['setuptools'],
zip_safe=True,
maintainer='xxx',
maintainer_email='xxx',
description='xxx',
license='TODO: License declaration',
tests_require=['pytest'],
entry_points={
'console_scripts': [
'node = my_package.my_node:main'
],
},
)
I then compile the code with:
colcon build --symlink-install
This works fine for python files, but the yaml config files are still only updated after a rebuild.
What am I doing wrong?
Originally posted by bartonp on ROS Answers with karma: 3 on 2022-06-30
Post score: 0