ROS2: urdf not copied to install folder
ROS2 Foxy (on Ubuntu 20.04LTS Desktop)
Problem: urdf directory in package not being copied to the install folder
Error Msg:
InvalidLaunchFileError: Caught exception when trying to load file of format [py]: [Errno 2] No such file or directory: '/home/ubuntu/handsonros2/install/rviz2_basics/share/rviz2_basics/urdf/gopigoMinimal.urdf'
Package Tree: ~/handsonros2/src/chap3rviz2_basics/
. ├── CMakeLists.txt ├── launch │ ├── ros1_gopigoMinimal_rviz.launch.donotuse │ ├── ros1_gopigoMinimal_rviz_simple.launch.donotuse │ └── ros2_gpgMin_rviz2_simple.launch.py ├── package.xml ├── README.md ├── ros1CMakeLists.txt ├── ros1package.xml ├── ros2CMakeLists.txt ├── ros2package.xml ├── rviz │ ├── default.rviz │ ├── gopigoMinimal.rviz │ └── gpgMin.rviz2.rviz ├── setup.py └── urdf ├── gopigoMinimal.urdf └── keith_gpg.urdf
setup.py:
import os from glob import glob from setuptools import setup from setuptools import find_packages package_name = 'rviz2_basics' 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), glob('launch/*.py)), (os.path.join('share', package_name), glob('urdf/*')) ], install_requires=['setuptools'], zip_safe=True, maintainer='slowrunner', maintainer_email='slowrunner@users.noreply.github.com', description='ROS2 Version of Hands-On ROS - Chap4 RVIZ Basics', license='Apache License 2.0', tests_require=['pytest'], # entry_points={ # 'console_scripts': [ # ], }, )
package.xml:
<?xml version="1.0"?> <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> <package format="3"> <name>rviz2_basics</name> <version>0.0.0</version> <description>ROS2 Version of Hands-On ROS - Chap4 RVIZ Basics"</description> <maintainer email="slowrunner@users.noreply.github.com">slowrunner</maintainer> <license>Apache License 2.0</license> <buildtool_depend>ament_cmake</buildtool_depend> <test_depend>ament_lint_auto</test_depend> <test_depend>ament_lint_common</test_depend> <exec_depend>robot_state_publisher</exec_depend> <exec_depend>joint_state_publisher</exec_depend> <export> <build_type>ament_cmake</build_type> </export> </package>