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

rabee's profile - activity

2017-12-29 03:48:35 -0500 received badge  Famous Question (source)
2017-10-18 14:10:04 -0500 received badge  Notable Question (source)
2017-09-06 15:47:41 -0500 commented answer Linking external headers file in ROS package

No worries. Will do so. As to your suggestions: Yes, those are superfluous, removing them had no effect Again, not nee

2017-09-06 15:47:22 -0500 received badge  Popular Question (source)
2017-09-06 15:47:11 -0500 commented answer Linking external headers file in ROS package

No worries. Will do so. As to your suggestions: Yes, those are superfluous, removing them had no effect Again, not nee

2017-09-06 15:45:36 -0500 commented answer Linking external headers file in ROS package

No worries. Will do so. As to your suggestions: 1. Yes, those are superfluous. Removing them had no effect. 2. Again,

2017-09-06 15:41:06 -0500 marked best answer Linking external headers file in ROS package

I am trying to use the Kilobot simulator Kilombo with a ROS package. I am installing Kilombo as normal as a system library. I am then trying to include the Kilombo header file inside the ROS package to create a Kilombo simulation. The CMakeLists.txt of Kilombo looks like this:

add_library(sim display.c skilobot.c kbapi.c params.c stateio.c runsim.c neighbors.c distribution.c gfx/SDL_framerate.c gfx/SDL_gfxPrimitives.c gfx/SDL_gfxBlitFunc.c gfx/SDL_rotozoom.c)

add_library(headless skilobot.c kbapi.c params.c stateio.c runsim.c neighbors.c distribution.c)
set_target_properties(headless PROPERTIES COMPILE_DEFINITIONS "SKILO_HEADLESS")

if(CMAKE_COMPILER_IS_GNUCXX)
    add_definitions(-std=c99)
    add_definitions("-Wall -O2 -g")
#    add_definitions("-Wall -O3 -march=native -g")  
endif()

INSTALL(TARGETS sim headless
  ARCHIVE DESTINATION lib
)

INSTALL(FILES kilombo.h DESTINATION include)

INSTALL(FILES kilolib.h message.h message_crc.h params.h skilobot.h
    DESTINATION include/kilombo)

add_subdirectory(tests)

The CMakeLists.txt of the ROS package I am creating looks like this:

cmake_minimum_required(VERSION 2.8.3)
project(Kilombo_test)
find_package(catkin REQUIRED roscpp std_msgs)
if(CMAKE_COMPILER_IS_GNUCXX)
    add_definitions(-std=c99)
    add_definitions("-Wall -O2 -g")
endif()
include_directories(/usr/local/include /usr/local/lib)
link_directories(/usr/local/include)
add_executable(generated_test orbit.c)
target_link_libraries(generated_test ${catkin_LIBRARIES})

I include the Kilombo header files just as normal: #include <kilombo.h>

However, when I run catkin_make, I get many "undefined reference" errors. Some of those messages are:

orbit.c:53 undefined reference to 'kilo_turn_left'
orbit.c:53 undefined reference to 'set_motors'

These messages are shown after the commands:

####
#### Running command: "make -j2 -l2" in "/home/viki/catkin_ws/build"
####
Linking C executable generated_test

Both, kilo_turn_left and the function set_motors is defined in "kilolib.h" which itself is included in "kilombo.h".

Everything works fine if try running the simulation normally and not as a ROS package. The Makefile when I try to run it normally looks like the following. I have removed the parts which compiled for the real bot and not for the simulation.

SOURCES=orbit.c 
EXECUTABLE=orbit

# path of kilombo.h distributed with the simulator but also needed
# when compiling the user program for the real kilobot (avr-gcc has different default paths)
SIMHEADERS=/usr/local/include

#path to kilolib.a in the official kilolib, needed for real bots only
KILOLIB    =$(KILOHEADERS)/build/kilolib.a

SIM_CFLAGS = -c -g -O2 -Wall -std=c99  

SIM_LFLAGS = -lsim -lSDL -lm -ljansson
sim: $(EXECUTABLE)
hex: $(EXECUTABLE).hex
all: sim hex

clean :
    rm *.o $(EXECUTABLE) *.elf *.hex

However, when running a simulation as a ROS package, we need to define a CMakeLists.txt which is what I am having trouble with. What exactly am I doing wrong? I know there are many similar questions on this board but I have not been able to find a solution to my problem in those questions (though I believe I have gotten closer to the solution)

2017-09-06 15:41:06 -0500 received badge  Scholar (source)
2017-09-06 14:48:50 -0500 commented answer Linking external headers file in ROS package

I didn't receive any answers on that question. Which led me to think that perhaps it was a ROS-specific problem which is

2017-09-06 14:20:18 -0500 commented answer Linking external headers file in ROS package

Then perhaps you coudl answer here ;) https://stackoverflow.com/questions/46023578/linking-external-headers-file-in-ros-

2017-09-06 14:14:52 -0500 asked a question Linking external headers file in ROS package

Linking external headers file in ROS package I am trying to use the Kilobot simulator Kilombo with a ROS package. I am i