ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to install roscpp, sensor_msgs and pcl_ros on ubuntu?

asked 2020-01-17 16:20:48 -0500

Guerlando gravatar image

updated 2020-01-17 16:53:58 -0500

gvdhoorn gravatar image

I'm trying to compile a project that uses ROS. I don't know anything about ROS or catkin. I think ROS is a SDK for robots and catkin helps installing things. I know how CMake works. Here's my CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(quanergy_client_ros)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS   roscpp   sensor_msgs  pcl_ros )

The problem is that I can't find how to install these dependencies. I tried everything. Tried installing all ros related things, llike this: sudo apt install -y ros*. I tried building some of them from source, but I always end up with a project that depends on another project.

I then discovered rosdep, I installed but when I try it, I get

rosdep install roscpp 

ERROR: the following packages/stacks could not have their rosdep keys resolved to system dependencies: roscpp: No definition of [xmlrpcpp] for OS [debian]

The problem happens on debian but also on Ubuntu

I'm very confused on for what ROS, rosdep, catkin and other things are.

Can somebody help me?

edit retag flag offensive close merge delete

Comments

Would these be the instructions you're looking for: wiki/melodic/Installation?

Also: according to this page, the repository that hosts that package contains quite extensive build instructions:

image description

Did you not get those?

If not, I would suggest to ask Quanergy to support you.

gvdhoorn gravatar image gvdhoorn  ( 2020-01-17 16:54:44 -0500 )edit

@gvdhoorn I already did that but with an older version. I just tried now with melodic. After the installation, running rosdep install roscpp gives me ERROR: Rosdep cannot find all required resources to answer your query Missing resource roscpp

So how should I install roscpp sensor_msgs pcl_ros so I can build my CMake file? And do I build with cmake or with another tool?

Guerlando gravatar image Guerlando  ( 2020-01-17 17:16:50 -0500 )edit

@gvdhoorn thanks, I tried those instructions you added, but they're old, the repositories don't exist anymore. I have a folder of the project which has a CMakeLists with the dependencies I listed above. So I need a way to install those dependencies. This is my only chance of making this work

Guerlando gravatar image Guerlando  ( 2020-01-17 17:18:13 -0500 )edit

@gvdhoorn I made 4 different docker images just to try lots of things on ubuntu bionix and xenial, I installed multiple ros SDKs, but I always end up with the problem of not finding roscpp and the other 2 dependencies. I actually compiled roscpp somehow but then for the other dependencies I had one dependency depending on other forever and gave up on trying to compile everything manually. Isn't there a way to simply install roscpp sensor_msgs pcl_ros?

Guerlando gravatar image Guerlando  ( 2020-01-17 17:25:27 -0500 )edit

We don't have access to the sources you have, so we cannot verify which specific set of commands will work for you, which specific dependencies the package you're trying to build has or whether it would only build successfully on certain versions of OS and/or ROS.

There is nothing specifically difficult about all of this, but exact information is required, as @marguedas also commented.

And please also indicate whether you are trying to get familiar with ROS to actually start using it, or whether you are trying to build this one package. If the latter: please spend a few words on why you want to build this package.

gvdhoorn gravatar image gvdhoorn  ( 2020-01-18 04:12:10 -0500 )edit

Thanks @marguedas and @gvdhoorn, I uploaded the source here: https://github.com/lucaszanella/qqq/t... could you take a look? At the top of this repo, you can find the docker folder for which you can build everything up to the part of where the error happens (cmake can find roscpp). Note that it compiles two projects because the last one depends on the first.

Guerlando gravatar image Guerlando  ( 2020-01-18 08:12:09 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2020-01-17 17:43:37 -0500

marguedas gravatar image

updated 2020-01-18 19:39:54 -0500

Without any code or details it'll be hard for anyone here to support you. Given how old the code is you will likely run into issue when trying to compile it on more recent operating systems. As the instructions above refer to ROS Indigo you may have the most luck using that ROS EOL distro.

docker run -it --rm ros:indigo

apt update && apt upgrade -y
mkdir -p ~/catkin_ws/src && cd ~/catkin_ws/src
# creating a fake package with your packages as dependencies
# here you should mount / clone your package instead
catkin_create_pkg package_needing_pcl_ros roscpp pcl_ros sensor_msgs
cd ~/catkin_ws
rosdep update --include-eol-distro
rosdep install -y --from-paths src --ignore-src --rosdistro indigo

EDIT:

Removing the commented out code, removing catkin from source build and fixing up the rosdep + compile invocation, the Dockerfile would look like:

FROM ubuntu:xenial

COPY quanergy_client-master_xenial.zip /home/project/quanergy_client-master.zip
COPY quanergy_client_ros-master_xenial.zip /home/project/quanergy_client_ros-master.zip

RUN apt-get update && apt-get install -y cmake build-essential lsb-core unzip

RUN cd /home/project/ && unzip quanergy_client-master.zip && unzip quanergy_client_ros-master.zip

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y cmake git build-essential libboost-all-dev libpcl-dev libproj-dev libvtk6-dev libusb-1.0-0.dev

RUN cd /home/project/quanergy_client-master_xenial/quanergy_client-master && cmake . && make && make install && cd ..

RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'\
    && apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654\
    && apt-get update && apt-get install -y python-rosdep \
    && rosdep init && rosdep update 

RUN cd /home/project/ && cd quanergy_client_ros-master && ls\
    && rosdep install -y --from-paths . --ignore-src --rosdistro kinetic
RUN ln -s /usr/lib/x86_64-linux-gnu/libvtkCommonCore-6.2.so /usr/lib/x86_64-linux-gnu/libvtkproj4-6.2.so.6.2.0
RUN cd /home/project/ && cd quanergy_client_ros-master \
    && . /opt/ros/kinetic/setup.sh && cmake . && make
edit flag offensive delete link more

Comments

I almost made it work, but I don't know which structure my project must have. Currently:

quanergy_client_ros-master, the folder of the project, has

CMakeLists.txt LICENSE NVidiaDrivePX.md README.md include launch package.xml readme settings src

but in your example is it catkin_ws/src/package_needing_pcl_ros/ which has

CMakeLists.txt src ...

I tried doing this structure:

/home/project/src/quanergy_client_ros-master/src

which has

CMakeLists.txt LICENSE NVidiaDrivePX.md README.md include launch package.xml readme settings src

and then run

rosdep update --include-eol-distro rosdep install -y --from-paths src --ignore-src --rosdistro indigo

on /home/project/ just like you did, because it's the folder that contains the first src. But it didn't work, CMake complains about ropscpp not existing

Guerlando gravatar image Guerlando  ( 2020-01-17 19:40:53 -0500 )edit

rosdep update --include-eol-distro rosdep install -y --from-paths src --ignore-src --rosdistro indigo on /home/project/ just like you did, because it's the folder that contains the first src. But it didn't work,

What does "it didn't work" mean? What serie of command did you type? What was the error message?

CMake complains about ropscpp not existing

From that I'm going to guess that rosdep ran successfully and installed the missing packages but when trying to compile CMake is failing to find the roscpp package. Did you source /opt/ros/indigo/setup.bash before trying to compile ?

Please provide detailed information: OS + CPU architecture you're using, the exact list of commands you type, the actual error messages you get etc

marguedas gravatar image marguedas  ( 2020-01-18 01:33:59 -0500 )edit

I agree with @marguedas: there is insufficient information to help OP.

I would recommend OP also to first get some experience with ROS before trying to build packages from 3rd party sources.

gvdhoorn gravatar image gvdhoorn  ( 2020-01-18 04:08:33 -0500 )edit

@marguedas I did try source, or I think I did, because source wont work in docker so I simply did /bin/bash /opt/ros/____/setup.bash. Could you take a look in the source? https://github.com/lucaszanella/qqq/t... and in the root of the repo there's a dockerfile that compiles everything up to the point where the error happens. I don't understand what is happening, the installation of the 3 dependencies now work but cmake still won't find them

Guerlando gravatar image Guerlando  ( 2020-01-18 08:15:09 -0500 )edit

I did try source, or I think I did, because source wont work in docker so I simply did /bin/bash /opt/ros/____/setup.bash

Docker uses sh, you can use . instead of source: . /opt/ros/kinetic/setup.sh. This should be done after installing dependencies via rosdep and before building your workspace

the installation of the 3 dependencies now work

Are you sure ? The rosdep invocation seems off as it's pointing to the src folder while the current directory is already the ROS package directory. I don't think it's installing any dependencies. But I guess it doesnt matter as you're already installing ros-kinetic-desktop-full that happens to bring in all your dependencies


See updated answer above for an adjusted dockerfile.

marguedas gravatar image marguedas  ( 2020-01-18 19:45:16 -0500 )edit

@Guerlando I recommend you strongly to provide proper detailed information, commands and error messages in the future following our Support Guidelines and I echo @gvdhoorn recommendation to get familiar with ROS before trying to integrate it in a complex system or adding third party software on top

marguedas gravatar image marguedas  ( 2020-01-18 19:47:39 -0500 )edit

Thanks! I'm trying to lear by this example. However, when I run client_node, I get

/client_node /usr/local/lib/quanergy_client_ros/client_node: error while loading shared libraries: libroscpp.so: cannot open shared object file: No such file or directory

shouldn't libroscpp have been installed?

Guerlando gravatar image Guerlando  ( 2020-01-22 10:35:26 -0500 )edit

I'm trying to lear by this example

The ROS Tutorials, provide good and simple examples covering all the basic ROS concepts. Including how to build code using ROS tools and how to run ROS nodes.

I get /client_node /usr/local/lib/quanergy_client_ros/client_node: error while loading shared libraries: libroscpp.so: cannot open shared object file: No such file or directory

Again, if you don't provide detailed description as per Support Guidelines there is little chance you'll find help.

Considering that the original question has been answered "how to use rosdep to install dependencies". I suggest you accept the answer, get familiar with the tutorials and open a new question if you still face any issue.

marguedas gravatar image marguedas  ( 2020-01-23 03:42:41 -0500 )edit
0

answered 2020-01-17 16:55:11 -0500

A single google search for "how to install ROS" gives you this: http://wiki.ros.org/ROS/Installation. Pick your options and it'll walk you through it.

edit flag offensive delete link more

Comments

Thank. I had already tried that, but I did again with the latest version. After installing everything and trying rosdep install roscpp, I get ERROR: Rosdep cannot find all required resources to answer your query Missing resource roscpp

So how to install the dependencies for my project? I still don't understand that.

Guerlando gravatar image Guerlando  ( 2020-01-17 17:15:08 -0500 )edit

There's a tool called ROSDep that should help, an example use:

rosdep install --from-paths src --ignore-src --rosdistro eloquent -y

that will install the dependencies in your src directory of the rosdistro eloquent, replace with your needs.

stevemacenski gravatar image stevemacenski  ( 2020-01-17 17:56:16 -0500 )edit

Here's my structure:

quanergy_client_ros-master

, the folder of the project, has

CMakeLists.txt LICENSE NVidiaDrivePX.md README.md include launch package.xml readme settings src

where do I run rosdep exactly? I tried running inside quanergy_client_ros-master, didn't work (cmake compains no roscpp). I also tried running in the folder that contains quanergy_client_ros-master and modifying the command to rosdep install --from-paths quanergy_client_ros-master --ignore-src --rosdistro kinetic -y but it also complains about no roscpp

I can't understand what's happening

Guerlando gravatar image Guerlando  ( 2020-01-17 20:27:06 -0500 )edit

in the root of your workspace, so ~/path/to/catkin_ws/, not inside the packages

stevemacenski gravatar image stevemacenski  ( 2020-01-18 02:30:37 -0500 )edit

I stil get the roscpp missing from cmake error. If you have some time, could ou take a look? https://github.com/lucaszanella/qqq/t... this dockerfile will build everything up to the point of the roscpp fail. I tried everything!

Guerlando gravatar image Guerlando  ( 2020-01-18 18:35:39 -0500 )edit

Question Tools

Stats

Asked: 2020-01-17 16:20:48 -0500

Seen: 6,928 times

Last updated: Jan 18 '20