Skip to content

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Apr 25, 2025

gz-transport15 depends on ros2 repo's ros-jazzy-zenoh-cpp-vendor package. We need to source the ros setup.bash script to find this package

Signed-off-by: Ian Chen <ichen@openrobotics.org>
@iche033 iche033 requested a review from j-rivero as a code owner April 25, 2025 00:16
@iche033 iche033 marked this pull request as draft April 25, 2025 00:16
@iche033 iche033 force-pushed the iche033/transport_ros_setup branch 3 times, most recently from 775fc7a to 35399e9 Compare April 25, 2025 01:00
@iche033
Copy link
Contributor Author

iche033 commented Apr 25, 2025

@j-rivero, looking to get some advice from you regarding the best way to setup up ROS build env in the docker container. I think the source /opt/ros/jazzy/setup.bash cmd I added in build.sh does not seem to has an effect so gz-transport is not able to find zenoh_cpp_vendor package in the docker container (the package is installed successfully though).

Example console log: https://build.osrfoundation.org/job/gz_transport-ci-pr_any-noble-amd64/113/consoleFull#console-section-6 (in sourcing ros setup script section).

Any pointers on what I could be doing wrong?

iche033 added 2 commits April 30, 2025 03:13
Signed-off-by: Ian Chen <ichen@openrobotics.org>
Signed-off-by: Ian Chen <ichen@openrobotics.org>
@iche033
Copy link
Contributor Author

iche033 commented Apr 30, 2025

@j-rivero, looking to get some advice from you regarding the best way to setup up ROS build env in the docker container. I think the source /opt/ros/jazzy/setup.bash cmd I added in build.sh does not seem to has an effect so gz-transport is not able to find zenoh_cpp_vendor package in the docker container (the package is installed successfully though).

Example console log: https://build.osrfoundation.org/job/gz_transport-ci-pr_any-noble-amd64/113/consoleFull#console-section-6 (in sourcing ros setup script section).

Any pointers on what I could be doing wrong?

It could be related to ament/ament_cmake#304.

I made some changes in source repo (gazebosim/gz-transport#614) to set CMAKE_PREFIX_PATH for finding zenoh packages installed by zenoh_cpp_vendor. Not sure why I don't have to do this when testing locally.

Here's a test build of this branch with gazebosim/gz-transport#614

https://build.osrfoundation.org/job/gz_transport-ci-pr_any-noble-amd64/130/

Build Status

Relevant console output shows gz-transport now finds zenoh packages:

-- defined lib target zenohcxx::zenohc for zenohc::lib
-- Looking for zenohcxx and zenohc - found

@iche033 iche033 marked this pull request as ready for review April 30, 2025 03:32
fi

if [[ ${GZ_TRANSPORT_MAJOR_VERSION} -ge 15 ]]; then
export ROS_DISTRO="jazzy"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export ROS_DISTRO="jazzy"
export ROS_DISTRO_SETUP_NEEDED="jazzy"

I would not mess with defining ROS_DISTRO but seems safer to me to inject a new variable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also a comment on why we need this ROS package

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed to ROS_DISTRO_SETUP_NEEDED and added comment. e25781b

fi
done

if [[ -n ${ROS_DISTRO} ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Change variable name accordingly here with the comment above. Also please include a comment on why we are using this in the generic_linux_compilation (the fact of using the zenoh vendor for transport) since there are other scripts dealing with ROS.

Copy link
Contributor Author

@iche033 iche033 Apr 30, 2025

Choose a reason for hiding this comment

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

updated var and added comment e25781b, 5cefac7.

Actually if there's a better way to setup ROS env, let me know as well. I'm open to changing the implementation. I saw that there is some logic to setup ROS env in boilerplate_prepare.sh but I don't see it sourcing the setup script there. Maybe the alternative is to move the logic there.

iche033 and others added 3 commits April 30, 2025 22:09
Signed-off-by: Ian Chen <ichen@openrobotics.org>
Signed-off-by: Ian Chen <ichen@openrobotics.org>
Signed-off-by: Jose Luis Rivero <jrivero@honurobotics.com>
@j-rivero
Copy link
Contributor

j-rivero commented May 5, 2025

The idea was to use ROS_DISTRO_SETUP_NEEDED all around to host the ROS 2 variable and leave the sourcing of the setup.bash file to do the rest of the magic f0f4639.

@j-rivero
Copy link
Contributor

With the current setup, @iche033 where are we defined the ros-jazzy-zenoh-vendor dependency? In packages.apt?

@j-rivero j-rivero self-requested a review May 13, 2025 16:17
@iche033
Copy link
Contributor Author

iche033 commented May 13, 2025

With the current setup, @iche033 where are we defined the ros-jazzy-zenoh-vendor dependency? In packages.apt?

yes we put it in pacakges-noble.apt in gz-transport

@iche033
Copy link
Contributor Author

iche033 commented May 13, 2025

started another test build with latest changes from this PR:

Build Status

hmm zenoh is not found

-- Looking for zenohc - not found

-- Looking for zenohcxx - not found

-- Looking for zenohcxx - not found

In this commit: f0f4639, the export ROS_DISTRO=${ROS_DISTRO} line is removed. I think that was what made it work before.

@j-rivero
Copy link
Contributor

j-rivero commented May 15, 2025

Ouch, I was expecting the source of setup.bash to set the ROS_DISTRO for us. Like this on my local system:

~echo ${ROS_DISTRO}

~. /opt/ros/jazzy/setup.bash 
~echo ${ROS_DISTRO}
jazzy

Inspecting the setup a little bit it is possible that we will need the package ros-jazzy-ros-environment to make it work in this way.

Let me revert the changes to the variable name and use directly ROS_DISTRO. I prefer to avoid adding new ROS dependencies if we can set it up correctly this way.

@iche033
Copy link
Contributor Author

iche033 commented May 15, 2025

new build with gazebosim/gz-transport#635 that installs ros-jazzy-ros-environment:

Build Status

gz-transport successfully finds zenoh:

-- defined lib target zenohcxx::zenohc for zenohc::lib
-- Looking for zenohcxx - found

-- Looking for zenohcxx and zenohc - found

@j-rivero
Copy link
Contributor

new build with gazebosim/gz-transport#635 that installs ros-jazzy-ros-environment:

Great, thanks Ian !

@j-rivero j-rivero merged commit 920c813 into master May 16, 2025
3 checks passed
@j-rivero j-rivero deleted the iche033/transport_ros_setup branch May 16, 2025 10:35
@scpeters
Copy link
Contributor

gazebosim/gz-transport#634 is failing since this was merged

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