Autonomous Driving with ROS
Tutorial
VIVES university of Applied Sciences
Researchgroup Smart Mobility
Jeremy Lebon
07/10/2020
1
Overview / agenda
• Introduction ROS
• Basics of ROS
• Practical implementation on simulated vehicle
2
Who am I?
Name: Jeremy Lebon
VIVES University Of Applied Sciences
• Lecturer Automotive Engineering (2012-…)
– Vehicle Electronics
– In-vehicle networks
– Mobile machine automation - CoDeSys (students and companies)
– Vehicle hydraulics
– Autonomous Vehicles & AI
• Researcher (2011-…)
– Research group Smart Mobility
– ISOBUS, CAN
– Mobile machine automation
• Consultancy services to companies (2012-…)
[email protected]3
VIVES University of Applied Sciences
associated with
4
Research group – Smart Mobility
Electrical vehicles Motorsport Mobile Automation
AGV
& Fuel cells & In-vehicle networks
[email protected]
5
In-house projects
Autonomous driving golfkart (GPS-RTK)
AGV (UWB)
Remote controlled skidsteer
6
Vehicle setup
& Demo setup
7
Current vehilce setup
No ROS implemented
LABO
CAN 1 CR0033
CAN 3 - 1000
CAN 2
CAN 4 - 500
Joystick
Roboteq CR0403
Rijden
Vooruit /
Stuurhuis achteruit
3
encoders
1
Autonomous driving primarly
2
Curtis
on GPS-RTK
motorcontroller
Centreer
sensor Stuurinrichting
8
New vehicle setup
With ROS implementation
3D camera Ethernet
CAN
USB
UWB
Sick Visionary Draadloos
Camera
VLP16 Ubuntu – ROS1
Ace 2
Radar
Touchscreen
Read out:
Ubuntu &
Nuvo-7258VTC
RMS 3xx Webvisu
CoDeSys
GPS -RTK
IMU IH372
Encoders
Mti-630
CoDeSys V3.5 J1939 CANopen NMEA200
9
Demo setup today
Catvehicle
Catvehicle Launch
Joystick Launch
RVIZ
Gazebo
RVIZ
Joystick Launch
10
References
CAT vehicle
Rahul Bhadani, Jonathan Sprinkle, Matthew Bunting. "The CAT Vehicle Testbed: A Simulator with
Hardware in the Loop for Autonomous Vehicle Applications". Proceedings 2nd International
Workshop on Safe Control of Autonomous Vehicles (SCAV 2018), Porto, Portugal, 10th April 2018,
Electronic Proceedings in Theoretical Computer Science 269, pp. 32–47.
Download: http://dx.doi.org/10.4204/EPTCS.269.4.
ROSbot
https://husarion.com/
11
ROS introduction
12
ROS introduction
Before ROS
13
What is ROS?
14
History ROS
• Originally developed in 2007 at the
Stanford Artificial Intelligence
Laboratory
• Since 2013 managed by OSRF
• Today used by many robots,
universities and companies
• De facto standard for robot
programming
https://www.openrobotics.org/
15
ROS Philosophy
Peer to peer
Individual programs communicate over defined API (ROS
messages, services, etc.).
Distributed
Programs can be run on multiple computers and communicate
over the network.
Multi-lingual
ROS modules can be written in any language for which a client
library exists (C++, Python,MATLAB, Java, etc.).
Light-weight
Stand-alone libraries are wrapped around with a thin ROS layer.
Free and open-source
Most ROS software is open-source and free to use.
16
ROS benefits
• Open-Source
• Vibrant Community
• Comprehensive library of
hardware (> 130 robots)
• Powerful ROS Tools E.g.:
Build, Visualization,
Transform, Graph
17
ROS benefits
• Reusable fine grained packages
• Distributed system
• Language independence
E.g.: C++, Python, Java . . .
• Open-Source interfaces.
– OpenCV - image processing
– RVIZ - visualisation
– Gazebo – simulation environment
• MoveIt! - path planning
https://metrics.ros.org/
18
ROS information
• Wiki.ros.org
• answers.ros.org
• https://discourse.ros.org/
19
ROS Wiki
20
ROS answers
21
ROS Discourse
22
ROS versions
ROS ROS2
23
Autoware Foundation
• Autoware.AI based initially on ROS 1
• New developments based on ROS2 functionalities
24
Apex.AI
25
ROS 2
Why?
26
ROS 2
Key features
> ament_tools
27
ROS 2
Architecture
28
How to get / start with ROS1
• See complete instructions on wiki.ros.org
29
ROS Filesystem
• ROS workspace environment
• ROS packages
30
ROS Filesystem Catkin is a collection of cmake macros and
associated python code used to build some
Workspace environment parts of ROS
> mkdir -p ~/catkin_ws/src Catkin is the official build system of
ROS. A catkin workspace is a folder,
> cd ~/catkin_ws/src in which you modify, build, and
install packages. It is the place to
> catkin_init_workspace create your own packages and
nodes or modify existing ones to fit
your application.
> cd ..
> catkin_make
31
ROS Filesystem
ROS Packages
2000+ packages available on wiki.ros.org
Installation options:
Debian Packages: Source Repositories:
• Automatic installation • “Latest” code
• Stable versions • Manual compilation
• Prebuilt binaries • Allows code adjustments
Depending on ROS version
32
Debian Packages:
ROS Filesystem • Automatic installation
• Stable versions
Packages • Prebuilt binaries
> sudo apt-get install ros-kinetic-package_name
https://wiki.ros.org https://index.ros.org
33
ROS Filesystem
Packages from source
Source Repositories: When?
• “Latest” code When Stable version for ROS version
• Manual compilation isn’t available
• Allows code adjustments
> git clone source-address
> catkin_make
34
ROS Filesystem
Folder structure
35
ROS components
• ROS master
• ROS node
• ROS launch
• ROS topics
• ROS message
• ROS service
• ROS parameter
36
ROS Master
• One master per ROS system
• Registry for:
– Nodes
– Topics
– Services
– Parameters
• Coordinating processes and communication
• Command to start a ROS master
> roscore
37
ROS node
• ROS executable
– Binaries of C++ files (uses roscpp ROS client library)
– Python scripts (uses rospy ROS client library)
• Processes that perform computation
• A ROS system is composed of many different nodes. Each
with a specific task: Camera, LIDAR, navigation,…)
• Needs a ROS master to function
• Command to start ROS node
> Rosrun <package_name> <executable_name> [arguments]
> rosnode list
> rosnode info <node_name>
38
ROS Node
Setup
39
Launch-file
• XML base
• Possible to start multiple nodes at the same time
– Supports arguments
– Supports parameters
– Nodes can be grouped
– Communication of nodes can be configured
• Starts a ROS master (if none exists)
> roslaunch <package_name> <launchfile_name>[arguments]
40
Launch-file
Example
41
ROS Topics
• Asynchronous streaming
• Multiple concurrent publisher
and subscribers for one topic
• A single node can publish and
subcribe to multiple topics
• Works like a “chat room”
• Examples: laser scan data,
images, robot position, odom,
cmd_vel
• Every topic has a dedicated
> rostopic list message type
> rostopic echo </topicname>
> rostopic info </topicname>
42
ROS Messages types (*.msg)
• Independent of the programming
language
• Can be constructed by the user
– Within in ROS package
• If possible, use predefined default
types to assure intercompatibility
– E.g.: std_msgs, geometry_msgs,
nav_msgs, sensor_msgs,
visualization_msgs,…
– www.wiki.ros.org/common_msgs
43
ROS Messages types (*.msg)
44
ROS parameter
Parameter server
• Allows data to be stored by key in a central location
• Global viewable
• Not designed for high-performance
– Query Only
• Most suitable for configuration information
45
ROS Commands - overview
46
Demo setup today
Catvehicle
CAT vehicle
Rahul Bhadani,
Jonathan Sprinkle,
Matthew Bunting. "The
CAT Vehicle Testbed: A
Simulator with Catvehicle Launch
Hardware in the Loop Joystick Launch
for Autonomous
Vehicle Applications".
Proceedings 2nd
International
Workshop on Safe
Control of Autonomous
Vehicles (SCAV 2018),
Porto, Portugal, 10th
April 2018, Electronic
Proceedings in
Theoretical Computer
Science 269, pp. 32–47.
Download: http://dx.do
i.org/10.4204/EPTCS.26
9.4.
RVIZ
Gazebo
RVIZ
Joystick Launch
47
ROS Tools
• Rqt – tools
• Gazebo
• Rviz
• Others
– PCL
– OpenCV
– Movit
48
ROS tools
RVIZ
49
ROS tools
Gazebo
50
ROS tools
rqt
qt-based framework for ROS GUIs
51
ROS tools
rqt
qt-based framework for ROS GUIs
52
ROS tools
Others
53
‘Autonomous’ navigation
ROSbot
https://husarion.com/
54
Demo Rosbot
ROSbot
https://husarion.com/
55
Navigation Package
56
Gmapping
ROS wrapper for OpenSlam’sGmapping
Laser-based SLAM(Simultaneous
Localization and Mapping)
Create a 2-D occupancy grid map (like
a building floorplan)
Gmapping make a map
- Control vehicle manual and scan the enviromnent
- Save the map
57
ACML
Adaptive Monte Carlo Localization
• a probabilistic localization system for a robot moving in 2D
• implements the adaptive Monte Carlo localization approach
• uses a particle filter to track the pose of a robot against a known map
• subscribes to (default):
– Laser scans : /scan (sensor_msgs/LaserScan)
– Transforms : /tf (tf/tfMessage)
– initial pose : /initialpose
– (geometry_msgs/PoseWithCovarianceStamped)
– map : /map (nav_msgs/OccupancyGrid)
• publishes (default):
– robot’s estimated pose in the map, with covariance: /amcl_pose
(geometry_msgs/PoseWithCovarianceStamped)
– pose estimates being maintained by the filter:
/particlecloud (geometry_msgs/PoseArray)
– the transform from odom : /tf (tf/tfMessage)
58