ROS Intro
ROS Intro
• What is it?
• Brief History
• Key ROS Concepts: Nodes & Publishers
• Getting started with ROS: workspaces & packages
Movebase:
• A basic starting point for motion control under ROS
Why ROS?
Robots are computer-controlled electromechanical devices
• First dedicated robot programming languages in the 1970’s
• Robot-centric data types and some robot function libraries
• Didn’t allow for much hardware abstraction, multi-robot interaction, helpful
human interface, or integrated simulation.
• Not much code reuse, or standardization
• Efforts to build robot programming systems continued through 80’s, 90’s
• Several efforts beginning in the 2000’s to standardize robot components, their
interfaces, and basic functions. Sensing, computation, communication become
cheap, and distributed
As robot components and computers became standardized:
• Need fast prototyping (fast debugging, pre-existing drivers, ….)
• Want plug-and-play characteristic for basic hardware modules
• Linux model of community development and contributions
High Level View of ROS
A mix of “Meta” operating system, “Middleware”, and programming model
• A set of libraries, tools, and “packages”
• Allows for hardware abstraction across different robot platforms
• Low level device control
• Encourages Code Reuse so that you can build on others’ work
• Tool-based development
• Provides computation models and communication protocols
• Supports Multiple Development Languages (C++, Python, Java, MATLAB, LISP, ….)
• Scalable (in theory) to large systems and system-level development
• Not quite “real-time”, but can work with real-time modules
Subscribe:
• If a node subscribes to a topic, then it receives and understands data published
under that topic.
ROS Messages
Messages are published to topics
Message Format:
• Strictly typed data structure:
• Typed fields (some are predefined in std_msgs) ,
• but user definable as well
E.g. float64 x vector3 linear_velocity
float64 y vector3 position vector3 angular_velocity
float64 z
• .msg text files specify the data structure of a message, and are stored in message
subdirectory of a package
Message Guarantees:
• Will not block until receipt, messages get queued
• Can set buffer length: e.g., N messages before oldest is thrown away
ROS Service
Service:
• A mechanism for a node to send a request to another node, and receive a
response:
• Synchronous node interaction
• two way communication
• Trigger functions and “behaviors”
• Uses a request-response paradigm:
• A request structure contains the message to request the service
• A response structure is returned by the service
• Analogous to a Remote Procedure Call (RPC)
Examples:
• Request an updated map, or portion of a map from a “map server”
• Request and receive status information from another vehicle
Parameter Server
A shared “Dictionary”
• Best used for static data, such as parameters that are needed at start-up.
• Runs in the ROS master
• E.g.:
• lidar scan rate
• Number of Real-Sense sensors in a networked sensing situation
ROS Master
Master: Matchmaker between nodes
• Nodes make be on different cores, different computers, different robots, even
different networks. This should be transparent to each node’s code
• The “master” service runs on one machine.
• It provides name registration & lookup of nodes and services
• roscore starts the master server, parameter server, and logging processes (if any)
• Roscore acts like a name server so that nodes get to know each other
• Every node connects to the master at start-up to register details of the message
streams that it publishes. Also determine its connectivity with the rest of the
computation graph via its subscriptions.
ROS Packages
Package: Basic organizational and code reuse unit of ROS software
• Contains one or more nodes & provides a ROS interface (via messages, services)
• Typically implements a well defined function, like making a map from sensory data
• Organized into a self-contained directory (with a specific structure) containing
source code for nodes, message definitions, services, etc.
• Data logging:
• Rosbag record [topics] –o < output_file>
• Data playback:
• Rosbag play <input_file> --clock
Many ROS Tools
Visualization Tools: RVIZ Simulation Tools:
• Sensor and robot state data • Gazebo: started as grad student project at USC
• Coordinate frames • Can model and simulate motions/dynamics of
• Maps, built or in process different robots
• Visual 3D debugging markers • Can simulate sensory views
• Can build different environments
• Can run simulation from ROS code for testing
A first look at move_base
move_base is a package that implements an action in ROS.
• An action can be preempted
• An action can provide periodic feedback on its execution
move_base is a node that moves a robot (the “base”) to a goal
• It links a global and local planner with sensory data and maps that are being built, so
that the navigation stack can guide the robot to a goal, and have recovery strategies
Goals for Next Week
GO through the first 2-3 steps of the Core ROS Tutorial at the beginner’s level.
• You may prefer to start the first few steps of “A Guided Journey to the Use of ROS”