26
Analisi introduttiva ROS 19/10/13 Raffaello Bonghi v1.1

ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

Analisi introduttiva ROS

19/10/13 Raffaello Bonghi v1 .1

Page 2: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

¡ Cos’è ROS § Eventi

¡ Storia § Future distribuzioni

¡ Risorse § Tutorial

¡ Come usarlo § Pacchetti

¡ Applicazioni

¡ Install (PC, Arm, … ) ¡ Structure ROS ¡ Roscore ¡ Nodi ¡ Topic

§ Msg/Srv ¡ Service/Param ¡ How to find my Pkgs

§ Best Pkgs

19/10/13 Raffaello Bonghi 2

SOMMARIO

Page 3: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

Robotic Operative System

19/10/13 Raffaello Bonghi 3

COS’È ROS

¡ E’ un framework per lo sviluppo di software per robot;

¡ ROS mette a disposizione strumenti e librerie per aiutare a sviluppare software per applicazioni robotiche;

¡ Rilasciato in licenza BSD (Open Source)

Page 4: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

19/10/13 Raffaello Bonghi 4

EVENTI

¡  Ogni anno è organizzato il ROSCon

¡  Partnership:

¡ Nasce nel 2007 dalla Stanford Artificial Intelligence Laboratory

¡ Nel 2008 continua l’opera Willow Garage

Page 5: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

Distribuzioni EOL (End of Life)

19/10/13 Raffaello Bonghi 5

STORIA 1/2

Box Turtle 2 Marzo 2010

C Turtle 2 Agosto 2010

Diamodblack 2 marzo 2011

Electric Emys 30 Agosto 2011

Page 6: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

Distribuzioni correnti

19/10/13 Raffaello Bonghi 6

STORIA 2/2

Fuerte 23 Aprile 2012

Groovy 31 Dicembre 2012

Hydro Medusa 31 Agosto 2013

Catkin

Raccomandata

Page 7: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

19/10/13 Raffaello Bonghi 7

FUTURE DISTRIBUZIONI STORIA

Introduzione di un Programma di distribuzione che seguirà quello di Ubuntu LTS

Indigo Igloo Aprile 2014

Ubuntu LTS supports ROS, ROS+1 LTS+1 supports ROS+1 Beta LTS+2 supports ROS+1 LTS+3 supports ROS+2 Beta ... LTS2 supports ROS+2, ROS+3

Page 8: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

¡  Il sito ufficiale di ROS: http://wiki.ros.org

§  Installazione: http://wiki.ros.org/ROS/Installation

§  Tutorial: http://wiki.ros.org/ROS/Tutorials §  Sensori: http://wiki.ros.org/Sensors

§  2D sensors: Laser, … §  Camere §  Sensori di forza

RISORSE

19/10/13 Raffaello Bonghi 8

§  GPS, IMU §  Motions (Kinect, Xtion, …) §  Audio

Page 9: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

¡ Il tutorial presente sul sito ufficiale: http://wiki .ros.org/ROS/Tutorials

¡ Guida iniziale ¡ Guide Avanzate:

§ Rviz § Gazebo § PCL (Kinect, Xtion, … ) § …

19/10/13 Raffaello Bonghi 9

TUTORIAL RISORSE

Page 10: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

PRO

¡ Un grande gruppo di ricerca; § Università;

¡ Molti Pkgs già disponibili;

¡ Visualizzazione § Telemetria § Plot variabili § …

CONTRO

¡ Sistema ancora non stabile;

¡ Buone conoscenze di: §  C/C++

e/o § Python

¡ Esecuzione pesante; ¡ Richiede un PC/ARM

almeno Raspberry PI o superiori;

19/10/13 Raffaello Bonghi 10

COME USARLO

Page 11: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

¡ Molti robot commerciali usano nativamente ROS, esempio: §  PR2 §  Husky §  TurtleBot §  Kobuki §  Jaguar robots § …

19/10/13 Raffaello Bonghi 11

APPLICAZIONI

Page 12: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

¡ Cos’è ROS § Eventi

¡ Storia § Future distribuzioni

¡ Risorse § Tutorial

¡ Come usarlo § Pacchetti

¡ Applicazioni

¡ Install (PC, Arm, … ) ¡ Structure ROS ¡ Roscore ¡ Nodi ¡ Topic

§ Msg/Srv ¡ Service/Param ¡ How to find my Pkgs

§ Best Pkgs

19/10/13 Raffaello Bonghi 12

SOMMARIO

Page 13: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

1.  sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu precise main" > /etc/apt/sources. l ist .d/ros- latest . l ist ’

2.  wget http://packages.ros.org/ros.key -O - | sudo apt-key add – 3.  Instal l ROS

§  sudo apt-get install ros-hydro-desktop-full §  sudo apt-get install ros-hydro-desktop §  sudo apt-get install ros-hydro-ros-base

4.  sudo rosdep init 5.  rosdep update 6.  echo "source /opt/ros/hydro/setup.bash" >> ~/.bashrc 7.  source ~/.bashrc

19/10/13 Raffaello Bonghi 13

INSTALL

Page 14: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

19/10/13 Raffaello Bonghi 14

STRUCTURE ROS

workspace_folder/ -- WORKSPACE build/ devel/ src/ -- SOURCE SPACE CMakeLists.txt -- 'Toplevel' CMake file, provided by catkin package_1/ include/ launch/ msg/ src/ srv/ CMakeLists.txt -- CMakeLists.txt file for package_1 package.xml -- Package manifest for package_1 ... package_n/ CMakeLists.txt -- CMakeLists.txt file for package_n package.xml -- Package manifest for package_n

Page 15: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

¡ Roscore

¡ Roslaunch

19/10/13 Raffaello Bonghi 15

ROSCORE

... logging to ~/.ros/log/9cf88ce4-b14d-11df-8a75-00251148e8cf/roslaunch-machine_name-13039.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB. started roslaunch server http://machine_name:33919/ ros_comm version 1.4.7 SUMMARY ======== PARAMETERS * /rosversion * /rosdistro NODES auto-starting new master process[master]: started with pid [13054] ROS_MASTER_URI=http://machine_name:11311/ setting /run_id to 9cf88ce4-b14d-11df-8a75-00251148e8cf process[rosout-1]: started with pid [13067] started core service [/rosout]

Page 16: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

¡  roscore = ros+core : master (prov ides name ser v ice for ROS) + rosout (s tdout/stderr ) + parameter ser ver (parameter ser ver wi l l be int roduced later )

¡  rosnode = ros+node : ROS tool to get informat ion about a node. ¡  rosrun = ros+run : runs a node f rom a g iven package.

19/10/13 Raffaello Bonghi 16

NODE

$ rosnode list /rosout /my_turtle

$ rosnode ping my_turtle

rosnode: node is [/my_turtle] pinging /my_turtle with a timeout of 3.0s xmlrpc reply from http://aqy:42235/ time=1.152992ms xmlrpc reply from http://aqy:42235/ time=1.120090ms xmlrpc reply from http://aqy:42235/ time=1.700878ms xmlrpc reply from http://aqy:42235/ time=1.127958ms

Page 17: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

¡  int8 , int16, int32, int64 (p lus u int*) ¡  f loat32, f loat64 ¡  str ing ¡  t ime, durat ion ¡  other msg f i les ¡  var iable - length array[ ] and f ixed- length array[C]

19/10/13 Raffaello Bonghi 17

MSG/SRV TOPIC

string first_name string last_name uint8 age uint32 score

int64 A int64 B --- int64 Sum

MSG message form

SRV service form

Page 18: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

19/10/13 Raffaello Bonghi 18

TOPIC 1/3

rostopic pub [topic] [msg_type] [args] $ rostopic pub -1 /trl/cmd_vel sim/Vel -- 2.0 1.8

$ rostopic -h rostopic bw display bandwidth used by topic rostopic echo print messages to screen rostopic hz display publishing rate of topic rostopic list print information about active topics rostopic pub publish data to topic rostopic type print topic type

Write Topic - Publish

C++

PYTHON

Page 19: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

19/10/13 Raffaello Bonghi 19

TOPIC 2/3

rostopic echo [topic]

$ rostopic echo /turtle1/command_velocity

linear: x: 2.0 y: 0.0 z: 0.0 angular: x: 0.0 y: 0.0 z: 0.0 --- linear: x: 2.0 y: 0.0 z: 0.0 angular: x: 0.0 y: 0.0 z: 0.0 ---

Read Topic - Subscribe

C++

PYTHON

Page 20: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

19/10/13 Raffaello Bonghi 20

TOPIC 2/3

$ rostopic list -h

$ rostopic list -v Published topics: * /turtle1/color_sensor [turtlesim/Color] 1 publisher * /turtle1/cmd_velocity [turtlesim/Velocity] 1 publisher * /rosout [roslib/Log] 2 publishers * /rosout_agg [roslib/Log] 1 publisher * /turtle1/pose [turtlesim/Pose] 1 publisher Subscribed topics: * /turtle1/cmd_velocity [turtlesim/Velocity] 1 subscriber * /rosout [roslib/Log] 1 subscriber

Usage: rostopic list [/topic] Options: -h, --help show this help message and exit -b BAGFILE, --bag=BAGFILE list topics in .bag file -v, --verbose list full details about each topic -p list only publishers -s list only subscribers

Page 21: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

19/10/13 Raffaello Bonghi 21

SERVICE/PARAM

rosservice list print information about active services rosservice call call the service with the provided args rosservice type print service type rosservice find find services by service type rosservice uri print service ROSRPC uri

rosparam set set parameter rosparam get get parameter rosparam load load parameters from file rosparam dump dump parameters to file rosparam delete delete parameter rosparam list list parameter names

$ rosservice -h

$ rosparam -h

Page 22: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

19/10/13 Raffaello Bonghi 22

HOW TO FIND MY PKGS 1/2

Page 23: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

19/10/13 Raffaello Bonghi 23

HOW TO FIND MY PKGS 2/2

Page 24: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

¡ RQT PLOT ¡ RQT CONSOLE ¡ RVIZ ¡ ROSBRIDGE ¡ ROSSERIAL

19/10/13 Raffaello Bonghi 24

BEST PKGS HOW TO F IND MY PKGS

Page 25: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

19/10/13 Raffaello Bonghi 25

RVIZ BEST PKGS

Page 26: ROS Analisi introduttiva - Officine Robotiche · Robotic Operative System 19/10/13 Raffaello Bonghi 3 COS’È ROS ! E’ un framework per lo sviluppo di software per robot; ! ROS

GRAZIE PER L’ATTENZIONE Raf fael lo Bonghi

www.of f ic inerobot iche. i t www.minisumo.net

19/10/13 Raffaello Bonghi 26

FINE!