ros

Getting started with ros

Remarks#

Robotic Operating System (ROS) is a Robotics Middleware for robots software development providing operating-system like functionalities on heterogeneous computer clusters and platforms.

Originally started in 2007 by the Stanford Artificial Intelligence Laboratory in the support of the Stanford AI Robot STAIR, development, from 2008 to 2013, migrated to be performed at Willow Garage, a robotics research institute. In 2013, ROS stewardship transitioned to the Open Source Robotics Foundation.

ROS provides libraries and tools to help software developers create robot applications. It provides hardware abstraction, device drivers, libraries, visualizers, message-passing, package management, and more. ROS is licensed under an open source, BSD license.

Today, ROS integrates more than a hundred of robots (see full robots list), ranging from autonomous cars, to UAVs to humanoid robots and using a multitude of ROS supported sensors (see complete sensors list)… ROS is heavily utilised by the research community for service robotics applications, but its technology can be applied to other application areas, including industrial robotics. Its applications such as advanced perception, path/grasp planning, motion tracking can enable manufacturing robotic applications that were previously technically infeasible or cost prohibitive.

ROS currently only runs on Unix-based platforms. Software for ROS is primarily tested on Ubuntu and Mac OS X systems, though the ROS community has been contributing support for Fedora, Gentoo, Arch Linux and other Linux platforms. Eventually, ROS coding can be written in any programming language provided it has it’s client library, though, the current focus is on providing strong C++ and Python Support.

ROS today presents it’s 10th release ROS Kinetic.

To find more about ROS and ROS Community efforts, visit https://www.ros.org/

Versions#

Ros DistroSupported Ubuntu VersionsRelease Date
Kinetic Kame15.10, 16.042016-05-23
Jade Turtle14.04, 14.10, 15.042015-05-23
Indigo Igloo13.10, 14.042014-07-22
Hydro Medusa12.04, 12.10, 13.042013-09-04
Groovy Galapagos11.10, 12.04, 12.102012-12-31
Fuerte Turtle10.04, 11.10, 12.042012-04-23
Electric Emys10.04, 10.10, 11.04, 11.102011-08-30
Diamondback10.04, 10.10, 11.042011-03-02
C Turtle9.04, 9.10, 10.04, 10.102010-08-02
Box Turtle8.042010-03-02

Installation

Depending on your target machine, you need to choose a supported ROS Version (or vice-versa). Although ROS installation is well documented in the ROS wiki, It might be confusing to find them. So, here’s a table of the ROS Version, target platforms & architecture and the links for the appropriate install guides :

ROS Version Platform Arch Status Install Guide Link
Kinetic Ubuntu 16.04 (Xenial) amd64 / i386 / armhf Supported Kinetic-Xenial-guide
Ubuntu 15.10 (Wily) amd64 / i386 Supported Kinetic-Wily-guide
Debian 8 (Jessie) amd64 / arm64 Supported Kinetic-Jessie-guide
OS X (Homebrew) Experimental Kinetic-Homebrew-guide
Gentoo Experimental Kinetic-Gentoo-guide
OpenEmbedded/Yocto Experimental Kinetic-Yocto-guide

Work in progress…!

Hello World Publisher

Create a workspace

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace

Build your workspace

cd ~/catkin_ws/
catkin_make

Source your setup file

source devel/setup.bash

Create a new package named hello_world with some basic dependencies

catkin_create_pkg hello_world std_msgs rospy roscpp

Navigate to your src directory and create a new file called talker.cpp

cd hello_world/src
touch talker.cpp

Edit your new file and paste this code in to publish a “hello world” message

#include "ros/ros.h"
#include "std_msgs/String.h"

#include <sstream>

int main(int argc, char **argv)
{
  ros::init(argc, argv, "talker");

  ros::NodeHandle n;

  ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter", 1000);

  ros::Rate loop_rate(10);

  int count = 0;
  while (ros::ok())
  {
    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();

    loop_rate.sleep();
    ++count;
  }

  return 0;
}

Return to the root of your package directory

cd ..

Add/uncomment these lines to your CMakeLists.txt

catkin_package(
 INCLUDE_DIRS include
 LIBRARIES hello_world
#  CATKIN_DEPENDS roscpp rospy std_msgs
#  DEPENDS system_lib
)

include_directories(include ${catkin_INCLUDE_DIRS})

add_executable(talker src/talker.cpp)
target_link_libraries(talker ${catkin_LIBRARIES})
add_dependencies(talker hello_world_generate_messages_cpp)

Return to the root of your workspace

cd ..

Build your new publisher

catkin_make  

Source your setup file again so that you have the new package and publisher

source devel/setup.bash

Start ROS

roscore

Leave roscore running and in a new terminal tab/window, start your publisher

rosrun hello_world talker

Leave the publisher running and in ANOTHER new terminal tab/window, echo the output

rostopic echo /chatter

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow