MRAA library inclusion in project
I won't pretend to be a ROS Linux or coding expert, but I've been stuck on getting my catkin_make to compile using the MRAA library from Intel. I'm using Intel's Up Board as my robot central controller. It will be eventually be doing SLAM and taking simple orders through a ROS message from a central computer elsewhere. Pretty standard. There are a few peripherals I want to connect to the Up Board by serial communication (SPI, specifically). At compile time the system breaks down when it tries to link to the MRAA library. It doesn't understand the references. So the way I see it, it's either a problem with the way I installed the library, or my CMakeLists.txt or package.xml is setup wrong. I've been through a lot of documentation, but cannot determine how to get the proper setup to link to the library.
catkin_make output:
[100%] Built target floorbot_generate_messages
/home/floorbot/catkin_ws/src/floorbot/src/sojourner.cpp: In function ‘int main(int, char**)’:
/home/floorbot/catkin_ws/src/floorbot/src/sojourner.cpp:32:2: error: ‘mraa’ has not been declared
mraa::Spi * spiCom;
^
/home/floorbot/catkin_ws/src/floorbot/src/sojourner.cpp:32:14: error: ‘spiCom’ was not declared in this scope
mraa::Spi * spiCom;
^
/home/floorbot/catkin_ws/src/floorbot/src/sojourner.cpp:33:2: error: ‘mraa’ has not been declared
mraa::Spi * tooth;
^
/home/floorbot/catkin_ws/src/floorbot/src/sojourner.cpp:33:14: error: ‘tooth’ was not declared in this scope
mraa::Spi * tooth;
^
/home/floorbot/catkin_ws/src/floorbot/src/sojourner.cpp:35:15: error: expected type-specifier before ‘mraa’
spiCom = new mraa::Spi(0); // <---- portal to arduino (CS0)
^
/home/floorbot/catkin_ws/src/floorbot/src/sojourner.cpp:35:15: error: expected ‘;’ before ‘mraa’
/home/floorbot/catkin_ws/src/floorbot/src/sojourner.cpp:36:14: error: expected type-specifier before ‘mraa’
tooth = new mraa::Spi(1); // <---- portal to bluetooth (CS1)
^
/home/floorbot/catkin_ws/src/floorbot/src/sojourner.cpp:36:14: error: expected ‘;’ before ‘mraa’
/home/floorbot/catkin_ws/src/floorbot/src/sojourner.cpp:54:50: error: ‘chatterCallback’ was not declared in this scope
ros::Subscriber sub = n.subscribe("chat", 1000, chatterCallback);
^
make[2]: *** [floorbot/CMakeFiles/sojourner.dir/src/sojourner.cpp.o] Error 1
make[1]: *** [floorbot/CMakeFiles/sojourner.dir/all] Error 2
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
floorbot@floorbot:~/catkin_ws$
CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.3)
project(floorbot)
find_package(catkin REQUIRED COMPONENTS
roscpp std_msgs message_generation)
find_package(Boost REQUIRED COMPONENTS system)
#find_package(mraa REQUIRED)
add_message_files(FILES commands.msg)
generate_messages(DEPENDENCIES std_msgs)
catkin_package(
${catkin_CURRENT_SOURCE_DIR}
INCLUDE_DIRS include
LIBRARIES floorbot mraa
CATKIN_DEPENDS roscpp mraa std_msgs
message_runtime
DEPENDS system_lib mraa)
# include_directories(${catkin_INCLUDE_DIRS})
# include_directories(/home/mraa)
# include_directories(/usr/include/mraa)
# add_subdirectory(mraa)
# add_library(mraa floorbot.cpp)
add_executable(sojourner src/sojourner.cpp)
add_dependencies(sojourner floorbot_generate_message_cpp ${catkin_EXPORTED_TARGETS})
# target_link_libraries(mraa)
target_link_libraries(sojourner ${catkin_LIBRARIES})
package.xml:
<?xml version="1.0"?>
<package>
<name>floorbot</name>
<version>0.0.1</version>
<description>The floorbot package</description>
<maintainer email="floorbot@todo.todo">floorbot</maintainer>
<license>TODO</license>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend ...