Robotic Perception and Action

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

Teaching Assistant: Roi Yehoshua
Teaching Assistant: Roi Yehoshua
Teaching Assistant: Roi Yehoshua
I NTRODUCTION TO ROBOTICS Tutorial 1. A GENDA Administrations Basic Matlab Robotic Tool Box Introduction to ROS.
Teaching Assistant: Roi Yehoshua
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 12 Separate Compilation Namespaces Simple Make Files (Ignore all class references.
Teaching Assistant: Roi Yehoshua
Teaching Assistant: Roi Yehoshua
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
Teaching Assistant: Roi Yehoshua
Robot Operating System Tutorial ROS Basic
1 ENG236: ENG236: C++ Programming Environment (2) Rocky K. C. Chang THE HONG KONG POLYTECHNIC UNIVERSITY.
Starting Chapter 4 Starting. 1 Course Outline* Covered in first half until Dr. Li takes over. JAVA and OO: Review what is Object Oriented Programming.
Teaching Assistant: Roi Yehoshua
Multi-Robot Systems with ROS Lesson 1
Intro. to Game Programming Want to program a game?
What is ROS? Robot Operating System
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
Teaching Assistant: Roi Yehoshua
Teaching Assistant: Roi Yehoshua
chap13 Chapter 13 Programming in the Large.
The Pipeline Processing Framework LSST Applications Meeting IPAC Feb. 19, 2008 Raymond Plante National Center for Supercomputing Applications.
Java and C# [this is a bonus – it is not a required lesson] ACO101: Introduction to Computer Science.
Ch 1. A Python Q&A Session Spring Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.
Teaching Assistant: Roi Yehoshua
1 Programming in C Hello World! Soon I will control the world! Soon I will control the world!
1 C++ Programming Basics Chapter 1 Lecture CSIS 10A.
Teaching Assistant: Roi Yehoshua
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
J.P. Wellisch, CERN/EP/SFT SCRAM Information on SCRAM J.P. Wellisch, C. Williams, S. Ashby.
Teaching Assistant: Roi Yehoshua
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
Development Environment
Lecturer: Roi Yehoshua
Chapter 5: Enhancing Classes
Programming what is C++
Lecturer: Roi Yehoshua
Python’s Modules Noah Black.
Node.js Express Web Applications
Lecturer: Roi Yehoshua
Self Healing and Dynamic Construction Framework:
ROSLab: a High Level Programming Language for Robotic Applications
Cross Platform Development using Software Matrix
Remote Method Invocation
Chapter 2: System Structures
MPI Message Passing Interface
The Linux Operating System
Getting Started with C.
What is ROS? ROS is an open-source robot operating system
Multi-Robot Systems with ROS Lesson 2
CSE 390a Lecture 1 introduction to Linux/Unix environment
- The Robot Operating System
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
Robotics and Perception
Comments, Prototypes, Headers & Multiple Source Files
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Chapter 7 –Implementation Issues
Quick Introduction to ROS
Robotic Perception and Action
Robotic Perception and Action
Robotic Perception and Action
Chap 1. Getting Started Objectives
Chap 4. Programming Fundamentals
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
 A function is a named sequence of statement(s) that performs a computation. It contains  line of code(s) that are executed sequentially from top.
Chapter 2 part #1 C++ Program Structure
Robot Operating System (ROS): An Introduction
SPL – PS1 Introduction to C++.
Presentation transcript:

Robotic Perception and Action ROS Framework

What is ROS? Writing a ROS Program References ROS Distribution ROS Packages ROS Master and Nodes ROS Topics and Messages Writing a ROS Program ROS Workspace Environment ROS Dependencies ROS Package ROS Simple Program: Hello World! Catkin Executing Hello World! helloworld tree References Index

Robot Operating System (ROS) is: Definition Robot Operating System (ROS) is: An open-source, meta OS for your robot It provides the services you would expect from an operating system, including: Hardware abstraction Low-level device control Implementation of commonly-used functionality Message-passing between processes Package management It provides tools and libraries for obtaining, building, writing, and running code across multiple computers Originally developed in 2007 at the Stanford Artificial Intelligence Laboratory and development continued at Willow Garage Since 2013 managed by OSRF (Open Source Robotics Foundation) What is ROS?

ROS is not: a programming language (only) a library an integrated development environment (IDE) What is ROS?

A ROS distribution is a versioned set of ROS packages with the purpose to let developers work against a relatively stable codebase until they are ready to roll everything forward. In our case, for the UBUNTU 14.04.1 (Trusty LTS) Virtual Machine we use the stable version of ROS INDIGO (IGLOO, 2014) ROS Distribution in Virtual Machine

Listing and locating packages > rospack list All ROS software is organized into packages. A ROS package is a coherent collection of files, generally including both executables and supporting files, that serves a specific purpose. Listing and locating packages > rospack list Each package is defined by a manifest, which is a file called package.xml . This file defines some details about the package, including its name, version, maintainer, and dependencies. The directory containing package.xml is called the package directory. This directory stores most of the package’s files. ROS Packages

Retrieve information about a node with: ROS Master: Manages the communication between nodes Every node registers at startup with the master Start a master with: > roscore ROS Nodes are: Single-purpose, executable program Compiled, executed, and managed Organized in packages Run a node with: > rosrun package_name node_name See active nodes with: > rosnode list Retrieve information about a node with: > rosnode info node_name Package ROS Master and Nodes

List active topics with: Nodes communicate over topics Nodes can publish and/or subscribe to/from a topic Typically, 1 publisher and n subscribers Topic is a name for a stream of messages List active topics with: > rostopic list Subscribe and print the contents of a topic with: > rostopic echo /topic Show information about a topic with: > rostopic info /topic ROS messages are data structure: Defining the type of a topic Compromised of a nested structure of integers, floats, booleans, strings etc. Defined in *.msg files See the type of a topic: > rostopic type /topic Publish a message to a topic: > rostopic pub /topic type args ROS Topics and Messages

> mkdir -p ~/catkin_ws/src If there is not, defines context for the current workspace by creating a folder with the following command: > mkdir -p ~/catkin_ws/src Inside the src workspace directory there will be the source code for packages. There exists a default workspace loaded with: > source /opt/ros/indigo/setup.bash NB: This command MUST BE called every time we start a terminal/shell in which we call a ROS launch or run command (also roscore) Check your workspace with: > echo $ROS_PACKAGE_PATH ROS Workspace Environment

ROS packages sometimes require external libraries and tools that must be provided by the operating system (system dependencies). In some cases these system dependencies are not installed by default. Example of dependencies can be: gazebo_msgs: provides message and service data structures for interacting with Gazebo from ROS geometry_msgs: provides messages for common geometric primitives such as points, vectors, and poses. roscpp: it is a C++ implementation of ROS rospy: it is a pure Python client library for ROS sensor_msgs: defines messages for commonly used sensors, including cameras and scanning laser rangefinders. std_msgs: Standard ROS Messages including common message types representing primitive data types and other basic message constructs urdf: contains a C++ parser for the Unified Robot Description Format (URDF), which is an XML format for representing a robot model ROS Dependencies

A package is created inside the ws directory with: Go to src directory: > cd ~/catkin_ws/src A package is created inside the ws directory with: > catkin_create_pkg --rosdistro indigo helloworld roscpp Command ROS Version Package Name Dependencies (OPTIONAL) Inside the directory src automatically the command creates a package directory called helloworld with two files: package.xml: XML file containing all the build/run dependencies CMakeLists.txt: cmake file containing the name of dependencies used and the executable files linked to the target file names And two (optional) directories (because we defined the dependency roscpp and we want to work in cpp): include: put here (if needed and inside the name of package helloworld) all the headers .h files src: put here all the files .cpp ROS Package

ROS Simple Program: Hello World! Go to the src directory and create with gedit a hello.cpp file and copy: /* This is a ROS version of the standard "hello world" program. */ #include <ros/ros.h> // This header defines the standard ROS classes. /* The header file ros/ros.h includes declarations of the standard ROS classes. You’ll want to include it in every ROS program that you write. */ int main (int argc, char **argv){ // Initialize the ROS system . ros::init(argc, argv, "hello"); /* The ros::init function initializes the ROS client library. Call this once at the beginning of your program. The last parameter is a string containing the default name of your node. */ ros::NodeHandle nh; //Establish this program as a ROS node. /* The ros::NodeHandle object is the main mechanism that program uses to interact with the ROS system. */ ROS_INFO_STREAM("Hello, ROS!"); // Send some output as a log message. /* The ROS_INFO_STREAM line generates an info message, sent to locations, including console screen. */ } ROS Simple Program: Hello World!

Open with gedit the CMakeLists Open with gedit the CMakeLists.txt file and copy before the end of file: add_executable(hello src/hello.cpp) # hello is the name of exec, src/hello.cpp the path target_link_libraries(hello ${catkin_LIBRARIES}) In this way we have created the Node file hello related to the .cpp file hello.cpp. ROS Simple Program: Hello World!

To build your package we have to return to the root directory of our workspace: > cd /home/student/catkin_ws or > cd ~/catkin_ws Build and create executable for all packages: > catkin_make If all is ok, it will create other 2 directories called build and devel: Now you update your environment: > source devel/setup.bash NB: catkin is the ROS build system to generate exec, libraries, and interfaces. Catkin

> rosrun helloworld hello Command Package Executable Node When all of those build steps are complete, your new ROS program is ready to execute using rosrun just like any other ROS program. Open a terminal and launch the roscore command Open a second terminal and launch our example, the command is: > rosrun helloworld hello Command Package Executable Node If the package is not visible, try to restart the shell or run the command: > rospack find helloworld or rospack profile find helloworld If all is ok, it will produce as result: Executing Hello World!

helloworld tree

A Gentle Introduction to ROS (Jason M. O’Kane) Wiki ROS Tutorials https://www.cse.sc.edu/~jokane/agitr/ Wiki ROS Tutorials  http://wiki.ros.org/ROS/Tutorials Slides course (Roi Yehoshua) https://u.cs.biu.ac.il/~yehoshr1/89-685/ References