ROS - LESSON 2. Curso Development environment setup. ROS packages structure. ROS Integration with Eclipse. Writing your first Node

Similar documents
CSCI 473/573 Human-Centered Robotics. Special Thanks: The slides of ROS basics are adapted from Roi Yehoshua

Teaching Assistant: Roi Yehoshua

ROS BASICS. Sören Schwertfeger / 师泽仁

PUBLISHER-SUBSCRIBER ROBOTICS

Tutorial on Robot Operating System (ROS)

An Introduction to ROS. Or how to write code that starts fires!

ECE 5463 Introduction to Robotics Spring 2018 ROS TUTORIAL 1. Guillermo Castillo (Wei Zhang)

A Gentle Introduction to ROS

Installation of the PLCnext Technology SDK and Eclipse

Assignment 1. Please follow these instructions to install ROS; you will want to install the ROS Indigo Igloo (rosindigo-desktop-full

Teaching Assistant: Roi Yehoshua

Programming Robots with ROS, Morgan Quigley, Brian Gerkey & William D. Smart

ROS-Industrial Basic Developer s Training Class

ROS Robot Operating System

ROS-Industrial Basic Developer s Training Class

Parallel Programming

Introduction to Robot Operating System (ROS) using C++

Programming for Robotics Introduction to ROS

Introduction to Supercomputing

ROS: Robot Operating System. Presented by: Anqi Xu COMP-417, McGill University Tuesday September 16th, 2014

Laurea magistrale in ingegneria e scienze informatiche. Corso di Robotica Parte di Laboratorio. + Docente: Domenico Daniele Bloisi.

data source/sink to which messages are posted to or subscribed from. a topic consists of a namespace/topicname.

Download, Install and Setup the Linux Development Workload Create a New Linux Project Configure a Linux Project Configure a Linux CMake Project

CMPT 300. Operating Systems. Brief Intro to UNIX and C

Assignment 1. First type the following in a terminal: (for your own benefits, make sure you understand what each of these lines is doing)

Lab 1: First Steps in C++ - Eclipse

Teaching Assistant: Roi Yehoshua

Module 3: Working with C/C++

Eclipse CDT Tutorial. Eclipse CDT Homepage: Tutorial written by: James D Aniello

Programming for Robotics Introduction to ROS

Installing Eclipse CDT and MinGW

ROS tf System February, Janyl Jumadinova

LOITOR Visual-Inertial Camera. Instruction manual V0.6

Exercise 1: Basic Tools

COSE222 Computer Architecture

ROS Services. Request/response communication between nodes is realized with services

CS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco

Using Eclipse for C, MPI, and Suzaku

Android SDK under Linux

Robot Vision Systems Lecture 10: ROS Basics

The transition from ROS 1 to ROS 2

Applied Informatics POCO PRO C++ Frameworks

AN 834: Developing for the Intel HLS Compiler with an IDE

auros Documentation and Interface Specification

Introduction to ROS. COMP3431 Robot Software Architectures

ECM583 Special Topics in Computer Systems

CSE 351. Introduction & Course Tools

UNic Eclipse Mini Tutorial (Updated 06/09/2012) Prepared by Harald Gjermundrod

Introduction. Key features and lab exercises to familiarize new users to the Visual environment

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2010

ROS Qt Creator Plug-in. Release

A Gentle Introduction to ROS

Problem Set 1: Unix Commands 1

How I Learned to Stop Reinventing and Love the Wheels. with (home/hackerspace) robotics

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

Course Updates. Website set-up at

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2005

Laboratory Assignment #4 Debugging in Eclipse CDT 1

Installing Eclipse (C++/Java)

ROS+GAZEBO. Part 1.

Building and Running a Simple UML RT Model in RSARTE

Manual Eclipse CDT Mac OS Snow Leopard

catkin_tools Documentation

2 Compiling a C program

Laboratory Assignment #3 Eclipse CDT

Eclipse Environment Setup

Introduc)on to CMake. Ben Thomas.

FX SERIES. Programmer s Guide. Embedded SDK. MN000540A01 Rev. A

Working with Shell Scripting. Daniel Balagué

Lab #1: A Quick Introduction to the Eclipse IDE

Scientific Software Development with Eclipse

Code::Blocks Student Manual

Check the Desktop development with C++ in the install options. You may want to take 15 minutes to try the Hello World C++ tutorial:

Cognitive Robotics ROS Introduction Matteo Matteucci

Programs. Function main. C Refresher. CSCI 4061 Introduction to Operating Systems

ncsa eclipse internal training

CSC111 Computer Science II

ROS Crash-Course, Part II

Developing using C on imx Developer s Kits

PRINCIPLES OF OPERATING SYSTEMS

DS-5 ARM. Using Eclipse. Version Copyright ARM. All rights reserved. ARM DUI 0480L (ID100912)

Using Eclipse for Java. Using Eclipse for Java 1 / 1

Code::Blocks Student Manual

Introduction to Robot Operating System (ROS)

Setting up cross compiling environment & Qt/X11 for the DXSERIES with the ELDK cross compiler

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

CS 220: Introduction to Parallel Computing. Beginning C. Lecture 2

TNM093 Practical Data Visualization and Virtual Reality Laboratory Platform

Parallel Tools Platform for Judge

CSCI 201 Lab 1 Environment Setup

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2003

CS240: Programming in C

ROS Qt Creator Plug-in. Release

HOW TO USE CODE::BLOCKS IDE FOR COMPUTER PROGRAMMING LABORATORY SESSIONS

VikiLABS. July 8, 2017

EE516: Embedded Software Project 1. Setting Up Environment for Projects

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Captronic 15. Robotic Middlewares

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 14

Transcription:

Curso 2017-18 Development environment setup ROS packages structure ROS Integration with Eclipse JUAN CARLOS ALVAREZ JUAN@UNIOVI.ES Writing your first Node Running and debugging ROS - LESSON 2

ROS DEVELOPMENT SETUP ROS DEVELOPMENT SETUP Create a new catkin workspace Create a new ROS package Download and configure Eclipse Create Eclipse project file for your package Import package into Eclipse Write the code Update the make file Build the package

TEXTO CATKIN WORKS PACE LAYOUT

TEXTO CREATING & BUILDING A CATKIN WORKSPACE http://wiki.ros.org/catkin/tutorials/create_a_workspace $ mkdir -p ~/catkin_ws/src $ cd ~/catkin_ws/src $ catkin_init_workspace catkin_make command builds the workspace $ cd ~/catkin_ws $ catkin_make

TEXTO COMMON FILES AND DIRECTORIES

TEXTO THE PACKAGE MANIFEST

TEXTO THE PACKAGE MANIFEST

TEXTO CREATING A ROS PACKAGE http://wiki.ros.org/catkin/tutorials/creatingpackage Change to the source directory of the workspace $ cd ~/catkin_ws/src catkin_create_pkg creates a new package with the specified dependencies $ catkin_create_pkg <package_name> [depend1] [depend2] [depend3] For example, create a first_pkg package: $ catkin_create_pkg first_pkg std_msgs rospy roscpp

ECLIPSE WITH ROS ECLIPSE WITH ROS: INSTALLING Make sure JVM is installed $sudo apt-get install default-jre Download eclipse IDE for C/C++ developers from http://www.eclipse.org/downloads/ Latest version of the file is: eclipse-cpp-luna-sr1-linux-gtk-x86_64.tar.gz Extract eclipse into a folder of your choice Move eclipse to the /opt folder. $sudo mv eclipse /opt Create a link to it so it can be used by all users $sudo ln -s /opt/eclipse/eclipse /usr/bin/eclipse

ECLIPSE WITH ROS INSTALLING ECLIPSE Make an entry in the Unity Dash for easier access $sudo gedit /usr/share/applications/eclipse.desktop [Desktop Entry] Name=Eclipse Type=Application Exec=bash -i -c "/opt/eclipse/eclipse" Terminal=false Icon=/opt/eclipse/icon.xpm Comment=Integrated Development Environment NoDisplay=false Categories=Development;IDE Name[en]=eclipse.desktop The bash i - c command will cause your IDE's launcher icon to load your ROSsourced shell environment before launching eclipse

ECLIPSE WITH ROS MAKE ECLIPSE PROJECT FILES Go to workspace directory and run catkin_make with options to generate eclipse project files: $ cd ~/catkin_ws $ catkin_make --force-cmake -G"Eclipse CDT4 - Unix Makefiles" The project files will be generated in ~/catkin_ws/build

ECLIPSE WITH ROS IMPORT THE PROJECT INTO ECLIPSE Now start Eclipse Choose catkin_ws folder as the workspace folder

ECLIPSE WITH ROS IMPORT THE PROJECT INTO ECLIPSE Choose File --> Import --> General --> Existing Projects into Workspace

ECLIPSE WITH ROS IMPORT THE PROJECT INTO ECLIPSE Now import the project from the ~/catkin_ws/build folder

ECLIPSE WITH ROS FIX PREPROCESSOR INCLUDE PATHS By default, the intellisense in Eclipse won t recognize the system header files (like <string>). To fix that: Go to Project Properties --> C/C++ General --> Preprocessor Include Paths, Macros, etc. --> Providers tab Check CDT GCC Builtin Compiler Settings [Shared]

ECLIPSE WITH ROS FIX PREPROCESSOR INCLUDE PATHS After that rebuild the C/C++ index by Right click on project -> Index -> Rebuild

ECLIPSE WITH ROS PROJECT STRUCTURE Eclipse provides a link "Source directory" within the project so that you can edit the source code

ECLIPSE WITH ROS ADD NEW SOURCE FILE Right click on src and select New > Source File, and create a file named hello.cpp

ECLIPSE WITH ROS CODE COMPLETION Use Eclipse standard shortcuts to get code completion (i.e., Ctrl+Space)

TEXTO ROS::INIT & ROS::NODEHANDLE & ROS::RATE A version of ros::init() must be called before using any of the rest of the ROS system ros::init(argc, argv, "Node name"); Create a handle to the main access point node: ros::nodehandle node; A class to help run loops at a desired frequency. ros::rate loop_rate(10);

TEXTO ROS::OK() Call ros::ok() to check if the node should continue running ros::ok() will return false if: a SIGINT is received (Ctrl-C) we have been kicked off the network by another node with the same name ros::shutdown() has been called by another part of the application. all ros::nodehandles have been destroyed

TEXTO ROS DEBUG MESSAGES ROS_INFO prints an informative message ROS_INFO( "My INFO message." ); All messages are printed with their level and the current timestamp [ INFO] [1356440230.837067170]: My INFO message. This function allows parameters as in printf: ROS_INFO("My INFO message with argument: %f", val );

TEXTO C++ FIRST NODE EXAMPLE /* * hello.cpp ; Created on: Nov 1, 2014 ; Author: Roi Yehoshua */ #include "ros/ros.h" int main(int argc, char **argv) { ros::init(argc, argv, "hello"); ros::nodehandle nh; ros::rate loop_rate(10); int count = 0; while (ros::ok()) // Keep spinning loop until user presses Ctrl+C { ROS_INFO_STREAM("hello world" << count); ros::spinonce(); // Allow ROS to process incoming messages loop_rate.sleep(); // Sleep for the rest of the cycle count++; } return 0; }

TEXTO CMAKELISTS. TXT cmake_minimum_required(version 2.8.3) project(first_pkg) ## Find catkin macros and libraries find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs) ## Declare ROS messages and services # add_message_files(files Message1.msg Message2.msg) # add_service_files(files Service1.srv Service2.srv) ## Generate added messages and services # generate_messages(dependencies std_msgs) ## Declare catkin package catkin_package() ## Specify additional locations of header files include_directories(${catkin_include_dirs}) ## Declare a cpp executable add_executable(hello src/hello.cpp) ## Specify libraries to link a library or executable target against target_link_libraries(hello ${catkin_libraries})

TEXTO BUILDING YOUR NODES To compile the project in Eclipse press Ctrl-B To build the package in the terminal call catkin_make

RUNNING THE NODE FROM TERMINAL $ cd ~/catkin_ws $ source./devel/setup.bash $ rosrun first_pkg hello

TEXTO RUNNING THE NODE INSIDE ECLIPSE Create a new launch configuration, by clicking on Run --> Run configurations... --> C/C++ Application (double click or click on New). Select the correct binary on the main tab (use the Browse button) ~/catkin_ws/devel/lib/first_pkg/hello Make sure roscore is running in a terminal Click Run

RUNNING THE NODE INSIDE ECLIPSE

RUNNING THE NODE INSIDE ECLIPSE

DEBUGGING DEBUGGING To enable debugging, you should first execute the following command in catkin_ws/build: $ cmake../src -DCMAKE_BUILD_TYPE=Debug Restart Eclipse Then you will be able to use the standard debugging tools in Eclipse

DEBUGGING

TEXTO HOMEWORK (NOT FOR SUBMISSION) Install Eclipse and integrate it with ROS Create a new ROS package called "timer_package" Create a node in this package called "timer_node" The node should print to the console the current time every 1 second