Project Based Learning (A.I).pptx detail explanation
ROS - An open source platform for robotics software developers (lecture).pdf
1. ROS: An open source platform for
robotics software developers
Amine BENDAHMANE
02 April 2021
2. Summary
2
1. What is ROS?
2. How ROS works?
3. Why to use ROS?
4. ROS2
5. Requirements to use ROS
6. Examples (moving a robot using ROS & python)
3. Context: Why I’m talking about this?
3
I pursued a multi-disciplinary career:
• Computer Science degree from USTO-MB
university
• Worked as Web Developer
• Studied Electronics for ~2 years (actually 1.5 years!)
• Pursuing a PhD degree in Artificial Intelligence & Robotics
• Teaching programming, robotics, and AI for several years
4. Context: What does robotics software do?
4
Collect data from sensors
Extract information
Send orders to actuators
Sense-Think-Act paradigm
5. 1. What is ROS?
5
ROS is not:
Robot Operating System
6. 1. What is ROS?
6
ROS is not:
• An operating system
Robot Operating System
7. 1. What is ROS?
7
ROS is not:
• An operating system
• A library
Robot Operating System
8. 1. What is ROS?
8
ROS is not:
• An operating system
• A library
• A simulator Robot Operating System
9. 1. What is ROS?
9
ROS is not:
• An operating system
• A library
• A simulator
• An AI framework
Robot Operating System
10. 1. What is ROS?
10
ROS is:
• A middleware
Operating System (OS)
Robot Hardware
ROS Ecosystem
User Software
11. 1. What is ROS?
11
ROS is:
• A middleware
• A distributed platform
12. 1. What is ROS?
12
ROS is:
• A middleware
• A distributed platform
• A set of libraires and tools
Visualization
Simulation
Messaging
Debugging
Packaging
Logging
Navigation, Mapping, Path
Planning…
13. 1. What is ROS?
13
ROS is:
• A middleware
• A distributed platform
• A set of libraires and tools
• Open Source (BSD license)
22. 3. Why ROS?
22
ROS abstracts the Hardware (motors, sensors…)
• Example: When you want to move the motors, just send a
velocity message to the corresponding topic.
The same code works on
different robots
23. 3. Why ROS?
23
ROS takes care of network layer
• We don’t need to think about
RPC, TCP/UDP, Socket…
24. 24
Designed to increase reusability
• With a set of libraries for path planning, mapping,
visualization…
3. Why ROS?
25. 25
Language independent communication
• A node can run in python and another in C++, with smooth
communication
3. Why ROS?
Topic
Node 1 (C++)
Publisher
Subscriber
Node 2 (python)
26. 26
• Fast prototyping using simulators
• Easy transferring from simulated to real world
robots
3. Why ROS?
31. 31
• Fully distributed (no ROS master)
• Allows real time programming
• Supports Linux, Windows, MacOS & RTOS
• Supports python >=3.5 & C++11/14 (C++17 soon)
• Allows multiple nodes in the same process
• Python & C++ APIs has the same base API
• …(more)
4. Why ROS 2?
32. 32
4. Why ROS 2?
ROS1 & ROS2 are evolving together:
• The last distribution of ROS1
(Noetic Ninjemys) will still be
supported until May 2025
33. 33
4. Why ROS 2?
Should I switch to ROS 2 now?
• 80% of ROS packages are based
on ROS 1 (as of January 2021)
https://metrics.ros.org/packages_rosdistro.html
• Stick to ROS 1 if you have legacy code or a large
ROS 1 code base already on production (do the
transition gradually)
34. 34
4. Why ROS 2?
• Most of the packages are based on distributions ≤ melodic
• It means most packages are based on C++03 or python 2.7
35. 35
You can use both versions at the same time:
• A node in ROS 1 can communicate with a node in ROS2
through ROS1_bridge package
• Requires more
CPU and RAM
4. Why ROS 2?
37. 5. Requirements to use ROS
37
You need to know:
• Basic Linux commands
• Basic programming in Python or C++
• Basic knowledge about robot hardware (what’s a
sensor, type of sensors, what’s an actuator…)
• More skills depending on what you want to do
(kinematics, geometry, objects-oriented programming…)
40. 6. Examples
40
import rospy, time
from geometry_msgs.msg import Twist
rospy.init_node('robot_mover') # initialize ROS node
pub = rospy.Publisher('cmd_vel', Twist) # create a topic publisher to
control the motors
twist = Twist() # create a Twist message to send velocity commands
twist.linear.x = 0.2 # set linear velocity to 20% of max motor’s speed
moving_time = 0
t0 = time.time()
while moving_time < 3: # repeat the following actions for 3 seconds
pub.publish(twist) # publish to the topic (execute the velocity command)
moving_time = time.time() - t0
twist.linear.x = 0 # set linear velocity to 0 (to stop the motors)
pub.publish(twist) # publish the command
41. 6. Examples
41
Executing the same code on simulation and real robot:
Testing on P3DX at LARESI laboratory, USTO-MB
Testing on Turtlebot3 Gazebo simulation
43. 7. Conclusion
43
• ROS is an open-source middleware for robotics
applications
• It is widely used in research & industry
• It abstracts the hardware and network layers
• It increases reusability, and allows easy transfer
from simulation to real robots
• ROS 1 & ROS 2 are evolving together until 2025