ROSbotran architecture ====================== This tutorial presents the process used to execute and operate a Robotran project from ROS by connecting a laptop and a Raspberry. The final output consists of two ROS packages (named *ros\_rob* for the Robotran project and *ros\_rasp* for the Raspberry). These two packages can be downloaded `ros\_rob <./src_rob>`__ and `ros\_rasp <./src_rasp>`__. .. figure:: figure/architecture.PNG :alt: Architecture Architecture The objective of this page is to present how these two packages work together. After that, each package will be deeply presented in the next pages and instructions to use them will be given. *ros\_rob* package ------------------ This package follows the classic ROS package architecture: .. figure:: figure/ros_package_archi.png :alt: ROS Package Architecture ROS Package Architecture **CMakeLists.txt** file: ~~~~~~~~~~~~~~~~~~~~~~~~ This lists the compilation instructions for the *ros\_rob* package and includes also a link to the *CMakeLists* of a used Robotran project. This latter will then be read by the catkin ROS compiler which will generate a ROS executable from Robotran. The user needs to specify in this file the paths to *mbsysc*, *ROS* and *Pthread* librairies (see after). **launch** folder: ~~~~~~~~~~~~~~~~~~ The *launch* files allow to run multiple ROS nodes and tools in one command line when you want to execute a complete project. **msg** folder: ~~~~~~~~~~~~~~~ It contains .msg files that allow you to create personalized messages for ROS topics in order to transport our data (in the case of Robotran it will be mainly positions, speeds, joint forces). **src** folder: ~~~~~~~~~~~~~~~ It contains the entire Robotran project(s) (without the *build* folder). **main** file (in the Robotran project inside *src* folder): ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Uses several **threads** 1. Executes the "classic" Robotran *main*, namely: loading the model static and quasi-static equilibria, modal analysis and direct dynamics (or inverse). 2. Creates a ROS Publisher object to provide the necessary functions to publish the data generated by Robotran on a topic. 3. Creates a ROS Subscriber object to collect data from a topic and to exploit them in Robotran. .. figure:: figure/MultiThreadMainRob.png :alt: Multithreading in main Multithreading in main *ros\_rasp* package ------------------- This is a ROS package which receives/publishes data for a Robotran project. Running this package alone has no interest but it can be used along with *ros\_rob*. In this tutorial, we present an example where you can drive a car with the left and right keyboard arrows and, thanks to a ROS topic, publish the torque which will be applied in the steering wheel. The interest is that you can run the *ros\_rasp* package on an other device (which has ROS installed on it and a complete, bi-directional connectivity with the first device by *SSH* communication), for example a `Raspberry Pi `__. Now you are able to publish data to Robotran from an external device and also receive data from Robotran to this external device. This is **ROSbotran** ;-)