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

Could not change DDS in ROS 2 Humble #2910

Closed
2 tasks done
atinfinity opened this issue Jan 15, 2025 · 8 comments
Closed
2 tasks done

Could not change DDS in ROS 2 Humble #2910

atinfinity opened this issue Jan 15, 2025 · 8 comments

Comments

@atinfinity
Copy link

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

Environment

  • macOS Sonoma 14.4
  • pixi 0.40.1

Steps to reproduce

Install pixi

curl -fsSL https://pixi.sh/install.sh | bash

Create project

pixi init my_ros2_project -c robostack-staging -c conda-forge
cd my_ros2_project

Install package

pixi add ros-humble-desktop
pixi add ros-humble-rmw-fastrtps-cpp

Change DDS

I set RMW_IMPLEMENTATION to specify DDS.

export RMW_IMPLEMENTATION=rmw_fastrtps_cpp

And, I checked current DDS.

pixi run ros2 doctor --report

But, I could not change DDS.

   RMW MIDDLEWARE
middleware name    : rmw_cyclonedds_cpp

Issue description

I used pixi for the development of ROS2(https://pixi.sh/latest/tutorials/ros2/).
But, I could not change DDS.

Expected behavior

I set RMW_IMPLEMENTATION to specify DDS.

export RMW_IMPLEMENTATION=rmw_fastrtps_cpp

And, I checked current DDS.

pixi run ros2 doctor --report

I expect that the following message is displayed.

   RMW MIDDLEWARE
middleware name    : rmw_fastrtps_cpp
@ruben-arts
Copy link
Contributor

TL;DR: It will be fixed soon, add export RMW_IMPLEMENTATION=rmw_fastrtps_cpp to a activate.sh file in the root of your project and add that to your pixi.toml:

[activation]
scripts = ["activate.sh"]

This variable will be overwritten by the activation of your environment, as there is a file in the activation scripts of ros-humble-ros-workspace that adds the following:

case "$OSTYPE" in
  darwin*)  export ROS_OS_OVERRIDE="conda:osx"; export RMW_IMPLEMENTATION="rmw_cyclonedds_cpp";;
  linux*)   export ROS_OS_OVERRIDE="conda:linux";;
esac

This is a bug in that package and should be fixed upstream on Robostack. I've tried to fix it in this PR. If I was correct this should be fixed later. IF

As a quick workaround, you could add a file to the project activate.sh:

export RMW_IMPLEMENTATION=rmw_fastrtps_cpp

And add it as a script to the activation:

[activation]
scripts = ["activate.sh"]

This doesn't work with the [activation.env] as they are evaluated before the scripts. The [activation.scripts] are added after all other activation scripts.

@atinfinity
Copy link
Author

@ruben-arts

As a quick workaround, you could add a file to the project activate.sh:

export RMW_IMPLEMENTATION=rmw_fastrtps_cpp

And add it as a script to the activation:

[activation]
scripts = ["activate.sh"]

I tried it. And, I run ros2 doctor --report.
As a result, rmw_fastrtps_cpp is displayed.

   RMW MIDDLEWARE
middleware name    : rmw_fastrtps_cpp

But, I failed to subscribe topic in this case.

Pub

pixi run ros2 topic pub --rate 1 /turtle1/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.8}}"

Sub

pixi run ros2 topic list
/parameter_events
/rosout

@ruben-arts
Copy link
Contributor

I'm not able to reproduce that issue. Are you by any change mixing it with this issue ?

@atinfinity
Copy link
Author

atinfinity commented Jan 15, 2025

@ruben-arts

I'm not able to reproduce that issue. Are you by any change mixing it with this issue?

I recreate pixi project. But, this problem is reproduced. I'll investigate.

[pixi.toml]

[project]
authors = ["atinfinity <[email protected]>"]
channels = ["robostack-staging", "conda-forge"]
description = "Add a short description here"
name = "my_ros2_project"
platforms = ["osx-arm64"]
version = "0.1.0"

[tasks]

[dependencies]
ros-humble-desktop = ">=0.10.0,<0.11"
ros-humble-rmw-fastrtps-cpp = ">=6.2.7,<7"

[activation]
scripts = ["activate.sh"]

[activate.sh]

export RMW_IMPLEMENTATION=rmw_fastrtps_cpp

@wep21
Copy link

wep21 commented Jan 15, 2025

I can't reproduce the issue too.

❯ cat pixi.toml
[project]
authors = ["wep21 <[email protected]>"]
channels = ["robostack-staging", "conda-forge"]
description = "Add a short description here"
name = "ros2_pixi"
platforms = ["osx-arm64"]
version = "0.1.0"

[tasks]
build = "colcon build --symlink-install"

[dependencies]
ros-humble-desktop = ">=0.10.0,<0.11"
ros-humble-rmw-fastrtps-cpp = ">=6.2.7,<7"

[activation]
scripts = [
  "activate.sh",
  "install/setup.sh",
]
❯ pixi run ros2 doctor -r | grep middleware
/Users/daisuke/workspace/ros2_pixi/.pixi/envs/default/lib/python3.11/site-packages/ros2doctor/api/__init__.py: 154: UserWarning: Fail to call PackageReport class functions.
middleware name    : rmw_fastrtps_cpp
❯ pixi run ros2 topic list
/parameter_events
/rosout
/turtle1/cmd_vel
❯ pixi run ros2 topic echo /turtle1/cmd_vel
linear:
  x: 2.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 1.8
---

@traversaro
Copy link
Contributor

As RoboStack/ros-humble#244 was merged, it you update ros-humble-ros-workspace to the latest build, the original problem of this issue should be solved, and the workaround mentioned by @ruben-arts should not be neccessary anymore.

@ruben-arts
Copy link
Contributor

Thanks @traversaro

This does now work like expected for me:

[project]
channels = ["robostack-staging", "conda-forge"]
name = "my_ros2_project"
platforms = ["osx-arm64"]

[activation.env]
RMW_IMPLEMENTATION="rmw_fastrtps_cpp"

[dependencies]
ros-humble-desktop = ">=0.10.0,<0.11"

Note: run pixi update ros-humble-ros-workspace to refresh the environment with the latest version.

@atinfinity
Copy link
Author

Thank you. I resolved this problem.

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

No branches or pull requests

4 participants