rospack cannot find pure CMake package
I am trying to use rospack find to get the path to a "pure cmake" (<build_type>cmake</build_type>) package, such as https://github.com/AprilRobotics/apriltag.
Even after installing the package.xml via install(FILES package.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/apriltag) (as suggested by https://answers.ros.org/question/251110/rospack-cannot-find-package-made-by-cmake-even-after-sourcing/):
$ find . -name package.xml
./install/apriltag_ros/share/apriltag_ros/package.xml
./install/apriltag/share/apriltag/package.xml
./src/apriltag_ros/apriltag_ros/package.xml
./src/apriltag/package.xml
./src/apriltag/package.xml
the ROS_PACKAGE_PATH will still miss the apriltag package:
$ echo $ROS_PACKAGE_PATH
/home/christian/Development/apriltag_ws/install/apriltag_ros/share:/opt/ros/noetic/share
What do I have to do to populate ROS_PACKAGE_PATH with the paths automatically and to eventually make rospack find apriltag work?
Asked by Christian Rauch on 2022-02-01 15:54:05 UTC
Answers
Make sure you created your package in $ROS_PACKAGE_PATH. After that, type rospack profile, then rospack find apriltag should work!.
If it still doesn't work, I would always just default to remaking the catkin workspace by deleting and reinstalling it except for the /src file. After that, navigate to ~catkin_ws/devel to ensure that the setup.bash file is in fact present. Then, type nano ~./bash.rc to open the bash.rc file in the terminal and edit the source path, which is located at the bottom of the text file, with source [file path to setup.bash]. An alternative way is to type ctrl + h on your home folder to open all hidden files on your computer and open and edit the .bashrc file from. On a side note, I would recommend sourcing the environment with source devel_isolated/setup.bash instead of source devel/setup.bash if you are using a ROS1 Distro since it's more reliable in exchange for speed since it processes all packages sequentially. You can learn more about catkin_make vs catkin_make_isolated from Dirk Thomas & gvdhoorn's comment.
Asked by qilin_gundamenjoyer on 2022-06-13 00:22:35 UTC
Comments
How can I create this in $ROS_PACKAGE_PATH? This points to a non-user-writeable location /opt/ros/noetic/share. You can try this yourself by creating a workspace with just the apriltag package. rospack profile doesn't help since it is only searching in $ROS_PACKAGE_PATH. But after sourcing a workspace, the $ROS_PACKAGE_PATH will only contain "ROS packages" and not the apriltag package.
Asked by Christian Rauch on 2022-09-16 08:44:32 UTC
Comments