Lecturer: Roi Yehoshua

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

Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
Teaching Assistant: Roi Yehoshua
Teaching Assistant: Roi Yehoshua
KEVIN DANIELS ECLIPSE. OVERVIEW Integrated Development Environment (IDE) Usually used to develop applications in various programming languages (C, C++.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
Teaching Assistant: Roi Yehoshua
Teaching Assistant: Roi Yehoshua
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
LAMAD Symbian Qt install and deploy Installing Qt SDK and deploying Qt applications.
Julie McEnery1 Installing the ScienceTools The release manager automatically compiles each release of the Science Tools, it creates a set of wrapper scripts.
Teaching Assistant: Roi Yehoshua
Part 1 Using the ARM board And start working with C Tutorial 5 and 6
Robot Operating System Tutorial ROS Basic
1 ENG236: ENG236: C++ Programming Environment (2) Rocky K. C. Chang THE HONG KONG POLYTECHNIC UNIVERSITY.
One to One instructions Installing and configuring samba on Ubuntu Linux to enable Linux to share files and documents with Windows XP.
Teaching Assistant: Roi Yehoshua
What is ROS? Robot Operating System
CS5103 Software Engineering Lecture 08 Android Development II.
Tutorial 11 Installing, Updating, and Configuring Software
Teaching Assistant: Roi Yehoshua
CS Tutorial 1 Getting Started with Visual Studio 2012 (Visual Studio 2010 are no longer available on MSDNAA, please choose Visual Studio 2012 which.
chap13 Chapter 13 Programming in the Large.
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Appendix E The EZJava.
CSE 332: C++ debugging in Eclipse C++ Debugging in Eclipse We’ve now covered several key program features –Variable declarations, expressions and statements.
® 2-2 Projects 2.1Projects Overview Bootable Projects and VxWorks Configuration Integrated Simulator Downloadable Projects Build Specifications.
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
Active-HDL Interfaces Debugging C Code Course 10.
Active-HDL Interfaces Building VHPI Applications C Compilation Course 9.
OpenModelica Eclipse Setup
Teaching Assistant: Roi Yehoshua
9/2/ CS171 -Math & Computer Science Department at Emory University.
From Scratch: Open CCS Exit and restart CCS Click Browse to create a new workspace directory.
Android Hello World 1. Click on Start and type eclipse into the textbox 2.
1 Getting Started with C++. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Visual Studio 2008.
First Venture into the Android World Chapter 1 Part 2.
Teaching Assistant: Roi Yehoshua
Surya Bahadur Kathayat Outline  Ramses  Installing Ramses  Ramses Perspective (Views and Editors)  Importing/Exporting Example.
Introduction to Eclipse Programming with an Integrated Development Environment.
© I-Logix Rhapsody C++ V /01/2004E1-1 “Essential” Tool Training Basic Rhapsody Basic Rhapsody Rhapsody in C++ V /01/04.
1 Getting Started with C++ Part 1 Windows. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Microsoft.
Open project in Microsoft Visual Studio → build program in “Release” mode.
Teaching Assistant: Roi Yehoshua
CSE 332: C++ debugging in Eclipse C++ Debugging in Eclipse We’ve looked at programs from a text-based mode –Shell commands and command lines –Text editors,
Time to apply stuff… Faculty of Mathematics and Physics Charles University in Prague 5 th October 2015 Workshop 1 – Java Wrestling.
L071 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program Reading Sections
CACI Proprietary Information | Date 1 PD² SR13 Client Upgrade Name: Semarria Rosemond Title: Systems Analyst, Lead Date: December 8, 2011.
 CSC 215 : Procedural Programming with C C Compilers.
CSE 332: Scientific debugging in C++ Scientific Debugging in C++ (with Eclipse & gdb) By now we’ve covered several key C++ features –Variable declarations.
Eclipse.
Development Environment
Getting started with the Arxterra software and 3DoT Firmware
Lecturer: Roi Yehoshua
Obtaining the Required Tools
Lecturer: Roi Yehoshua
What is ROS? ROS is an open-source robot operating system
Introduction to C Topics Compilation Using the gcc Compiler
CENG2400 Tutorial 1 Keil IDE CENG2400 tutorial 1 v.7a.
- The Robot Operating System
Getting Started: Developing Code with Cloud9
Quick Introduction to ROS
Software Setup & Validation
Robotic Perception and Action
Appendix F C Programming Environment on UNIX Systems
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
Robotic Perception and Action
Carthage ios 8 onwards Dependency manager that streamlines the process of integrating the libraries into the project.
Compiler vs linker The compiler translates one .c file into a .o file
Robot Operating System (ROS): An Introduction
SPL – PS1 Introduction to C++.
Presentation transcript:

Lecturer: Roi Yehoshua roiyeho@gmail.com October 2016 ROS – Lecture 2 catkin build system ROS packages Building ROS nodes Lecturer: Roi Yehoshua roiyeho@gmail.com

catkin Build System catkin is the ROS build system The set of tools that ROS uses to generate executable programs, libraries and interfaces The original ROS build system was rosbuild Still used for older packages Implemented as custom CMake macros along with some Python code (C)2016 Roi Yehoshua

catkin Workspace A set of directories in which a set of related ROS code lives You can have multiple ROS workspaces, but you can only work in one of them at any one time Contains the following spaces: Contains the source code of catkin packages. Each folder within the source space contains one or more catkin packages. Source space is where CMake is invoked to build the catkin packages in the source space. CMake and catkin keep their cache information and other intermediate files here. Build Space is where built targets are placed prior to being installed Development (Devel) Space Once targets are built, they can be installed into the install space by invoking the install target. Install Space (C)2016 Roi Yehoshua

catkin Workspace Layout (C)2016 Roi Yehoshua

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 (C)2016 Roi Yehoshua

Creating a catkin Workspace Creating a Workspace Tutorial Initially, the workspace will contain only the top-level CMakeLists.txt Note that in the ready-made ROS Indigo VM you already have a catkin_ws workspace with the beginner_tutorials package $ mkdir -p ~/catkin_ws/src $ cd ~/catkin_ws/src $ catkin_init_workspace (C)2016 Roi Yehoshua

Building catkin Workspace catkin_make command builds the workspace and all the packages within it cd ~/catkin_ws catkin_make (C)2016 Roi Yehoshua

ROS Package ROS software is organized into packages, each of which contains some combination of code, data, and documentation A ROS package is simply a directory inside a catkin workspace that has a package.xml file in it Packages are the most atomic unit of build and the unit of release  A package contains the source files for one node or more and configuration files (C)2016 Roi Yehoshua

Common Files and Directories Explanation Directory C++ include headers include/ Source files src/ Folder containing Message (msg) types msg/ Folder containing Service (srv) types srv/ Folder containing launch files launch/ The package manifest package.xml CMake build file CMakeLists.txt (C)2016 Roi Yehoshua

The Package Manifest package.xml defines properties of the package: the package name version numbers authors dependencies on other catkin packages and more (C)2016 Roi Yehoshua

The Package Manifest Example for a package manifest: (C)2016 Roi Yehoshua

Creating a ROS Package Creating a ROS Package Tutorial Change to the source directory of the workspace   catkin_create_pkg creates a new package with the specified dependencies For example, create a first_pkg package: $ cd ~/catkin_ws/src $ catkin_create_pkg <package_name> [depend1] [depend2] [depend3] $ catkin_create_pkg first_pkg std_msgs rospy roscpp (C)2016 Roi Yehoshua

Integrate Eclipse with ROS Make an entry in the Unity Dash for easier access $sudo gedit /usr/share/applications/eclipse.desktop The bash –i - c command will cause your IDE's launcher icon to load your ROS-sourced shell environment before launching eclipse [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 (C)2016 Roi Yehoshua

Make Eclipse Project Files Go to workspace directory and run catkin_make with options to generate eclipse project files: The project files will be generated in ~/catkin_ws/build $ cd ~/catkin_ws $ catkin_make --force-cmake -G"Eclipse CDT4 - Unix Makefiles" (C)2016 Roi Yehoshua

Import the Project into Eclipse Now start Eclipse Choose catkin_ws folder as the workspace folder (C)2016 Roi Yehoshua

Import the Project into Eclipse Choose File --> Import --> General --> Existing Projects into Workspace (C)2016 Roi Yehoshua

Import the Project into Eclipse Now import the project from the ~/catkin_ws/build folder (C)2016 Roi Yehoshua

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 Built-in Compiler Settings [Shared] (C)2016 Roi Yehoshua

Fix Preprocessor Include Paths After that rebuild the C/C++ index by Right click on project -> Index -> Rebuild (C)2016 Roi Yehoshua

Project Structure Eclipse provides a link "Source directory" within the project so that you can edit the source code (C)2016 Roi Yehoshua

Add New Source File Right click on src and select New –> Source File, and create a file named hello.cpp (C)2016 Roi Yehoshua

Code Completion Use Eclipse standard shortcuts to get code completion (i.e., Ctrl+Space) (C)2016 Roi Yehoshua

C++ First Node Example (C)2016 Roi Yehoshua /* * 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; (C)2016 Roi Yehoshua

ROS C++ Client Library roscpp is a ROS client implementation in C++ Library documentation can be found at: http://docs.ros.org/api/roscpp/html/ ROS main header file is “ros/ros.h” (C)2016 Roi Yehoshua

ROS Init A version of ros::init() must be called before using any of the rest of the ROS system Typical call in the main() function: Node names must be unique in a running system ros::init(argc, argv, "Node name"); (C)2016 Roi Yehoshua

ros::NodeHandle The main access point to communications with the ROS system. Provides public interface to topics, services, parameters, etc. Create a handle to this process’ node (after the call to ros::init()) by declaring: The first NodeHandle constructed will fully initialize the current node The last NodeHandle destructed will close down the node ros::NodeHandle node; (C)2016 Roi Yehoshua

ros::Rate A class to help run loops at a desired frequency. Specify in the c’tor the destired rate to run in Hz ros::Rate::sleep() method Sleeps for any leftover time in a cycle. Calculated from the last time sleep, reset, or the constructor was called ros::Rate loop_rate(10); (C)2016 Roi Yehoshua

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 (C)2016 Roi Yehoshua

ROS Logging 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 ); ROS comes with five classic logging levels: DEBUG, INFO, WARN, ERROR, and FATAL Also, C++ STL streams are supported, e.g.: ROS_INFO_STREAM("My message with argument: " << val); (C)2016 Roi Yehoshua

ROS Logging ROS also automatically logs all messages that use ROS_INFO to log files on the filesystem for you so that you can go back and analyze a test later Your node's log file will be in ~/.ros/log (defined by the ROS_LOG_DIR environment variable) (C)2016 Roi Yehoshua

Building Your Node Before building your node, you should modify the generated CMakeLists.txt in the package The following slide shows the changes that you need to make in order to create the executable for the node (C)2016 Roi Yehoshua

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}) (C)2016 Roi Yehoshua

Building Your Nodes To compile the project in Eclipse press Ctrl-B To build the package in the terminal call catkin_make (C)2016 Roi Yehoshua

Running the Node From Terminal Make sure you have sourced your workspace's setup.sh file after calling catkin_make: Can add this line to your .bashrc startup file Now you can use rosrun to run your node: $ cd ~/catkin_ws $ source ./devel/setup.bash $ rosrun first_pkg hello (C)2016 Roi Yehoshua

Running the Node From Terminal (C)2016 Roi Yehoshua

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 (C)2016 Roi Yehoshua

Running the Node Inside Eclipse (C)2016 Roi Yehoshua

Running the Node Inside Eclipse (C)2016 Roi Yehoshua

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

Debugging (C)2016 Roi Yehoshua

Ex. 2 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 0.5 second (C)2016 Roi Yehoshua