Teaching Assistant: 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++.
Teaching Assistant: Roi Yehoshua
Teaching Assistant: Roi Yehoshua
Android: Hello World Frank Xu Gannon University. Steps Configuration ▫Android SDK ▫Android Development Tools (ADT)  Eclipse plug-in ▫Android SDK and.
20-Jun-15 Eclipse. Most slides from: 2 About IDEs An IDE is an Integrated Development Environment.
Wireless Ad Hoc and Sensor Networks Lab1. 2 Objective Comprehend how to setup and use the wireless communication devices, Jennic Evaluation System. You.
Teaching Assistant: Roi Yehoshua
Teaching Assistant: Roi Yehoshua
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
How to install the Zelle graphics package
Teaching Assistant: Roi Yehoshua
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
LAMAD Symbian Qt install and deploy Installing Qt SDK and deploying Qt applications.
Eclipse IDE. 2 IDE Overview An IDE is an Interactive Development Environment Different IDEs meet different needs BlueJ and DrJava are designed as teaching.
Julie McEnery1 Installing the ScienceTools The release manager automatically compiles each release of the Science Tools, it creates a set of wrapper scripts.
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
Multi-Robot Systems with ROS Lesson 1
What is ROS? Robot Operating System
Teaching Assistant: Roi Yehoshua
Microsoft Excel 2007 © Wiley Publishing All Rights Reserved. The L Line The Express Line to Learning L Line.
Teaching Assistant: Roi Yehoshua
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
IT 211 Project Integration and Deployment Lab #11.
chap13 Chapter 13 Programming in the Large.
Teaching Assistant: Roi Yehoshua
© 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.
® 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.
Teaching Assistant: Roi Yehoshua
Project Deployment IT [211 CAP] How to convert your project to a full application.
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.
Tool Install How to download & install Java 6 & Eclipse updated version based on Dr. G. L. Ray’s slides.
Teaching Assistant: Roi Yehoshua
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
New Project Model UI Primary Author: Mikhail Sennikovsky Major contributors: Mikhail Voronin, Oleg Krasilnikov, Leo Treggiari Intel Corporation September,
Creating New Forms Projects can appear more professional when using different windows for different types of information. Select Add Windows Form from.
Active-HDL Server Farm Course 11. All materials updated on: September 30, 2004 Outline 1.Introduction 2.Advantages 3.Requirements 4.Installation 5.Architecture.
 CSC 215 : Procedural Programming with C C Compilers.
Java IDE Dwight Deugo Nesa Matic
Workshop Setup The software/hardware used in this workshop are:
Eclipse.
Lecturer: Roi Yehoshua
Getting started with the Arxterra software and 3DoT Firmware
Lecturer: Roi Yehoshua
CDT Build/Run/Debug in Container
- The Robot Operating System
Software Setup & Validation
Robotic Perception and Action
Robotic Perception and Action
Carthage ios 8 onwards Dependency manager that streamlines the process of integrating the libraries into the project.
Robot Operating System (ROS): An Introduction
SPL – PS1 Introduction to C++.
Presentation transcript:

Teaching Assistant: Roi Yehoshua

ROS development environment setup ROS packages structure ROS Integration with Eclipse Writing your first Node Running and debugging your nodes 2(C)2013 Roi Yehoshua

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

4 A workspace in which one or more catkin packages can be built A basic workspace looks like this: (C)2013 Roi Yehoshua

rkspace rkspace Initially, the workspace will contain only the top- level CMakeLists.txt catkin_make command builds the workspace and all the packages within it 5(C)2013 Roi Yehoshua $ mkdir -p ~/catkin_ws/src $ cd ~/catkin_ws/src $ catkin_init_workspace $ mkdir -p ~/catkin_ws/src $ cd ~/catkin_ws/src $ catkin_init_workspace cd ~/catkin_ws catkin_make cd ~/catkin_ws catkin_make

6 The resulting build artifacts and executables are placed into the devel space (C)2013 Roi Yehoshua

7 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)2013 Roi Yehoshua

8 ExplanationDirectory C++ include headersinclude/ Source filessrc/ Folder containing Message (msg) typesmsg/ Folder containing Service (srv) typessrv/ Folder containing launch fileslaunch/ The package manifestpackage.xml CMake build fileCMakeLists.txt (C)2013 Roi Yehoshua

9 XML file that defines properties about the package such as: – the package name – version numbers – authors – dependencies on other catkin packages (C)2013 Roi Yehoshua

10 Example for a package manifest: (C)2013 Roi Yehoshua

age age Change to the source directory of the workspace catkin_create_pkg creates a new package Example: 11(C)2013 Roi Yehoshua $ catkin_create_pkg [depend1] [depend2] [depend3] $ catkin_create_pkg test_package std_msgs rospy roscpp $cd ~/catkin_ws/src

For building and running ROS programs from IDEs, the ROS environment has to be set up. – Running your IDE from your ROS-sourced shell should be the easiest way – Likewise, you can enhance your IDE's launcher icon to load your shells environment. 12(C)2013 Roi Yehoshua

Make sure JVM is installed $sudo apt-get install default-jre Download eclipse IDE for C/C++ developers from – Latest version of the file is: eclipse-cpp-kepler-SR1-linux- gtk.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 13(C)2013 Roi Yehoshua

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 14(C)2013 Roi Yehoshua [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 [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

Go to workspace directory and run catkin_make with options to generate eclipse project files: The project files will be generated in the build/ folder (~/catkin_ws/build/.project and ~/catkin_ws/build/.cproject) 15(C)2013 Roi Yehoshua $cd ~/catkin_ws $catkin_make --force-cmake -G"Eclipse CDT4 - Unix Makefiles“ $cd ~/catkin_ws $catkin_make --force-cmake -G"Eclipse CDT4 - Unix Makefiles“

Now start Eclipse Choose catkin_ws folder as the workspace folder 16(C)2013 Roi Yehoshua

Choose File --> Import --> General --> Existing Projects into Workspace 17(C)2013 Roi Yehoshua

Now import the project from the ~/catkin_ws/build folder 18(C)2013 Roi Yehoshua

19 By default, the intellisense in Eclipse won’t recognize the system header files (like ). To fix that: – Go to Project Properties --> C/C++ General --> Preprocessor Include Paths, Macros, etc. --> Providers tab – Check CDT GCC Built-in Compiler Settings (C)2013 Roi Yehoshua

20 After that rebuild the C/C++ index by Right click on project -> Index -> Rebuild (C)2013 Roi Yehoshua

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

22 Right click on src and select New –> Source File, and create a file named talker.cpp (C)2013 Roi Yehoshua

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

roscpp is a ROS client implementation in C++ Library documentation can be found at: – ROS header files can be found at: /opt/ros/hydro/include – For example, /opt/ros/hydro/include/ros/ros.h ROS core binaries are located at: /opt/ros/hydro/bin – For example, /opt/ros/hydro/bin/rosrun 24(C)2013 Roi Yehoshua

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 25(C)2013 Roi Yehoshua ros::init(argc, argv, “Node name”);

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 26(C)2013 Roi Yehoshua ros::NodeHandle n;

Manages an advertisement on a specific topic. A Publisher is created by calling NodeHandle::advertise() – Registers this topic in the master node Example for creating a publisher: – First parameter is the topic name – Second parameter is the queue size Once all Publishers for a given topic go out of scope the topic will be unadvertised 27(C)2013 Roi Yehoshua ros::Publisher chatter_pub = n.advertise ("chatter", 1000);

Messages are published on a topic through a call to publish() Example: The type of the message object must agree with the type given as a template parameter to the advertise<>() call 28(C)2013 Roi Yehoshua std_msgs::String msg; chatter_pub.publish(msg); std_msgs::String msg; chatter_pub.publish(msg);

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 29(C)2013 Roi Yehoshua ros::Rate loop_rate(10);

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

31 #include "ros/ros.h" #include "std_msgs/String.h" #include int main(int argc, char **argv) { ros::init(argc, argv, "talker"); // Initiate new ROS node named "talker" ros::NodeHandle n; ros::Publisher chatter_pub = n.advertise ("chatter", 1000); ros::Rate loop_rate(10); int count = 0; while (ros::ok()) // Keep spinning loop until user presses Ctrl+C { std_msgs::String msg; std::stringstream ss; ss << "hello world " << count; msg.data = ss.str(); ROS_INFO("%s", msg.data.c_str()); chatter_pub.publish(msg); ros::spinOnce(); // Need to call this function often to allow ROS to process incoming messages loop_rate.sleep(); // Sleep for the rest of the cycle, to enforce the loop rate count++; } return 0; } #include "ros/ros.h" #include "std_msgs/String.h" #include int main(int argc, char **argv) { ros::init(argc, argv, "talker"); // Initiate new ROS node named "talker" ros::NodeHandle n; ros::Publisher chatter_pub = n.advertise ("chatter", 1000); ros::Rate loop_rate(10); int count = 0; while (ros::ok()) // Keep spinning loop until user presses Ctrl+C { std_msgs::String msg; std::stringstream ss; ss << "hello world " << count; msg.data = ss.str(); ROS_INFO("%s", msg.data.c_str()); chatter_pub.publish(msg); ros::spinOnce(); // Need to call this function often to allow ROS to process incoming messages loop_rate.sleep(); // Sleep for the rest of the cycle, to enforce the loop rate count++; } return 0; } (C)2013 Roi Yehoshua

32 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)2013 Roi Yehoshua

33(C)2013 Roi Yehoshua cmake_minimum_required(VERSION 2.8.3) project(beginner_tutorials) ## Find catkin macros and libraries find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg) ## 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(talker src/talker.cpp) ## Specify libraries to link a library or executable target against target_link_libraries(talker ${catkin_LIBRARIES}) cmake_minimum_required(VERSION 2.8.3) project(beginner_tutorials) ## Find catkin macros and libraries find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg) ## 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(talker src/talker.cpp) ## Specify libraries to link a library or executable target against target_link_libraries(talker ${catkin_LIBRARIES})

34 If your node generation depends on other executable targets, you need to specify them in the CMakeLists file: – This makes sure message headers are generated before being used After changing the CMakeLists file call catkin_make (C)2013 Roi Yehoshua add_dependencies(talker beginner_tutorials_generate_message_cpp)

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/beginner_tutorials/talker Make sure roscore is running in a terminal Click Run 35(C)2013 Roi Yehoshua

36(C)2013 Roi Yehoshua

37(C)2013 Roi Yehoshua

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: 38(C)2013 Roi Yehoshua $ cd ~/catkin_ws $ source./devel/setup.bash $ cd ~/catkin_ws $ source./devel/setup.bash $ rosrun beginner_tutorials talker

39(C)2013 Roi Yehoshua

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

41(C)2013 Roi Yehoshua

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 will publish to a topic called “timer_topic” the message “current time is: ” with the current time every 1 second 42(C)2013 Roi Yehoshua