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

[feature] Add ROSEnv generator integration for ROS2 builds #17110

Merged
merged 18 commits into from
Oct 29, 2024

Conversation

danimtb
Copy link
Member

@danimtb danimtb commented Oct 3, 2024

Changelog: Feature: Add ROSEnv generator integration for ROS2 (Robot Operating System).
Docs: Omit

Related to #17055

This a generator with a new approach: Set the build and run environment before a colcon build in ROS.

The generator should be used together with CMakeDeps and CMaketoolchain generators as it uses the files generated by those as well.

The ROSEnv generator generates a file called 'conanrosenv.bash' that should be sourced before the build.

Example:

$ conan install conanfile.txt --output-folder install/conan
$ source install/conan/conanrosenv.sh
$ colcon build
...
$ source install/setup.bash
$ ros2 run <pkg> <executable>
  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

conan/tools/ros/rosenv.py Outdated Show resolved Hide resolved
conan/tools/ros/rosenv.py Outdated Show resolved Hide resolved
test/integration/tools/ros/test_rosenv.py Outdated Show resolved Hide resolved
@danimtb danimtb marked this pull request as ready for review October 4, 2024 15:02
@danimtb danimtb marked this pull request as draft October 14, 2024 09:00
@danimtb danimtb marked this pull request as ready for review October 15, 2024 08:56
@memsharded memsharded self-assigned this Oct 17, 2024
Co-authored-by: Carlos Zoido <mrgalleta@gmail.com>
conan/tools/ros/rosenv.py Outdated Show resolved Hide resolved
Comment on lines 23 to 25
output_folder = self._conanfile.generators_folder
self.variables.setdefault("CMAKE_TOOLCHAIN_FILE",
os.path.join(output_folder, "conan_toolchain.cmake"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
output_folder = self._conanfile.generators_folder
self.variables.setdefault("CMAKE_TOOLCHAIN_FILE",
os.path.join(output_folder, "conan_toolchain.cmake"))
self.variables.setdefault("CMAKE_TOOLCHAIN_FILE",
os.path.join(self._conanfile.generators_folder, "conan_toolchain.cmake"))

The output_folder is a different concept in Conan, the cli arg --output-folder, better avoid it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conan install ...
. rosenv => ``conanbuild.sh && . conanrun.sh``
(conanbuid.sh => rosenv.sh)
. conanbuild.sh && . conanrun.sh
colcon build 
. install.setup.bash
execute app

conan/tools/ros/rosenv.py Outdated Show resolved Hide resolved
@czoido czoido added this to the 2.9.0 milestone Oct 28, 2024
conan/tools/ros/rosenv.py Outdated Show resolved Hide resolved
conan/tools/ros/rosenv.py Outdated Show resolved Hide resolved
conan/tools/ros/rosenv.py Outdated Show resolved Hide resolved
@czoido czoido merged commit 05be841 into conan-io:develop2 Oct 29, 2024
2 checks passed
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