====== 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. EEROS supports the use of ROS1 or ROS2. * [[getting_started:ros_prep|]] * [[getting_started:ros_timing|]] * [[getting_started:ros_example|]] * [[getting_started:ros_run|]] You can make use of ROS within EEROS in the following two ways. ===== EEROS Messages ===== EEROS defines its own ROS message types. They correspond to EEROS [[eeros_architecture:control_system:signals|]] * Analog Signal - timestamp - array of float64 values * Digital Signal - timestamp - array of boole values These messages are fetched and built when building EEROS with ROS supprt and will be installed into the same directory as EEROS itself. ===== Using Publisher and Subscriber Blocks in the Control System ===== You can insert blocks into the control system which publish or subscribe a given type of ROS message. [{{ :getting_started:roscontrolsystem.png?400 |//Dedicated blocks in the control system for interfacing with ROS//}}] Special blocks in EEROS take care of sending signals to and receiving signals from ROS. These signals must be packed into ROS messages. Each topic transmits messages of a certain type. Depending on the message type you have to use certain blocks in your control system, see [[eeros_architecture:control_system:available_blocks#Blocks_for_Interfacing_with_ROS|Blocks for Interfacing with ROS]] ===== Using ROS through EEROS HAL ===== EEROS can communicate with the underlying hardware through its [[eeros_architecture:hal:start|]]. When using this, you need a special wrapper library (see [[eeros_architecture:hal:hardware_libraries|]]). [{{ :getting_started:roshal.png?350 |//Connect with ROS topics through the HAL//}}] The EEROS HAL signals can be comprised of digital or analog inputs or outputs. They are specified in a JSON file. \\ If you want to test your application with a [[http://gazebosim.org/|Gazebo]] simulation, you can define your inputs and outputs as ROS topics to connect your application with the simulation. For this no hardware is necessary. To use your application with hardware, you can use any of the available [[eeros_architecture:hal:hardware_libraries|]]. By choosing the proper JSON file, you can easily switch between real hardware and simulation. \\ It is also possible to use ROS-topics alongside real hardware. You could determine a motor position by reading an encoder and set a control value for a motor. In parallel, you could publish the same values to ROS topics to visualize the state of the robot with [[http://wiki.ros.org/rviz|rviz]] (if you have a model of your robot) or you could monitor the values with a ROS tool like [[http://wiki.ros.org/rqt|rqt]].