Custom onboard app compilation


#1

I’m trying to compile a simple onboard app on my flytpod using your flyt apis for position hold, but I’m getting some reference errors.

My cpp file -

#include <cpp_api/navigation_bridge.h>

int main(int argc, char **argv)
{
   Navigation nav;
   
   nav.position_hold();
  
   return 0;
}

CMakeLists.txt -

cmake_minimum_required(VERSION 2.8.3)
project(flyt)

add_definitions(-std=c++11)

find_package(catkin REQUIRED COMPONENTS cpp_api)
find_package(Boost REQUIRED COMPONENTS system python)
find_package(PythonLibs 2.7 REQUIRED)

include_directories(${catkin_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS})

add_executable(hover hover.cpp)
target_link_libraries(hover ${catkin_LIRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})

However when I run ‘make’ from my build folder, I get -

undefined reference to ‘Navigation::Navigation()’
… and similar errors.


#2

Hi Karnik,
It would have been better if you had posted the complete error that you got on the make command.
Anyways my guess is that this is a sourcing error. Can you post the last few lines of Flytpod’s /etc/bash.bashrc file.
If you can’t see the following line in that file, add it:
CPATH=$CPATH:/opt/ros/kinetic/include

and then source using the command:
source /etc/bash.bashrc

Zubin


#3

Hi,

I added the said line and tried compiling again. I get the same error.

These are the last few lines of my /etc/bash.bashrc file,

source /opt/ros/kinetic/setup.bash
export PYTHONPATH=$PYTHONPATH:/flyt/flytapps:/flyt/userapps
source /flyt/flytos/flytcore/setup.bash
CPATH=$CPATH:/opt/ros/kinetic/include

#4

Hi,

there was a typo in my CMakeLists.txt.

I’d added catkin_LIRARIES instead of catkin_LIBRARIES :sweat_smile:

It’s compiling now.


#5