rosin-project / rxros2

Reactive programming for ROS 2
20 stars 2 forks source link

Update README with instructions of howto manually install RxROS2 #2

Closed henrik7264 closed 4 years ago

henrik7264 commented 4 years ago

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

gavanderhoorn commented 4 years ago

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).

henrik7264 commented 4 years ago

Hi Gijs,

Tried the below installation procedure on a completely clean installation of Ubuntu 20.04 + ROS2 Foxy Desktop.

I can see it installs the RxPy library OK, but what abour RxCpp library? The last command colcon build is not available on my machine. Is colcon not part of ROS1?

/Henrik

gavanderhoorn commented 4 years ago

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(..):

https://github.com/rosin-project/rxros2/blob/606d016c31b2c78cede0ab855275dcb03d1f7d04/rxros2_cpp/CMakeLists.txt#L14-L39

Not very nice, but it did the trick.

henrik7264 commented 4 years ago

Hi Gijs,

Yes I remember, I have to install this colon stuff separately. Sorry for the inconvenience. It all works as expected 😊.

/Henrik

henrik7264 commented 4 years ago

Hi Gijs,

Tried an installation with Ubuntu 18.04, ROS2 eloquent-destop.

When I execute the command

rosdep install --from-paths $HOME/rxros2_ws --ignore-src --rosdistro=eloquent

I get the following error.

ERROR: Rosdep experienced an internal error.
Please go to the rosdep page [1] and file a bug report with the message below.
[1] : http://www.ros.org/wiki/rosdep

rosdep version: 0.11.8

Bad installer [pip]: [Errno 2] No such file or directory

The problem is the pip command that is not installed on my machine. I installed it and the rosdep command works

executing command [sudo -H pip install -U rx]
Collecting rx
  Downloading https://files.pythonhosted.org/packages/33/0f/5ef4ac78e2a538cc1b054eb86285fe0bf7a5dbaeaac2c584757c300515e2/Rx-1.6.1-py2.py3-none-any.whl (179kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 184kB 2.7MB/s
Installing collected packages: rx
Successfully installed rx-1.6.1

But it installs version 1.6 of the RxPy library. This is an older version of the library that is not compatible with RxROS2 which requires version 3.1

I have been trying all kinds of hacks to find a work around for this problem, but I have not had any success. Have you any ideas of how to resolve this problem?

/Henrik

gavanderhoorn commented 4 years ago

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:

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 https://github.com/rosin-project/rxros2/issues/2#issuecomment-697939608, 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.

gavanderhoorn commented 4 years ago

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.

henrik7264 commented 4 years ago

Hi Gijs,

No I have no ROS1 on any of the machines. It is completely clean installations (VMware images) consisting of

Setup/image 1: Ubuntu 20.04 ROS2 foxy (desktop version) RxROS2

Setup/image 2: Ubuntu 18.04 ROS2 eloquent (desktop version) RxROS2

The purpose is to test installation and to test if RxROS2 (the examples) performs well on the two platforms.

Setup 1: Installation is OK, Code is not OK: I have seen something that looks like a deadlock or synchronization issue when I run the β€œros2 run rxros2_py_examples listener_new_style”. I shall add a PR.

Setup 2: Installation is not OK. Thanks for all the information you provided. The issue was as you expected that I had installed a the wrong version of rosdep. This is now fixed and the correct version of the RxPY library is installed. The final issue I need you to help me with is the β€œcolcon build” command. It return the following error:

hl@ubuntu:~/rxros2_ws$ colcon build Starting >>> rxros2_cpp Starting >>> rxros2_py --- stderr: rxros2_cpp
CMake Error at /opt/ros/eloquent/share/ament_cmake_target_dependencies/cmake/ament_target_dependencies.cmake:52 (message): ament_target_dependencies() the passed package name 'INTERFACE' was not found before Call Stack (most recent call first): CMakeLists.txt:56 (ament_target_dependencies)


Failed <<< rxros2_cpp [0.43s, exited with code 1] Aborted <<< rxros2_py [0.54s]

Summary: 0 packages finished [0.68s] 1 package failed: rxros2_cpp 1 package aborted: rxros2_py 1 package had stderr output: rxros2_cpp 2 packages not processed

I have again tried to resolve the issue, but I need much time to find a solution. Does it give you any hints of what is wrong?

/Henrik

gavanderhoorn commented 4 years ago

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.

henrik7264 commented 4 years ago

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.

gavanderhoorn commented 4 years ago

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.

henrik7264 commented 4 years ago

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.

gavanderhoorn commented 4 years ago

We merged #10, which addresses this.