rosin-project/rxros2

Update README with instructions of howto manually install RxROS2

Closed this issue Β· 13 comments

The README_CPP.md and README_PY.md should be updated with instructions of howto manually install RxROS2.

With the new repository layout, something like the following should work:

mkdir -p $HOME/rxros2_ws/src
cd $HOME/rxros2_ws/src
git clone https://github.com/rosin-project/rxros2.git
cd $HOME/rxros2_ws
rosdep update && sudo apt update
rosdep install --from-paths $HOME/rxros2_ws --ignore-src --rosdistro=foxy
colcon build

Then source install/setup.bash and the various rxros2 packages should be available to ros2 run.

I would suggest to add this to the repository level readme (#4).

The last command colcon build is not available on my machine. Is colcon not part of ROS1?

Colcon is the build tool used with ROS 2.

How do you build ROS 2 workspaces if you don't have Colcon?

what abour RxCpp library

This is currently "installed" using ExternalProject_Add(..):

################################################################################
# TODO: put a proper vendor package together
include(ExternalProject)
ExternalProject_Add(rxcpp-6c283f36
SOURCE_DIR rxcpp_src
URL https://github.com/ReactiveX/RxCpp/archive/v4.1.0.tar.gz
URL_MD5 6c283f36ce251f45146f7099aa9ef19a
# arbitrary
TIMEOUT 60
# we copy the headers out of the extracted source directly, so
# no need to configure, build or install anything.
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
# NOTE: this places a copy of the RxCpp headers in the public include path
# of this package. Users who depend on rxros2_cpp probably want access to
# those headers, but this is not nice, and we should put a proper vendor
# package together (or find some other way to package RxCpp for ROS 2).
install(
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/rxcpp_src/Rx/v2/src/rxcpp
DESTINATION include
)
################################################################################

Not very nice, but it did the trick.

Edit: just remembered how this works again.

rosdep will check which version of ROS you want to install dependencies for. It either uses the ROS_DISTRO env variable, the --rosdistro command line argument or the ROS_PYTHON_VERSION env variable for that.

If you have multiple versions of ROS installed, you'll have to make sure to either have sourced the correct setup.bash before invoking rosdep (as setup.bash will set the required env vars), or specify the target version manually (using --rosdistro=..).

On Ubuntu Bionic, you can install both ROS Melodic and ROS Eloquent, and you can have either the Python 2 or the Python 3 version of rosdep installed. The former will prefer pip, the latter pip3, but it will use the correct version if you do what I described above.

So in our case, we either:

  • update the rosdep install .. command to add --rosdistro=eloquent, or
  • make sure users have source /opt/ros/eloquent/setup.bash before invoking rosdep install ..

either of these two should result in rosdep using pip3 and then rx version 3.x gets installed.

I already added --rosdistro=foxy to the rosdep command in the instructions I gave in #2 (comment), and you updated them to --rosdistro=eloquent. That should have worked, but you have the wrong rosdep package installed (see below) which does not support all of this correctly.

After you correct your rosdep install, I would expect things to start working.

Btw, I also just noticed: you have a very old version of rosdep on your machine:

rosdep version: 0.11.8

We're currently at 0.19.x.

What is the output of dpkg -l | grep rosdep? I expect it returns python-rosdep2 0.11.8-1 for you.

Did you install python-rosdep2 by any chance? That's not the correct package, but an UpstreamPackages version.

I'd recommend you install either python-rosdep or python3-rosdep instead.

The problem is likely related to the version of ament_cmake used in Eloquent. It might not support CMake INTERFACE libraries.

Tbh the way ament_cmake is supposed to be used is rather confusing. The documentation is meager and examples are scarce.

I'll see what I can do, but it may mean we'd either ditch INTERFACE completely, or only support Foxy.

It is the ament_target_dependencies function that does not support the "INTERFACE" option. I tried to copy the foxy version of this function to the eloquent version. This only partly solves the problem - the problem is now moved to the compilation of the examples. They fail with an error saying that the rxros2/rxros2.h file does not exists :-(

All the tests, benchmarks and development in general have been on eloquent release. I would be very sad if we can not support this platform. Especially since there are some deadlock issues with the Python implementation on the foxy platform - it does not allow subscriptions of a topic to be added after the spinner has been called.

I have also tried to replace "INTERFACE" with "PUBLIC", but this requires some source files to be linked into a library. I do however think that this may be a way to solve the problem. We generate a dummy library that does absolutely nothing and still expose the rxros2.h file to be included by other projects.

Let me know how you proceed Gijs. I will not do anything more one this problem until I hear what solution you think is the best.

Something to keep in mind / realise: Eloquent is only officially supported till November this year.

Not saying we should already ignore it, but it will become unsupported quite soon.

Yes, I tried yesterday with the dashing distribution. It behaved exactly like eloquent :-( I will update the installation instructions tomorrow and only mention foxy as our supported platform. Foxy is a risky business to switch to now since we have not tested this platform for more than a couple of hours.

I will then try to find a solution for the rclpy problem (it will not be easy, but maybe there is a place to issue a problem report), and also see if I can add a dummy.cpp file to the rxros2_cpp folder so that we may use PUBLIC instead of INTERFACE in the installation instructions.

We merged #10, which addresses this.