![Page 1: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/1.jpg)
Luis Merino EVIA’16
Escuela de Verano de Inteligencia Artificial
1
![Page 2: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/2.jpg)
} El término "Robótica" fue acuñado por Isaac Asimov para describir la tecnología de los robots. ◦ Las tres leyes de la robótica
} El término robot procede de las palabras checas robota (trabajo forzado) y robotnik (sirviente) ◦ Usadas por primera vez en 1921 por el
escritor checo Karel Capek en su obra de teatro Rossum’s Universal Robot (R.U.R.)
3
![Page 3: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/3.jpg)
8
![Page 4: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/4.jpg)
9
![Page 5: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/5.jpg)
10
Tiempos Modernos (1936)
![Page 6: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/6.jpg)
11
![Page 7: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/7.jpg)
12
Terminator 2 (1991)
![Page 8: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/8.jpg)
13
![Page 9: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/9.jpg)
14
![Page 10: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/10.jpg)
15
![Page 11: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/11.jpg)
16
![Page 12: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/12.jpg)
17
El Coche Fantástico (1982)
![Page 13: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/13.jpg)
18
![Page 14: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/14.jpg)
19
![Page 15: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/15.jpg)
20
![Page 16: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/16.jpg)
21
![Page 17: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/17.jpg)
22
![Page 18: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/18.jpg)
23
![Page 19: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/19.jpg)
24
Tiempos Modernos (1936)
![Page 20: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/20.jpg)
25
![Page 21: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/21.jpg)
Ubiquituous Robotics in Urban Settings 2006 - 2009
![Page 22: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/22.jpg)
Cameras and ubiquitous sensors
Robots with HRI interfases
People with mobiles, PDAs,
tablets
Wireless Communications
Network Robot Systems
![Page 23: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/23.jpg)
vídeo
![Page 24: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/24.jpg)
![Page 25: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/25.jpg)
![Page 26: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/26.jpg)
} Robots y Redes de Sensores ◦ Sensores integrados en el entorno y en la infraestructura de la ciudad ◦ Disposi6vos móviles ◦ Comunicaciones inalámbricas
} Percepción Coopera6va ◦ Combinar los datos obtenidos por todos los sistemas en red para obtener una información más certera del entorno
![Page 27: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/27.jpg)
Local Processing
Data association
Information channels
Data fusion
Robot Camera Network Wireless
Sensor Network
Active Perception Local Processing
Data association
Data fusion
Active Perception Local Processing
Data association
Data fusion
Active Perception
![Page 28: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/28.jpg)
} Eliminación del fondo
} Filtros de Kalman
![Page 29: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/29.jpg)
Detection of events
Multi-camera tracking
![Page 30: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/30.jpg)
} La señal recibida desde un disposi6vo móvil puede usarse para es6mar su posición
} Wireless Sensor Networks (WSNs) ◦ Red inalámbrica ad-‐hoc compuesta por pequeños nodos de bajo consumo ◦ Nodos baratos, que podrían ser desplegados en ordenes de cientos de sensores
![Page 31: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/31.jpg)
![Page 32: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/32.jpg)
} Los robots a su vez pueden obtener información de lo que le rodea
} Ejemplo: es6mación de posición de personas ◦ Detector de caras ◦ Seguimiento de regiones (camshiP)
![Page 33: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/33.jpg)
} Cada sistema 6ene sus ventajas e inconvenientes: ◦ Precisión baja para el seguimiento basado en radio ◦ Falta de robustez del seguimiento con las cámaras a bordo del robot ◦ Falta de flexibilidad de las cámaras fijas
} Idea: combinar todas ellas
![Page 34: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/34.jpg)
Camera network
Robot
Fusion No Fusion
![Page 35: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/35.jpg)
![Page 36: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/36.jpg)
Decentralized Data Fusion
Coopera3ve Planning and
Control
Distributed Task Alloca3on
Sensors
Communica3ons
Actuators
Other UAVs
![Page 37: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/37.jpg)
![Page 38: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/38.jpg)
uav_1 uav_2
![Page 39: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/39.jpg)
uav_1 uav_2
![Page 40: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/40.jpg)
uav_1 uav_2
![Page 41: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/41.jpg)
uav_1 uav_2
![Page 42: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/42.jpg)
uav_1 uav_2
![Page 43: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/43.jpg)
53
Inteligencia Artificial (2001)
![Page 44: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/44.jpg)
54
2011-2014
![Page 45: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/45.jpg)
Objetivos } Detección de comportamientos sociales y señales
afectivas } Capacidad de comunicación e interacción con
personas } Evaluación en un entorno real: el Real Alcázar de
Sevilla, como Guía Turístico
55
![Page 46: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/46.jpg)
} FROG robot ◦ Developed by the
Portuguese SME IDMind } Stereo cameras } IMU } 2 horizontal lasers } 1 vertical laser } Affective computing
camera
![Page 47: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/47.jpg)
![Page 48: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/48.jpg)
![Page 49: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/49.jpg)
59
![Page 50: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/50.jpg)
} Capacidad de detectar y localizar las personas en el entorno
} El robot debe considerar a las personas de forma diferente que a obstáculos como paredes, etc
![Page 51: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/51.jpg)
61
![Page 52: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/52.jpg)
![Page 53: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/53.jpg)
![Page 54: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/54.jpg)
![Page 55: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/55.jpg)
65
![Page 56: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/56.jpg)
66
![Page 57: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/57.jpg)
67
![Page 58: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/58.jpg)
68
![Page 59: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/59.jpg)
69
![Page 60: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/60.jpg)
![Page 61: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/61.jpg)
• “Skype on a stick”
• “Your alter ego on wheels”
![Page 62: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/62.jpg)
• Mayor presencia “física”
• Permite interacciones espontáneas
![Page 63: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/63.jpg)
![Page 64: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/64.jpg)
![Page 65: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/65.jpg)
![Page 66: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/66.jpg)
![Page 67: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/67.jpg)
} Las definiciones son muy dispares: ◦ “Es un dispositivo reprogramable y multifuncional diseñado para
mover materiales, piezas, herramientas o dispositivos especializados a través de movimientos programados” � Robot Institute of America, 1979
◦ “Un dispositivo automático que realiza funciones que normalmente se considera son o debieran ser realizadas por humanos” � Diccionario Webster
◦ Máquina o ingenio electrónico programable, capaz de manipular objetos y realizar operaciones antes reservadas sólo a las personas. � Diccionario Real Academia
} Joseph Engelberg (padre de la robótica industrial) dijo: "Puede que no se capaz de definir qué es un robot, pero sé cuándo veo uno".
77
![Page 68: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/68.jpg)
} Robot: A goal oriented machine that can sense, plan and act
78
Think
Act
Sense
![Page 69: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/69.jpg)
} Shakey the robot (1965) } La Robótica, la
Inteligencia Artificial, la Visión por Computador y el Aprendizaje Automático eran un mismo campo
} Tras esos comienzos, divergieron en cierto modo
85
![Page 70: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/70.jpg)
} Computer Vision: OpenCV } 3D Perception: PCL library } Framework for Robotics: Robotics Operating
System (ROS) } Simulators ◦ Gazebo ◦ STDR ◦ TheConstructSim � Simulation in the cloud
88
![Page 71: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/71.jpg)
1
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Tutorial de Robótica (Parte II) Luis Merino
EVIA’16: Escuela de Verano de Inteligencia Artificial
![Page 72: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/72.jpg)
2
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Tutorial, Parte II
• Introduction to ROS • Basic ROS commands • Developing in ROS
![Page 73: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/73.jpg)
3
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Introduction to ROS (some slides adapted from Roi Yehoshua, Bar-Ilan
University)
![Page 74: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/74.jpg)
4
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
What is ROS?
• ROS is an open-source robot “operating system” • The primary goal of ROS is to support code reuse in robotics
research and development • ROS was originally developed in 2007 at the Stanford Artificial
Intelligence Laboratory • Development continued primarily at Willow Garage, a robotics
research institute/incubator • Since 2013 it is managed by OSRF (Open Source Robotics
Foundation)
![Page 75: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/75.jpg)
5
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
ROS Main Features
Taken from Sachin Chitta and Radu Rusu (Willow Garage)
![Page 76: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/76.jpg)
6
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
ROS Main Features
• Hardware and network abstraction • Low-level device control • Message-passing between processes • Implementation of commonly-used functionality • Package management
![Page 77: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/77.jpg)
7
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Robots using ROS
http://wiki.ros.org/Robots
![Page 78: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/78.jpg)
8
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
ROS Philosophies
• Modularity & Peer-to-peer • Language Independent • Thin • Free & Open-Source
![Page 79: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/79.jpg)
9
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Modularity & Peer-To-Peer
• ROS is basically a distributed system • ROS consists of a number of processes
– potentially on a number of different hosts, – connected at runtime in a peer-to-peer
topology • No central server
![Page 80: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/80.jpg)
10
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Language Independent
• Client interfaces: – Stable: roscpp, rospy, roslisp – Experimental: rosjava, roscs – Contributed: rosserial, roshask, ipc-bridge
(MATLAB), etc... • Common message-passing layer
– Interface Definition Language (IDL)
![Page 81: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/81.jpg)
11
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Thin
• Library-style development – all development occurs in standalone libraries
with minimal dependencies on ROS • ROS re-uses code from numerous other open-
source projects, such as the navigation system simulators and vision algorithms from OpenCV
![Page 82: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/82.jpg)
12
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Free & Open-Source
• Source code is publicly available • Contributed tools are under a variety of open-
source (& closed-source) licenses • Promotes code-reuse and community-
building
![Page 83: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/83.jpg)
13
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
ROS Core Concepts
• Nodes • Messages and Topics • Services • ROS Master • Parameters
![Page 84: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/84.jpg)
14
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
ROS Nodes
• Single-purposed executable programs – e.g. sensor driver(s), actuator driver(s), mapper,
planner, UI, etc. • Modular design
– Individually compiled, executed, and managed • Nodes are written with the use of a ROS client
library – roscpp – C++ client library – rospy – python client library
![Page 85: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/85.jpg)
15
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
ROS Client Libraries
• A collection of code that eases the job of the ROS programmer.
• Libraries that let you write ROS nodes, publish and subscribe to topics, write and call services, and use the Parameter Server.
• Main clients: – roscpp = C++ client library – rospy = python client library
![Page 86: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/86.jpg)
16
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
ROS Master
• The role of the master is to enable ROS nodes to locate one another
• Naming & registration services for nodes, topics, services, etc
• Run using the roscore command
![Page 87: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/87.jpg)
17
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
ROS Topics
• Nodes communicate with each other by publishing messages to topics
• Publish/Subscribe model: 1-to-N broadcasting
![Page 88: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/88.jpg)
18
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
More Complex Example
This can be shown by executing the command rxgraph
![Page 89: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/89.jpg)
19
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
ROS Messages
• Strictly-typed data structures for inter-node communication • Messages can include:
– Primitive types (integer, floating point, boolean, etc.) – Arrays of primitives – Arbitrarily nested structures and arrays (much like C
structs) • For example, geometry_msgs/Twist.msg
Vector3 linear Vector3 angular
![Page 90: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/90.jpg)
20
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
ROS Services
• Synchronous inter-node transactions / RPC • Service/Client model: 1-to-1 request-response • Service roles:
– carry out remote computation – trigger functionality / behavior
• For example, the explore package provides a service called explore_map which allows an external user to ask for the current map
![Page 91: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/91.jpg)
21
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Parameter Server
• A shared, multi-variate dictionary that is accessible via network APIs.
• Best used for static, non-binary data such as configuration parameters.
• Runs inside the ROS master
![Page 92: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/92.jpg)
22
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
ROS Packages
• Software in ROS is organized in packages. • A package contains one or more nodes and provides a ROS
interface
![Page 93: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/93.jpg)
24
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
ROS Package Repositories
• Collection of packages and stacks • Many repositories (>50): Stanford, CMU, Leuven, USC, … • Most of them hosted in GitHub • http://wiki.ros.org/RecommendedRepositoryUsage/
CommonGitHubOrganizations
![Page 94: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/94.jpg)
26
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Basic ROS Commands (slides adapted from Roi Yehoshua, Bar-Ilan University)
![Page 95: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/95.jpg)
28
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Developing in ROS
• Download the file: • Unzip it at the folder catkin_ws/src • In the folder catkin_ws, execute the command:
• Execute the following command:
• This will launch a simulation of a Turtlebot robot
roslaunch robotcontrol turtlebot_in_stdr.launch
catkin_make
![Page 96: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/96.jpg)
29
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
ROS Basic Commands
• roscore • roscd • rosrun • rosnode • rostopic
![Page 97: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/97.jpg)
30
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Basic ROS Commands
• roscore – a collection of nodes and programs that are pre-requisites of a ROS-based system
• If your ROS system uses communications, it should be run before • roscore is defined as:
– master – parameter server – rosout
• Usage: – $roscore
![Page 98: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/98.jpg)
31
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Navigating through ROS packages
• roscd: roscd is part of the rosbash suite. It allows you to change directory (cd) directly to a package or a stack.
• Before using it, the correct environment variables should be set – Source correct the .bash file
• Usage: – $ roscd [locationname[/subdir]]
![Page 99: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/99.jpg)
32
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Executing a node within a package
• rosrun – allows you to run an executable in an arbitrary package without having to cd (or roscd) there first
• Usage: – $rosrun package executable
• Example – Run turtlesim
• $rosrun turtlesim turtlesim_node
![Page 100: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/100.jpg)
33
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Basic ROS Commands
• rosnode – Displays debugging information about ROS nodes, including publications, subscriptions and connections
• Commands:
CommandList active nodes$rosnode listTest connectivity to node$rosnode ping Print information about a node$rosnode infoKill a running node$rosnode killList nodes running on a particular machine$rosnode machine
![Page 101: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/101.jpg)
34
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Basic ROS Commands
• Open a different terminal and run the following command:
• This shows the list of the nodes currently running
• This shows information about the node amcl • A general tool for that is rqt
rosnode list
rosnode info /amcl
rqt
![Page 102: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/102.jpg)
35
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
rostopic
• Gives information about a topic and allows to publish messages on a topic
CommandList active topics$rostopic list Prints messages of the topic to the screen
$rosnode echo /topic
Print information about a topic$rostopic info /topicPrints the type of messages the topic publishes
$rostopic type /topic
Publishes data to a topic$rostopic pub /topic type args
![Page 103: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/103.jpg)
36
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Basic ROS Commands
• Open a different terminal and run the following command:
• This shows the topic in which the pose of the robot is published
rostopic echo /amcl_pose
![Page 104: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/104.jpg)
37
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Developing in ROS
![Page 105: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/105.jpg)
40
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
catkin Build System
• catkin is the official build system of ROS • The original ROS build system was rosbuild
– Still used for older packages • Catkin is implemented as custom CMake macros along with some
Python code • Supports development on large sets of related packages in a
consistent and conventional way
![Page 106: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/106.jpg)
41
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
ROS Development Setup
• Create a new catkin workspace • Create a new ROS package • Write the code • Update the make file • Build the package
![Page 107: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/107.jpg)
42
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
catkin Workspace
• A workspace in which one or more catkin packages can be built • Contains up to four different spaces:
Space
Contains the source code of catkin packages. Each folder within the source space contains one or more catkin packages.
Source space
is where CMake is invoked to build the catkin packages in the source space. CMake and catkin keep their cache information and other intermediate files here.
Build Space
is where built targets are placed prior to being installed
Development (Devel) Space
Once targets are built, they can be installed into the install space by invoking the install target.
Install Space
![Page 108: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/108.jpg)
43
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
catkin Workspace Layout
![Page 109: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/109.jpg)
44
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
ROS Package
• A ROS package is simply a directory inside a catkin workspace that has a package.xml file in it.
• Packages are the most atomic unit of build and the unit of release. • A package contains the source files for one node or more and
configuration files
![Page 110: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/110.jpg)
45
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Common Files and Directories
ExplanationDirectoryC++ include headersinclude/C++ source filessrc/Python scriptsscripts/Folder containing Message (msg) typesmsg/Folder containing Service (srv) typessrv/Folder containing launch fileslaunch/The package manifestpackage.xmlCMake build fileCMakeLists.txt
![Page 111: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/111.jpg)
46
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
The Package Manifest
• XML file that defines properties about the package such as: – the package name – version numbers – authors – dependencies on other ROS packages
![Page 112: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/112.jpg)
47
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
The Package Manifest
• Example for a package manifest:
![Page 113: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/113.jpg)
48
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
CMakeLists.txt
• ROS uses CMake to build ROS packages • The CMakeLists.txt file is the equivalent to a Makefile • This file is the way we indicate how to build our package’s
executables • If you're unfamiliar with CMakeLists.txt, that's ok, because most
ROS packages follow a very simple pattern that is described in the following slides
![Page 114: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/114.jpg)
72
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
A basic ROS node in Python if __name__ == '__main__': try:
# initiliaze rospy.init_node('robotcontrol', anonymous=False)
# tell user how to stop TurtleBotrospy.loginfo("To stop TurtleBot CTRL + C")
robot=Turtlebot() # What function to call when you ctrl + c
rospy.on_shutdown(robot.shutdown)
goalx=float(sys.argv[1])goaly=float(sys.argv[2])#TurtleBot will stop if we don't keep telling it to move. How
often should we tell it to move? 10 HZ r = rospy.Rate(10);
# as long as you haven't ctrl + c keeping doing... while not rospy.is_shutdown():
rospy.loginfo("Loop") # publish the velocity
robot.command(goalx,goaly) # wait for 0.1 seconds (10 HZ) and publish again
r.sleep() except: rospy.loginfo("robotcontrol node terminated.")
![Page 115: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/115.jpg)
73
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
A basic ROS node in Python
• Initialize ROS. This allows ROS to do name remapping through the command line -- not important for now.
• This is also where we specify the name of our node. Node names must be unique in a running system (with anonymous=True a random name will be created).
• The name used here must be a base name, ie. it cannot have a / in it.
rospy.init_node('robotcontrol', anonymous=False)
![Page 116: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/116.jpg)
74
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
A basic ROS node in Python
• Callback that will be called when a signal terminates the node – Typically, CRTL+C (SIGINT)
rospy.on_shutdown(robot.shutdown)
![Page 117: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/117.jpg)
75
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
A basic ROS node in Python
• A Rate object allows you to specify a frequency that you would like to loop at. It will keep track of how long it has been since the last call to the sleep() method of the object, and sleep for the correct amount of time.
• In this case we tell it we want to run at 10hz.
• Now we use the Rate object to sleep for the time remaining to let us hit our 10 Hz rate.
r = rospy.Rate(10);
r.sleep();
![Page 118: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/118.jpg)
76
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
A basic ROS node in Python
• By default rospy will install a SIGINT handler which provides Ctrl-C handling which will cause rospy.is_shutdown() to return true if that happens.
• rospy.is_shutdown() will return true if: – a SIGINT is received (Ctrl-C) – we have been kicked off the network by another node with the same
name – rospy.shutdown() has been called by another part of the application.
while not rospy.is_shutdown():
![Page 119: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/119.jpg)
77
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
A basic ROS node in Python
• Output information to the console • It is logged by ROS
rospy.loginfo("To stop TurtleBot CTRL + C")
![Page 120: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/120.jpg)
78
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Publishing and subscribing to data
• Your node typically needs to communicate with other nodes • By publishing information • By subscribing to information
![Page 121: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/121.jpg)
79
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Publishing data
def __init__(self):
# Create a publisher which can "talk" to TurtleBot and tell it to move # Tip: You may need to change cmd_vel_mux/input/navi to /cmd_vel if you're not using TurtleBot2
self.cmd_vel = rospy.Publisher(‘/mobile_base_controller/cmd_vel’, Twist, queue_size=10)
self.listener = tf.TransformListener()
![Page 122: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/122.jpg)
80
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Publishing data
• Tell the master that we are going to be publishing a message of type Twist on the topic /mobile_base_controller/cmd_vel. – This lets the master tell any nodes listening on /mobile_base_controller/cmd_vel that we are going to publish data on that topic.
• The third argument is the size of our publishing queue. – In this case if we are publishing too quickly it will buffer up a
maximum of 10 messages before beginning to throw away old ones.
• rospy.Publisher returns an object, which serves two purposes: – 1) it contains a publish() method that lets you publish messages onto
the topic it was created with, – and 2) when it goes out of scope, it will automatically unadvertise.
rospy.Publisher(‘/mobile_base_controller/cmd_vel’, Twist, queue_size=10)
![Page 123: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/123.jpg)
81
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Publishing data
• Now we actually broadcast the message to anyone who is connected.
def publish(self,lin_vel, ang_vel):# Twist is a datatype for velocity
move_cmd = Twist()
# let's go forward at 0.2 m/s move_cmd.linear.x = lin_vel
# let's turn at 0 radians/smove_cmd.angular.z = ang_vel
self.cmd_vel.publish(move_cmd)
![Page 124: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/124.jpg)
82
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Subscription on topics
• A ROS node will want to receive data from other nodes • This is done by subscribing the node to the topics published by
other nodes
• This is a special object for TF data
self.listener = tf.TransformListener()
![Page 125: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/125.jpg)
83
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
TF: Transformation Frames
• TF is a library to deal with coordinate frames and transformations between them
goal.header.frame_id = ”world";
goal.header.stamp = rospy.Time();
goal.point.x = gx;goal.point.y = gy;goal.point.z = 0.0;
base_goal = self.listener.transformPoint('base_link', goal)
![Page 126: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/126.jpg)
84
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Running the simulation
• To execute your python code:
rosrun robotcontrol controlFinal.py
![Page 127: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/127.jpg)
85
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Subscription on topics
• Subscribe to the /robot0/laser_0 topic with the master. • ROS will call the callback() function whenever a new message
arrives. • The 2nd argument is the data type. • It can be also specified a queue. If the queue is full of messages,
we will start throwing away old messages as new ones arrive.
rospy.Subscriber("/robot0/laser_0", LaserScan, self.callback)
![Page 128: Luis Merino EVIA'16 Escuela de Verano de Inteligencia Artificial](https://reader034.vdocumento.com/reader034/viewer/2022042619/588c66751a28abc0208b76ca/html5/thumbnails/128.jpg)
86
Tutorial Robótica Introduction to ROS
Luis Merino Cabañas
Callback
def callback(self,data):self.laser = datarospy.loginfo("Laser received " + str(len(data.ranges)))
• This is the callback function that will get called when a new message has arrived on the subscribed topic.
• You should know which kind of data is on the topic – In this case, a ROS LaserScan
• Many types for the data are defined in sensor_msgs