Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Handle ROS config files - Proposal #75

Closed
wants to merge 5 commits into from
Closed

Conversation

barbalberto
Copy link

This PR is a proposed way to handle the installation of ROS config files contained in a yarp repo.
NOTE: right now this PR handle launch and config files used ONLY BY ROS, and not by yarp applications.

Those files are in config and launch folder placed in the root od the repo.
This installer works in 4 different ways, depending on the PC's set-up

  1. The 'package' (repo) is compiled and installed using plain CMake (the YARP way) and no special env var is set.
    In this case the ROS config files will be installed using YARP standard paths, i.e. by mean of ${{PROJECT_NAME}_DATA_INSTALL_DIR}
    In order to have ROS find this repo, the environment variable ROS_PACKAGE_PATH must be extended to include this folder.

  2. The 'package' (repo) is compiled and installed using plain CMake (the YARP way) and the ROS_WS env var is set. (the name ROS_WS can be changed to whatever we like)
    This approach works like the iCub-Common package, so all packages which need to install ROS config file, will place them in the folder pointed to by ROS_WS
    In order to have ROS find this repo at runtime, the environment variable ROS_PACKAGE_PATH must be extended to include this folder.
    This approach mimic the behaviour of iCubContribCommon, but uses an env var to achieve the goal. Obviously the behaviour can be changed to use the same approach used by contrib if we like it more. I used an env var because it was faster to implement.

  3. The package is compiled using catkin ROS build system: this opens up 3 senarios:
    - catkin_make: launch and config files are not copied/installed. Doing 'source devel/setup.*sh" the files in the src will be used.
    - catkin_make install: launch and config files are installed in the install folder. Doing 'source devel/setup.*sh` the files in the install folder will be used.
    - catkin build: similar to catkin_make build. It installs by default
    In order to have ROS find this repo at runtime, the corresponding setup.bash have to be sourced, like in a normal catkin package.

  4. The package is compiled with ament build system. This is experimental and things in ROS2 may vary before official release.
    As stated in this page https://github.com/ros2/ros2/wiki/Migration-Guide ROS2 will not use xml launch files anymore, but python scripts instead. No ROS2 version of rosrun/roslaunch is ready yet. Right now we are installing launch and config files in ROS1 style for backward compatibility so the package can be compiled with ament and run with rosrun/launch for ROS1 modules.

There is some logic in the macro, so that the cmake is aware of what's going on and choose what to do depending on the environment it is compiled into.

For a package to use this installer it has to do:

## Install ROS config file in a ROS-like way
include(ROSconfigHelpers)
set_ros_config_install_prefix()
ROS_config_install()

It could be expanded to install other folders other then config and launch. File package.xml is copied as well.

@traversaro
Copy link
Member

traversaro commented Mar 22, 2017

Great! This is also related to robotology/icub-models-generator#28 .

Some comments:

  1. I would leave to the users the freedom to specify the location of where to install the ROS configuration files. ${{PROJECT_NAME}_DATA_INSTALL_DIR} is defined only if yarp_configure_external_installation(${PROJECT_NAME}) has been called. However, we have a lot of projects for which yarp_configure_external_installation is called with an argument different from ${PROJECT_NAME}, and the use of ${PROJECT_NAME} is neither enforced in the code or recommended in the documentation. In a lot of recent repository, for example, I started to just install data in ${YARP_DATA_INSTALL_DIR} (see the workflow explained in https://github.com/robotology/yarp/pull/1111/files) to avoid having an infinite list of YARP_DATA_DIRS in the superbuild configurations.

  2. I do not understand the use case. iCubContrib works by modifying the CMAKE_INSTALL_PREFIX, and if the CMAKE_INSTALL_PREFIX is modified all the variables used in 1. are modified accordingly. Furthermore, ROS_WS is a bit misleading because all the enviromental variables that start with ROS_ are tipically defined/used by ROS itself (see http://wiki.ros.org/ROS/EnvironmentVariables).

  3. & 4. I do not understand the use case. First, this is a repository that is using a plain CMake build system, so it will always use cmake as the "build system", even if it uses catkin or ament as "build tools", right? For the difference between "build system" and "build tools", see create build tool article ros2/design#115 , in particular https://github.com/ros2/design/blob/e99e8a966b1b12202717c1d4c15d72ea5ec8b685/articles/101_build_tool.md#build-tool-vs-build-system .

@traversaro
Copy link
Member

See https://github.com/gerkey/ros1_external_use#installing-for-use-by-tools-like-roslaunch for a "official" way of deal with ROS packages without using Catkin .

@barbalberto
Copy link
Author

Thanks. I can add the dummy .catkin file if it is useful. In my test it worked also without it, but should not harm having it.
I can remove the case 2, as discussed.

@barbalberto barbalberto changed the title Handle ROS config files - Proposal [WIP] Handle ROS config files - Proposal Apr 19, 2017
@traversaro
Copy link
Member

Yes, apparently in ROS documentation [1] they claim that the ROS_PACKAGE_PATH is not necessary anymore after the introduction of Catkin (basically the tools should search in the directory indicated by CMAKE_PREFIX_PATH), but I was not able to get to work rospack without the ROS_PACKAGE_PATH, so I suspect that ROS_PACKAGE_PATH is always necessary.

[1] : http://wiki.ros.org/ROS/EnvironmentVariables#ROS_PACKAGE_PATH

@pattacini pattacini closed this Jun 3, 2020
@pattacini pattacini deleted the launch_files branch June 3, 2020 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants