Difference between revisions of "Pprzros"

From PaparazziUAV
Jump to navigation Jump to search
(→‎PPRZROS: Describing the content of the PPRZROS stack)
Line 13: Line 13:


== Installation ==
== Installation ==
This section assumes that you already successfully installed [http://wiki.ros.org/ROS/Installation ROS] and [https://wiki.paparazziuav.org/wiki/Installation Paparazzi] on your system.
This section assumes that you have successfully installed [http://wiki.ros.org/ROS/Installation ROS] and [https://wiki.paparazziuav.org/wiki/Installation Paparazzi] on your system.
You also need a working [http://wiki.ros.org/catkin/Tutorials/create_a_workspace catkin workspace]<br/>
You also need a working [http://wiki.ros.org/catkin/Tutorials/create_a_workspace catkin workspace]<br/>


Line 19: Line 19:
     $ cd my_catkin_ws/src
     $ cd my_catkin_ws/src
and clone the PPRZROS repository
and clone the PPRZROS repository
     $ clone --recursive https://github.com/enacuavlab/pprzros.git
     $ git clone --recursive https://github.com/enacuavlab/pprzros.git
Then, do go to the pprzros folder, e.g. using roscd
Then, do go to the pprzros folder, e.g. using roscd
     $ roscd pprzros
     $ roscd pprzros
and use catkin_make to compile and generate messages.
and use catkin_make to compile and generate messages.
     $ catkin_make
     $ catkin_make
Please note that inside the pprzros git there is a sub-module (sub git repository) linking to PPRZLINK repos. When updating PPRZROS don't forget to update the PPRZLINK sub-module as well
Please note that the PPRZROS repository contains a sub-module linking to PPRZLINK repository (thus the git clone --recursive). When updating PPRZROS don't forget to update the PPRZLINK sub-module as well.
     $ git submodule update
     $ git submodule update



Revision as of 05:51, 28 July 2017

PPRZROS

PPRZROS is a Robot Operating System (ROS) package bridging ROS and Paparazzi, to get the best of both worlds.


Overview

The role of PPRZROS is to convert Paparazzi messages into ROS format and ROS messages into Paparazzi format. More specifically, incoming paparazzi messages are converted into a generic ROS message containing generic information about the message and the binary data associated with the message. Messages coming in ROS format are translated to a generic paparazzi message with the same format: generic information and data in binary form.
To start the PPRZROS node, it requires a connexion type (UDP, Serial or Ivy) and a Destination (plus some other optional infos). Once started the PPRZROS node will create two ROS topics:

  • /to_ros : PPRZROS is publishing in this topic. Messages coming from the Destination will be translated into ROS format and published on this topic.
  • /from_ros : PPRZROS is subscribing (listening) to this topic. Any message sent to this topic, by other ROS nodes (programs), will be translated into a Paparazzi message and sent to the Destination.
PPRZROS in a glimpse

A connexion to Paparazzi is also setup, depending on the specified connexion type.

Installation

This section assumes that you have successfully installed ROS and Paparazzi on your system. You also need a working catkin workspace

Now, go into the /src folder of you catkin workspace

   $ cd my_catkin_ws/src

and clone the PPRZROS repository

   $ git clone --recursive https://github.com/enacuavlab/pprzros.git

Then, do go to the pprzros folder, e.g. using roscd

   $ roscd pprzros

and use catkin_make to compile and generate messages.

   $ catkin_make

Please note that the PPRZROS repository contains a sub-module linking to PPRZLINK repository (thus the git clone --recursive). When updating PPRZROS don't forget to update the PPRZLINK sub-module as well.

   $ git submodule update

Stack content

The PPRZROS stack contains four packages:

  • PPRZLINK: contains the interfaces needed to communicate with the Paparazzi through UDP, Serial and Ivy. It is required by PPRZROS in order to communicate with the Paparazzi world.
  • PPRZROS: this package contains the code for creating a node capable of communicating both with ROS and Paparazzi. It relies on ROS interfaces and PPRZLINK.
  • PPRZROS_MSGS: this package only contains ROS message definitions. For now it only contains a generic message, but more useful messages will be added in the futur.
  • SLAMDUNK_PPRZ: Todo

Running PPRZROS

There are two ways to start the PPRZROS node:

  • Directly as an independent ROS node :

First, be sure that the rosmaster is up and running by starting the roscore

   $ roscore

And then start the node,

   $ rosrun pprzros pprzros_run connexion_type destination [OPTIONS]

The connexion_type can be UDP, Serial or IVY. The destination and OPTIONS will vary depending on the connexion_type, information can be displayed by starting the rosnode with the -h (--help) option.

  • Via a .launch file which allows to start the PPRZROS node along with some other nodes that might be useful for your application,
   $  roslaunch pprzros my_script.launch

The following section contains an example .launch showing, among other things, how to start a PPRZROS node.

Example

An example .launch file is provided in the /launch directory of the package. We will go through it to show how a message can be sent to the Paparazzi Destination from ROS.

   <?xml version="1.0"?>
   <launch>
     <node pkg="pprzros" type="pprzros_run" name="pprzros" args="udp -d 192.168.1.1" output="screen"/>
     <node pkg="rostopic" type="rostopic" name="send_test_ping" args="pub -r 10 /from_ros pprzros_msgs/PprzrosMsg '{header: auto, version: 1, len: 0, class_name: 'datalink', comp_id: 0, msg_name: 'PING', sender_id: 0, receiver_id: 201, checksum: 0, data: []}'" output="screen"/>
     <node pkg="rostopic" type="rostopic" name="echo_test_pong" args="echo -c /to_ros" output="screen"/>
   </launch>

In the following, we go through each line to understand its role First starting the PPRZROS node

   <node pkg="pprzros" type="pprzros_run" name="pprzros" args="udp -d 192.168.1.1" output="screen"/>

Then, the rostopic package is called to create a node publishing a given message. This message is published on the /from_ros topic and is of type PprzrosMsg. The content of the message is then described in YAML format. We can see here that it is a simple PING message, so there is no content (data == []).

   <node pkg="rostopic" type="rostopic" name="send_test_ping" args="pub -r 10 /from_ros pprzros_msgs/PprzrosMsg '{header: auto, version: 1, len: 0, class_name: 'datalink', comp_id: 0, msg_name: 'PING', sender_id: 0, receiver_id: 201, checksum: 0, data: []}'" output="screen"/>

Finally, we create a node, from the rostopic package, to subscribe to the /to_ros topic and listen if any PONG is message is answering our PINGs.

   <node pkg="rostopic" type="rostopic" name="echo_test_pong" args="echo -c /to_ros" output="screen"/>


- Under development -