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

How to create a string message in a ROS package with catkin correctly?

asked 2019-09-24 17:40:41 -0500

notSoTechnical gravatar image

updated 2019-09-24 23:24:15 -0500

jayess gravatar image

This is the output of catkin_make that shows an error.

notsotechnical@notsotechnical-VirtualBox:~/catkin_ws$ catkin_make
        Base path: /home/notsotechnical/catkin_ws
        Source space: /home/notsotechnical/catkin_ws/src
        Build space: /home/notsotechnical/catkin_ws/build
        Devel space: /home/notsotechnical/catkin_ws/devel
        Install space: /home/notsotechnical/catkin_ws/install
        ####
        #### Running command: "make cmake_check_build_system" in "/home/notsotechnical/catkin_ws/build"
        ####
        -- Using CATKIN_DEVEL_PREFIX: /home/notsotechnical/catkin_ws/devel
        -- Using CMAKE_PREFIX_PATH: /opt/ros/melodic
        -- This workspace overlays: /opt/ros/melodic
        -- Using PYTHON_EXECUTABLE: /usr/bin/python
        -- Using Debian Python package layout
        -- Using empy: /usr/bin/empy
        -- Using CATKIN_ENABLE_TESTING: ON
        -- Call enable_testing()
        -- Using CATKIN_TEST_RESULTS_DIR: /home/notsotechni
        cal/catkin_ws/build/test_results
        -- Found gmock sources under '/usr/src/googletest': gmock will be built
        -- Found gtest sources under '/usr/src/googletest': gtests will be built
        -- Using Python nosetests: /usr/bin/nosetests-2.7
        -- catkin 0.7.17
        -- BUILD_SHARED_LIBS is on
        -- BUILD_SHARED_LIBS is on
        -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        -- ~~  traversing 1 packages in topological order:
        -- ~~  - repo_name_hw2
        -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        -- +++ processing catkin package: 'repo_name_hw2'
        -- ==> add_subdirectory(repo_name_hw2)
        -- Could NOT find roscpp (missing: roscpp_DIR)
        -- Could not find the required component 'roscpp'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
        CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
          Could not find a package configuration file provided by "roscpp" with any
          of the following names:

            roscppConfig.cmake
            roscpp-config.cmake

          Add the installation prefix of "roscpp" to CMAKE_PREFIX_PATH or set
          "roscpp_DIR" to a directory containing one of the above files.  If "roscpp"
          provides a separate development package or SDK, be sure it has been
          installed.
        Call Stack (most recent call first):
          repo_name_hw2/CMakeLists.txt:10 (find_package)


        -- Configuring incomplete, errors occurred!
        See also "/home/notsotechnical/catkin_ws/build/CMakeFiles/CMakeOutput.log".
        See also "/home/notsotechnical/catkin_ws/build/CMakeFiles/CMakeError.log".
        Makefile:334: recipe for target 'cmake_check_build_system' failed
        make: *** [cmake_check_build_system] Error 1
        Invoking "make cmake_check_build_system" failed
        notsotechnical@notsotechnical-VirtualBox:~/catkin_ws$

I also tried the following:

notsotechnical@notsotechnical-VirtualBox:~$ export CMAKE_PREFIX_PATH=/home/notsotechnical/Programs
notsotechnical@notsotechnical-VirtualBox:~$ echo $CMAKE_PREFIX_PATH
/home/notsotechnical/Programs
notsotechnical@notsotechnical-VirtualBox:~$

Update

Hey I got rid of thw following errors by reinstalling ROS melodic:

Could not find a package configuration file provided by "roscpp" with any of the following names:

        roscppConfig.cmake
        roscpp-config.cmake

However, I got more errors :(

notsotechnical@notsotechnical-VirtualBox:~/catkin_ws$ catkin_make
Base path: /home/notsotechnical/catkin_ws
Source space: /home/notsotechnical/catkin_ws/src
Build space: /home/notsotechnical/catkin_ws/build
Devel space: /home/notsotechnical/catkin_ws/devel
Install space: /home/notsotechnical/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/notsotechnical/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/notsotechnical/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/melodic
-- This workspace overlays: /opt/ros/melodic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/notsotechnical/catkin_ws/build/test_results
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.17
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 2 packages in topological order:
-- ~~  - repo_name_hw2 ...
(more)
edit retag flag offensive close merge delete

Comments

We're going to need some more information here. Can you show us your code (source, CMakeLists.txt, etc.) in addition to this output?

jayess gravatar image jayess  ( 2019-09-24 19:31:01 -0500 )edit
notSoTechnical gravatar image notSoTechnical  ( 2019-09-24 20:07:11 -0500 )edit

I also tried the following: notsotechnical@notsotechnical-VirtualBox:~$ export CMAKE_PREFIX_PATH=/home/notsotechnical/Programs notsotechnical@notsotechnical-VirtualBox:~$ echo $CMAKE_PREFIX_PATH /home/notsotechnical/Programs notsotechnical@notsotechnical-VirtualBox:~$

notSoTechnical gravatar image notSoTechnical  ( 2019-09-24 20:36:12 -0500 )edit

Can you please update your question with the contents of the file instead of linking to it? That keeps the question self-contained (and useful to others in the future) if/when that link no longer works

jayess gravatar image jayess  ( 2019-09-24 20:50:22 -0500 )edit
1

It would also help to know what you have in package.xml, since it appears that your package is not able to find roscpp package. It is in CMakeLists.txt. If it is not declared as a dependency in package.xml that could explain the error.

Thomas D gravatar image Thomas D  ( 2019-09-24 20:52:28 -0500 )edit
1

When pasting code/files please remove the commented out boilerplate. Having a minimal working example makes it easier to see what is going on.

Thomas D gravatar image Thomas D  ( 2019-09-24 20:53:43 -0500 )edit

I'm not sure why, but it says "This content is forbidden" whenever I paste something that is long in the comment. package.xml: https://drive.google.com/file/d/1k2Wn...

notSoTechnical gravatar image notSoTechnical  ( 2019-09-24 21:20:41 -0500 )edit

@notSoTechnical That's because comments aren't for code, files, etc., they're for shorter exchanges. Codes, files, etc. should be put in questions as an update.

jayess gravatar image jayess  ( 2019-09-24 23:26:29 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-09-24 21:56:33 -0500

Thomas D gravatar image

You have two options:

  • Add the following line to package.xml:

<depend>roscpp</depend>

  • According to your CMakeLists.txt you are not building a library or executable, only messages. Therefore, you could remove roscpp from your CMakeLists.txt file. You could also remove the include_directories() line from CMakeLists.txt for now.

If you were to add code into the repo_name_hw2 package, you would need to go with Option 1. If you are only going to have messages/services/actions defined in the repo_name_hw2 package you would probably want to go with Option 2.

edit flag offensive delete link more

Comments

Hey Tom! Thanks! I deleted roscpp and it seemed working... until I can't display the message. Any idea? https://answers.ros.org/question/3338...

notSoTechnical gravatar image notSoTechnical  ( 2019-09-24 23:37:28 -0500 )edit
1

@notSoTechnical: the enthusiasm is appreciated, but could you please follow up on your open questions first? Right now you have a flurry of questions open, with no clear resolution, and you jumping to different subjects in the comments beneath the potential answers.

I'd recommend to be a little more methodical in troubleshooting and when interacting with forum members here.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-25 02:10:24 -0500 )edit

@gvdhoorn Sorry, I'm new. I will be more methodical in the future

notSoTechnical gravatar image notSoTechnical  ( 2019-09-25 12:13:52 -0500 )edit

No need to apologise. Just keep it in mind.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-25 13:10:44 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-09-24 17:40:41 -0500

Seen: 303 times

Last updated: Sep 24 '19