User Tools

Site Tools


getting_started:ros

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
getting_started:ros [2017/11/30 19:53] – [Using ROS through EEROS HAL] grafgetting_started:ros [2021/03/29 15:27] ursgraf
Line 17: Line 17:
 ===== Preparations and Building ===== ===== Preparations and Building =====
 ROS needs to be installed on the developer machine as well as on the target machine. ROS needs to be installed on the developer machine as well as on the target machine.
-Before a ROS application can be started, you need to run the ''setup.bash'' script of ROS.+Before a ROS application can be started, you need to run the ''setup.bash'' script of ROS. This can be done with  
 +<code> 
 +source /path_to_ros_installation/setup.bash 
 +</code> 
 The same applies for building the EEROS library with ROS support and for building an EEROS application with ROS support. \\ The same applies for building the EEROS library with ROS support and for building an EEROS application with ROS support. \\
 IMPORTANT If an integrated development environment such as ''kdevelop'' or ''Qt Creator'' is used, the IDE has to be started from a terminal after the ''setup.bash'' script has run. IMPORTANT If an integrated development environment such as ''kdevelop'' or ''Qt Creator'' is used, the IDE has to be started from a terminal after the ''setup.bash'' script has run.
 +
 +=== Building the EEROS library with ROS ===
 +If you build the library with cmake, make sure you use the -DUSE_ROS=TRUE switch.
 +An example of a cmake call could look like this:\\
 +''cmake -DCMAKE_INSTALL_PREFIX="$install_dir" -DUSE_ROS=TRUE ..''
 +Our build scripts already include this switch.
 +
 +
 +===== Example for Making your EEROS Application a ROS Node =====
  
 The CMAKE file for the EEROS application using ROS has to be expanded as follows: The CMAKE file for the EEROS application using ROS has to be expanded as follows:
 <code> <code>
-cmake_minimum_required(VERSION 2.8)+cmake_minimum_required(VERSION 3.5.1)
 project(testProject) project(testProject)
    
 +set(CMAKE_CXX_STANDARD 14)
 +
 ## ROS ## ROS
 message(STATUS "looking for package 'ROS'") message(STATUS "looking for package 'ROS'")
Line 46: Line 61:
 include_directories(${EEROS_INCLUDE_DIR};${EEROS_LIBUCL_INCLUDE_DIR}) include_directories(${EEROS_INCLUDE_DIR};${EEROS_LIBUCL_INCLUDE_DIR})
 link_directories(${EEROS_LIB_DIR};${EEROS_LIBUCL_LINK_DIR}) link_directories(${EEROS_LIB_DIR};${EEROS_LIBUCL_LINK_DIR})
-  
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 
    
 add_executable(testProject main.cpp) add_executable(testProject main.cpp)
Line 53: Line 66:
 </code> </code>
  
-===== Make your EEROS Application a ROS Node ===== +Your test program might look like
-Initialize the ROS node in your main function and give it a name.+
 <code cpp> <code cpp>
-  #include <ros/ros.h>+#include <ros/ros.h>
      
-  int main(int argc, char **argv) { +int main(int argc, char **argv) { 
- ... +  ... 
- rosTools::initNode("rosTest");+  rosTools::initNode("eeros node"); // initialize the ROS node in your main function and give it a name. 
 +        ros::NodeHandle handle;
  log.trace() << "ROS node initialized.";  log.trace() << "ROS node initialized.";
  ...  ...
getting_started/ros.txt · Last modified: 2023/02/09 12:04 by ursgraf