Robotics StackExchange | Archived questions

ROS on Raspberry PI

Hi. I want to run my own ros node on a raspberry pi which is running a Ubiquity distro . I have a ubuntu here to cross compile my ros node. I am able to cross compile a hello world example without any problems. But when i try to integrate a ros part i always got an error. I use cmake and the following CMakeLIsts.txt file

cmake_minimum_required(VERSION 2.8.3)
project(hello_world)

set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads REQUIRED)


## Find catkin and any catkin packages
find_package(catkin REQUIRED COMPONENTS 
        roscpp)

## Declare ROS messages and services
##add_message_files(DIRECTORY msg FILES Num.msg)
##add_service_files(DIRECTORY srv FILES AddTwoInts.srv)

## Generate added messages and services
##generate_messages(DEPENDENCIES std_msgs)

## Declare a catkin package
catkin_package(CATKIN_DEPENDS roscpp)

##set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror -pthread")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
include_directories(include ${catkin_INCLUDE_DIRS})

add_executable(hello_world ../src/main.cpp)
target_link_libraries(hello_world ${catkin_LIBRARIES})
##target_link_libraries(hello_world)

But i always got the following error:

-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
CMake Error at /opt/ros/kinetic/share/catkin/cmake/assert.cmake:17 (message):


  Assertion failed: check for file existence, but filename
  (RT_LIBRARY-NOTFOUND) unset.  Message: RT Library

Call Stack (most recent call first):
  /opt/ros/kinetic/share/catkin/cmake/tools/rt.cmake:42 (assert_file_exists)
  /opt/ros/kinetic/share/catkin/cmake/all.cmake:147 (include)
  /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:20 (include)
  CMakeLists.txt:8 (find_package)


-- Configuring incomplete, errors occurred!

Does anybody knows what to do?

Asked by Fresh on 2018-06-07 06:34:45 UTC

Comments

What is your linx distro on raspberry ? Why do you need to cross compile on your desktop for the raspberry ?

Asked by Vincent R on 2018-06-22 17:22:36 UTC

@Vincent R : It can be useful when your compilation takes a lot of time on your raspberry (in my case sometimes the compilation even fails one time out of two so it's a really good alternative)

Asked by Delb on 2018-06-28 01:25:07 UTC

Answers

I also struggled with the RT_LIBRARY-NOTFOUND issue and managed to solved it thanks to @duviros 's answer from #q207608 (check it out his little tutorial helped me a lot).

In ordrer to solve the RT_LIBRARY you have to add this line in your toolchain.cmake file :

# Set the target architecture
set(CMAKE_LIBRARY_ARCHITECTURE arm-linux-gnueabihf)

Replace arm-linux-gnueabihf with your compiler (but it should be the same if you are cross compiling for raspberry) and you shouldn't get the error anymore.

Asked by Delb on 2018-06-28 01:21:37 UTC

Comments

thanks, helped me as well!

Asked by r7vme on 2020-03-12 18:38:16 UTC