Information

Instructor: Dominic Jud, Martin Wermelinger, Marco Hutter Title: Programming for Robotics - Introduction to ROS Refererences

I'm going to study and summarize this course. Every picture and content belong to lectures.

Date: May 17, 2020 Updated: May 18, 2020

Overview

ROS Packages

catkin_create_pkg package_name

### package.xml

- Defines the properties of the package
- Package name
- Version number
- Authors
- **Dependencies on other packages**

### CMakeLists.xml

- [CMakeLists.txt](<http://wiki.ros.org/catkin/CMakeLists.txt>) is the input to the CMakebuild system
- Requirement
- CMake version
- Pcakage Name
- Find other CMake/Catkin packages needed for build

Setup a Project in Eclipse

ROS C++ Client Library (roscpp)

// hello_world.cpp

#include <ros/ros.h>

int main(int argc, char** argv) {
    ros::init(argc, argv, "hello_world");
    ros::NodeHandle nodeHandle;
    ros::Rate loopRate(10);

    unsigned int count = 0; 
    while (ros::ok()) {
        ROS_INFO_STREAM("Hello World " << count); 
        ros::spinOnce();
        loopRate.sleep();
        count++;
    }
    return 0;
}

/*
Explanation of each functions
ros:init
- have to be called before calling other ROS functions

ros:NodeHandle
- access point for communications with the ROS system

ros::Rate
- run loop at a desired frequency (hz)

ros::ok()
- Check whether the node is running or not

ROS_INFO()
- print the log message
*/