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
getting_started:ros [2021/03/29 15:52] – [Preparations and Building] ursgrafgetting_started:ros [2023/02/09 12:04] (current) – [Interfacing with ROS] ursgraf
Line 1: Line 1:
 ====== Interfacing with ROS ====== ====== Interfacing with ROS ======
-[[http://www.ros.org/|ROS]] is a flexible framework for writing robot software. It is great collection of tools, libraries, and conventions. +[[http://www.ros.org/|ROS]] is a flexible framework for writing robot software. It is great collection of tools, libraries, and conventions. EEROS supports the use of ROS1 or ROS2.
  
   * [[getting_started:ros_prep|]]   * [[getting_started:ros_prep|]]
 +  * [[getting_started:ros_timing|]]
   * [[getting_started:ros_example|]]   * [[getting_started:ros_example|]]
 +  * [[getting_started:ros_run|]]
  
 You can make use of ROS within EEROS in the following two ways. You can make use of ROS within EEROS in the following two ways.
Line 21: Line 23:
  
  
-===== Example for Making your EEROS Application a ROS Node ===== 
  
-The CMAKE file for the EEROS application using ROS has to be expanded as follows: 
-<code> 
-cmake_minimum_required(VERSION 3.5.1) 
-project(testProject) 
-  
-set(CMAKE_CXX_STANDARD 14) 
- 
-## ROS 
-message(STATUS "looking for package 'ROS'") 
-find_package( roslib REQUIRED ) 
-if (roslib_FOUND) 
- message( STATUS "-> ROS found") 
- add_definitions(-DROS_FOUND) 
- include_directories( "${roslib_INCLUDE_DIRS}" ) 
- message( STATUS "roslib_INCLUDE_DIRS: " ${roslib_INCLUDE_DIRS} ) 
- list(APPEND ROS_LIBRARIES "${roslib_LIBRARIES}") 
- find_package( rosconsole REQUIRED) 
- list(APPEND ROS_LIBRARIES "${rosconsole_LIBRARIES}") 
- find_package( roscpp REQUIRED ) 
- list(APPEND ROS_LIBRARIES "${roscpp_LIBRARIES}") 
-else() 
- message( STATUS "-> ROS NOT found") 
-endif() 
- 
-find_package(EEROS REQUIRED) 
-include_directories(${EEROS_INCLUDE_DIR};${EEROS_LIBUCL_INCLUDE_DIR}) 
-link_directories(${EEROS_LIB_DIR};${EEROS_LIBUCL_LINK_DIR}) 
-  
-add_executable(testProject main.cpp) 
-target_link_libraries(testProject eeros ucl ${CMAKE_DL_LIBS} ${ROS_LIBRARIES}) 
-</code> 
- 
-Your test program might look like 
-<code cpp> 
-#include <eeros/control/ros/EerosRosTools.hpp> 
-#include <ros/ros.h> 
-#include <signal.h> 
-   
-int main(int argc, char **argv) { 
-  ... 
-  eeros::control::rosTools::initNode("eerosNode"); // initialize the ROS node in your main function and give it a name. 
-  ros::NodeHandle handle; // start the internal node 
-  log.info() << "ROS node initialized."; 
-  signal(SIGINT, ...); 
-  ... 
-</code> 
-All ROS tools such as ''rqt'' will list your EEROS application under the name ''eerosNode''. \\ 
- 
-If you want to register a signal handler, e.g. for shutting down a system (see [[getting_started:practical_problems:abort|]]), you have to register it after the ROS node is initialized. 
-The ROS node will properly shut down as soon as the last node handler is destroyed when going out of scope. 
- 
-===== Running your Application ===== 
-An EEROS application using ROS needs to be started with super user privileges. Further,  
-ROS needs some system variables, like ''ROS_MASTER_URI'', which are defined by the ''setup.bash'' script of ROS. 
-To forward these variables to the super user process, the option //-E// has to be used.  
-<code> 
-$ sudo -E ./application 
-</code> 
  
getting_started/ros.1617025935.txt.gz · Last modified: 2021/03/29 15:52 by ursgraf