{"id":12,"date":"2017-01-23T12:50:29","date_gmt":"2017-01-23T17:50:29","guid":{"rendered":"http:\/\/commons.trincoll.edu\/trinityrobotics\/?p=12"},"modified":"2017-01-23T12:55:27","modified_gmt":"2017-01-23T17:55:27","slug":"introduction-to-ros-week-1","status":"publish","type":"post","link":"https:\/\/commons.trincoll.edu\/trinityrobotics\/introduction-to-ros-week-1\/","title":{"rendered":"Introduction to ROS &#8211; Week 1"},"content":{"rendered":"<p><em>By: Jin Pyo Jeon<\/em><\/p>\n<p><em>Recommended Reading: A Gentle Introduction to ROS (Chapter 1), ROS Wiki on Publisher and Subscriber.<\/em><strong><br \/>\n<\/strong><\/p>\n<p>Robot Operating System, commonly abbreviated as ROS, is a misnomer &#8211; after all, it is not an operating system like Windows and Linux, nor does it perform various tasks that &#8216;proper&#8217; OS do, like file management.<\/p>\n<p>However, it is an operating system in a sense that it helps manage the difficulties of running multiple programs in a collaborative fashion.<\/p>\n<p>What do I mean?\u00a0Since there are many technical descriptions of ROS online, let me instead tell you of the problems that ROS solves.<\/p>\n<p><strong>ROS solves problems like:<\/strong><\/p>\n<ul>\n<li>the need to develop a communication scheme between programs, either within one computer or across multiple computers<\/li>\n<li>the need to develop and implement tools, algorithms, and hardware drivers that are commonly used in Robotics<\/li>\n<li>the problem of programs of different sources having a different interface &#8211; and thus being difficult to &#8216;stitch&#8217; together<\/li>\n<li>the difficulty of building, developing and launching several programs (or, more accurately, processes)<\/li>\n<\/ul>\n<p>There are, of course, other frameworks and libraries that solve some, maybe even most, of these problems, but you should use ROS because it is<\/p>\n<ul>\n<li>rapidly becoming industry standard due to its open-source nature<\/li>\n<li>and its emphasis on distributed computing (that is, ROS is focused on being able to run on multiple computers and devices, ranging from laptops to microcontrollers like Arduino).<\/li>\n<\/ul>\n<p>Of course, these introductions do not mean anything if we can&#8217;t do anything practical, so let&#8217;s dive in immediately.<\/p>\n<p>ROS supports both C++ and Python (and for some, Lisp), but I recommend that you use Python for all but really computationally intensive tasks (like image processing or rapid calculations), as programs in Python do not need to involve a relatively complicated build system called Catkin in order to run. Nor is it fun to resolve pointer issues when you just want the robot to run.<\/p>\n<p>However, you can indeed use both languages in the same robot by using the communication interface provided in ROS. ROS programs primarily communicate using two interfaces: <strong>topic<\/strong> and <strong>service<\/strong>.<\/p>\n<p>Communicating through a topic is a many-to-many communication, that is, multiple programs can read and write to the same topic, done by programs called subscribers and publishers respectively. The communications through topics are managed by a node (term for programs in ROS) called master node.<\/p>\n<p>Service is one-to-one communication in that one node sends a request for a service and another responds\u00a0(using a function specified called callback); however, many nodes (called client) can call a service.<\/p>\n<p>As an example, topics are commonly used for the streaming of the sensor data, and services are used to occasionally request for a specific state or data.<\/p>\n<p>For more info on the applications, refer to:<\/p>\n<p>http:\/\/answers.ros.org\/question\/11834\/when-should-i-use-topics-vs-services-vs-actionlib-actions-vs-dynamic_reconfigure\/<\/p>\n<p>http:\/\/wiki.ros.org\/ROS\/Patterns\/Communication#Communication_via_Topics_vs_Services_vs_X<\/p>\n<p>Now, given that most functions could be done with a publisher &amp; subscriber (but not so with service &amp; request), refer to the ROS wiki on writing publisher and subscriber (preferrably in Python).<\/p>\n<p>http:\/\/wiki.ros.org\/ROS\/Tutorials\/WritingPublisherSubscriber(python)<\/p>\n<p>Challenge: Write a publisher that publishes random odometry data (message name is nav_msgs\/Odometry) and a subscriber that echoes the message.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By: Jin Pyo Jeon Recommended Reading: A Gentle Introduction to ROS (Chapter 1), ROS Wiki on Publisher and Subscriber. Robot Operating System, commonly abbreviated as ROS, is a misnomer &#8211; after all, it is not an operating system like Windows and Linux, nor does it perform various tasks that &#8216;proper&#8217; OS do, like file management. &hellip; <a href=\"https:\/\/commons.trincoll.edu\/trinityrobotics\/introduction-to-ros-week-1\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Introduction to ROS &#8211; Week 1&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1933,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/commons.trincoll.edu\/trinityrobotics\/wp-json\/wp\/v2\/posts\/12"}],"collection":[{"href":"https:\/\/commons.trincoll.edu\/trinityrobotics\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/commons.trincoll.edu\/trinityrobotics\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/commons.trincoll.edu\/trinityrobotics\/wp-json\/wp\/v2\/users\/1933"}],"replies":[{"embeddable":true,"href":"https:\/\/commons.trincoll.edu\/trinityrobotics\/wp-json\/wp\/v2\/comments?post=12"}],"version-history":[{"count":2,"href":"https:\/\/commons.trincoll.edu\/trinityrobotics\/wp-json\/wp\/v2\/posts\/12\/revisions"}],"predecessor-version":[{"id":14,"href":"https:\/\/commons.trincoll.edu\/trinityrobotics\/wp-json\/wp\/v2\/posts\/12\/revisions\/14"}],"wp:attachment":[{"href":"https:\/\/commons.trincoll.edu\/trinityrobotics\/wp-json\/wp\/v2\/media?parent=12"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/commons.trincoll.edu\/trinityrobotics\/wp-json\/wp\/v2\/categories?post=12"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/commons.trincoll.edu\/trinityrobotics\/wp-json\/wp\/v2\/tags?post=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}