Ask Your Question
0

How to add .so file to catkin workspace

asked 2021-09-26 11:32:45 -0600

updated 2021-09-26 11:50:21 -0600

Environment ROS Noetic

I am trying to make an older package work in Noetic. I was able to compile rbdl library by:

$ git clone --recursive https://github.com/ORB-HD/rbdl-orb
$ mkdir rbdl-build
$ cd rbdl-build
$ cmake .. -DRBDL_BUILD_PYTHON_WRAPPER=ON -DCMAKE_INSTALL_PREFIX=~/catkin_ws/rbdl_ws/install -DRBDL_BUILD_ADDON_URDFREADER=ON -DRBDL_USE_ROS_URDF_LIBRARY=OFF -Wno-dev
$ make
$ make install

Now I create a new workspace:

$ mkdir -p talos_robot/src
$ cd talos_robot/src
$ catkin_init_workspace
$ cd ..
$ mkdir build
$ cd build
$ cmake ../src -DCMAKE_INSTALL_PREFIX=../install -DCATKIN_DEVEL_PREFIX=../devel
$ cd ..
$ cd src
$ git clone git clone https://github.com/pal-robotics/talos_robot.git
$ cd ..
$ make

Then I copied rbdl.so file into install folder

$ catkin_make install

But it's not picking it up, as I still get this error:

-- Could NOT find rbdl (missing: rbdl_DIR)
-- Could not find the required component 'rbdl'. 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/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "rbdl" with any of
  the following names:

    rbdlConfig.cmake
    rbdl-config.cmake

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


-- Configuring incomplete, errors occurred!
See also "/home/osilva/talos_robot/build/CMakeFiles/CMakeOutput.log".
See also "/home/osilva/talos_robot/build/CMakeFiles/CMakeError.log".

Below my CMakeLists.txt file:

# toplevel CMakeLists.txt for a catkin workspace
# catkin/cmake/toplevel.cmake

cmake_minimum_required(VERSION 3.0.2)

project(Project)

set(CATKIN_TOPLEVEL TRUE)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# search for catkin within the workspace
set(_cmd "catkin_find_pkg" "catkin" "${CMAKE_SOURCE_DIR}")
execute_process(COMMAND ${_cmd}
  RESULT_VARIABLE _res
  OUTPUT_VARIABLE _out
  ERROR_VARIABLE _err
  OUTPUT_STRIP_TRAILING_WHITESPACE
  ERROR_STRIP_TRAILING_WHITESPACE
)
if(NOT _res EQUAL 0 AND NOT _res EQUAL 2)
  # searching fot catkin resulted in an error
  string(REPLACE ";" " " _cmd_str "${_cmd}")
  message(FATAL_ERROR "Search for 'catkin' in workspace failed (${_cmd_str}): ${_err}")
endif()

# include catkin from workspace or via find_package()
if(_res EQUAL 0)
  set(catkin_EXTRAS_DIR "${CMAKE_SOURCE_DIR}/${_out}/cmake")
  # include all.cmake without add_subdirectory to let it operate in same scope
  include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE)
  add_subdirectory("${_out}")

else()
  # use either CMAKE_PREFIX_PATH explicitly passed to CMake as a command line argument
  # or CMAKE_PREFIX_PATH from the environment
  if(NOT DEFINED CMAKE_PREFIX_PATH)
    if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")
      if(NOT WIN32)
        string(REPLACE ":" ";" CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
      else()
        set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
      endif()
    endif()
  endif()

  # list of catkin workspaces
  set(catkin_search_path "")
  foreach(path ${CMAKE_PREFIX_PATH})
    if(EXISTS "${path}/.catkin")
      list(FIND catkin_search_path ${path} _index)
      if(_index EQUAL -1)
        list(APPEND catkin_search_path ${path})
      endif()
    endif()
  endforeach()

  # search for catkin in all workspaces
  set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE)
  find_package(catkin QUIET
    NO_POLICY_SCOPE
    PATHS ${catkin_search_path}
    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
  unset(CATKIN_TOPLEVEL_FIND_PACKAGE)

  if(NOT catkin_FOUND)
    message(FATAL_ERROR "find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was ...
(more)
edit retag flag offensive close merge delete

Comments

Found a way to compile it, by cloning a development version that I found after searching for a while:

git clone -b dae_meshes_with_color https://github.com/pal-robotics/talos_robot.git

However, I'd like to still how to be able to fix this as I am working on other older simulations as well.

osilva gravatar image osilva  ( 2021-09-26 17:14:19 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-09-26 19:29:48 -0600

miura gravatar image

I think it would be better to update talos_robot/talos_description/test/CMakeLists.txt which needs rbdl. I believe that if you add the path to FindRBDL.cmake in the following, you will be able to find the .so.

list(APPEND CMAKE_MODULE_PATH "Directory where FindRBDL.cmake is located")

It is possible that you may need to change the rbdl in find_package to RBDL.

By the way, this is not the main topic, but it looks like the only thing that needs rbdl is the test, and I think I can get it to work by deleting talos_robot/talos_description/test/.

edit flag offensive delete link more

Comments

1

Thank you I will give it a try. Interesting you said that regarding test module, I will start digging more too. Thank you again.

osilva gravatar image osilva  ( 2021-09-26 21:42:06 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2021-09-26 11:32:45 -0600

Seen: 56 times

Last updated: Sep 26 '21