CMP3103M AMR 2 – Programming.key
!
CMP3103M AMR
Dr. Marc Hanheide
!
SYLLABUS
‣ Introduction to Robotics
‣ Robot Programming
‣ Robot Vision
‣ Robot Control
‣ Robot Behaviours
‣ Control Architectures
‣ Navigation Strategies
‣ Map Building
Disclaimer:
These slides are not self-
contained, this is going to be an
interactive lecture
!
ASSESSMENT
‣ Programming in Python & ROS
‣ implement an object search behaviour in simulation
‣ give a 5 minutes (max! You’ll be cut short of you go over) on
your implementation
‣ read the Brief & CRG!
!
MOBILE ROBOT COMPONENTS
Mobile
Robot Body
Actuators
wheels and
motors, gripper
Sensors
cameras, sonars,
laser Processing
Unit
on-board PC
Software/
Commands
C++ library
!
PROCESSING UNIT
‣ On-board
‣ fast responses
‣ embodied, processing power limited by the physical
size of a robot
‣ Off-board
‣ remote computer(s) – significant processing power
‣ problems with communication, data transfer and
synchronisation
‣ Hybrid architecture
‣ on board for low-level tasks
‣ PC for higher-level tasks
!
ROBOT SOFTWARE
‣ Hardware drivers, (real-time) operating system
‣ Audio/video encoders
‣ Command interface, firmware
‣ Sensor/Image processing library
‣ Software components implementing AI, navigation, decision
making
‣ Simulator
!
HOW TO TALK TO A ROBOT
‣ We need to be able to:
‣ send motor/actuator commands
‣ read and process data from sensors
‣ in some robots there is an abstraction layer featuring a shared domain-specific
command language to access all sensors and actuators (highly integrated)
‣ implemented inside the robot
‣ can be messages sent through serial port, Ethernet (Wifi)
‣ Our Turtlebots are more modular, different sensors talk via USB
‣ the have their dedicated ROS driver nodes to talk to us
‣ HENCE, we need to able to communicate!
!
MIDDLEWARE?
Middleware supports and simplifies complex distributed applications.
!
ROBOTIC MIDDLEWARES
‣ Support for different robots, platforms, unified interface, plug-
ins/modules (e.g. navigation, object recognition), simulator, etc.
‣ Robot Operating System (ROS)
(http://www.ros.org/wiki/rovio)
‣ Microsoft Robotics
Developer Studio
for Windows
‣ OROCOS
‣ YARP
‣ RSB
‣ …
http://www.ros.org/wiki/rovio
!
ROS
‣ ROS is a communication middleware with a huge library of
state of the art algorithms being freely available
‣ ROS encapsulates functionality into individual nodes
‣ Nodes communicate via data streams
‣ nodes implement callback (data push)
‣ C++, java, Python (and others more) supported
!
IMPLEMENTING TASKS/
BEHAVIOURS
‣ Scripts
‣ A pre-programmed sequence of commands
‣ Continuous operation (robot control)
‣ Sense
‣ read sensor data
‣ Think
‣ process data and make decisions
‣ Act
‣ execute actions (send movement commands)
environment
think
sense
act
!
SENSE – (THINK) – ACT
‣ Two Options
‣ Synchronous:
‣ like a while loop:
while (true)
{
robot.sense();
robot.think();
robot.act();
}
‣ Asynchronous:
‣ different threads with shared (and synchronised) memory access
Easier
basically how ROS works
data pull
data callbacks
AND NOW FOR SOME REAL
CODING IN ROS
STOLEN ADOPTED INTRO
ABOUT ROS
!
!
!
!
!
RS
‣ roscore
‣ rosnode list
‣ rostopic list
‣ rosservice list
‣ rqt_graph
‣ (roslaunch ~/test.launch)
always use [Tab] and “-h”
when working on the
command line!
!
DATA TYPES
‣ Let’s have a look
‣ useful tools:
‣ rostopic pub
‣ rostopic echo
‣ rostopic info
‣ rosmsg
‣ rossrv
message type define what is
being exchanged between
nodes
!
PARAMS
‣ Let’s have a look
‣ useful tools:
‣ rosparam list
‣ rosparam set
‣ rosparam get
params are a little advanced
but important to configure
other components
!
A SIMPLE COMMUNICATION
‣ Let’s implement a simple communication A->B
(without programming, just using rostopic)
!
!
time for a
break?
TIME FOR SOME PYTHON
!
A FRESH START
• create you own catkin workspace:
• mkdir catkin_ws
• cd catkin_ws
• mkdir src
• cd src
• catkin_init_workspace
http://wiki.ros.org/catkin/Tutorials/create_a_workspace
http://wiki.ros.org/catkin/Tutorials/create_a_workspace
!
A FRESH START
• create your own package:
• catkin_create_pkg [-h]
• cd ..
• catkin_make
• source devel/setup.bash
http://wiki.ros.org/ROS/Tutorials/CreatingPackage
http://wiki.ros.org/ROS/Tutorials/CreatingPackage
HELP
http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28python%29
http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28python%29
!
COMPUTER VISION LIBRARIES
‣ OpenCV
‣ ‘The’ Computer Vision Library – C++, Python, multiplatform
‣ rich functionality, well tested, used in many systems, lots of
examples
!
RECOMMENDED READING
‣ Biggs, G. and MacDonald, B. A Survey of Robot Programming
Systems, 2003
‣ Programming Robots with ROS (Morgan Quigley, Brian Gerkey
& And William D. Smart.) (ebook on reading list)
‣ The ROS tutorials!!!
‣ Resources:
‣ http://answers.ros.org
‣ http://wiki.ros.org/ROS/Tutorials
‣ https://github.com/LCAS/teaching/wiki/CMP3641M
http://www.cs.jhu.edu/~alamora/ire/res/papers/BiggsProgSurvey.pdf
http://answers.ros.org
http://wiki.ros.org/ROS/Tutorials
https://github.com/LCAS/teaching/wiki/CMP3641M
!
THANK YOU FOR LISTENING!