element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Robotics
  • Technologies
  • More
Robotics
Blog ROS2 Learning Series - Blog 2 - Basic Concepts
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Robotics to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: crisdeodates
  • Date Created: 9 Apr 2024 10:23 AM Date Created
  • Views 1221 views
  • Likes 5 likes
  • Comments 2 comments
  • Robot operating System
  • robotics
  • ROS2
  • ROS
Related
Recommended

ROS2 Learning Series - Blog 2 - Basic Concepts

crisdeodates
crisdeodates
9 Apr 2024
ROS2 Learning Series - Blog 2 - Basic Concepts

ROS2 - Basic concepts 

Let's dig into the ROS2 concepts, starting with the basic ones. Wherever used, ROS means in the general context of both ROS1 & ROS2, unless specified. 

Client library 

The base library of ROS2 is written in C, called ROS client library or rcl, which sits between these other client libraries and the DDS communication interface. Other libraries are built on top of rcl and act as wrappers for other programming languages to implement ROS code. Code written using these different client libraries can share messages with each other because all the client libraries implement the necessary code generators that provide the users with a capability to interact with ROS2 interface files in their respective language. E.g. rclcpp, rclpy. The advantage of this approach is that If any changes are made to the logic/behavior of the functionality in the core rcl library, all client libraries that use the rcl will have these changes reflected in them. 

Nodes 

image

Picture courtesy: https://docs.ros.org/en/foxy/_images/Nodes-TopicandService.gif 

 

Normally a ROS2 system revolves around a ROS graph which visualizes the interconnected network of nodes within the system. These nodes can be seen as processes or participants or simply executables that use topics as data channels to communicate messages between them. Nodes can subscribe to a topic or publish to it. All nodes subscribed to the same topic will receive the published data or message on that topic. Nodes can provide configurable parameters to change their behavior during run-time. 

 

Topics & Messages 

In the ROS publish - subscribe model, publisher nodes produce the data and subscriber nodes consume the data. The data communication between the nodes happens via topics or topic name which are essentially data channels that allow passage of message information between various nodes. These messages can be discrete data like interrupt information or continuous data stream like robot state, sensor readings etc. All publishers and subscribers that are on the same topic name can directly communicate with each other. Also, when data is published to the topic by any of the publishers, all subscribers in the system will receive the data. Messages contain specific information and may contain one or more datatypes in it. 

 

Services 

Apart from just publishing and subscribing to information, nodes can often act as a service client to have another node in the system perform a computation on their behalf. The node that performs this computation for another node is a service server. This is like remote procedure calls where the client (requester) waits for the server (responder) to make a short computation and return a result. To maintain a distributed architecture, each node periodically advertise their presence so that connections can be made with new-found entities, allowing discovery. Hoever, Nodes will only establish connections with other nodes if they have compatible Quality of Service settings. 

 

Actions

image

Picture courtesy: https://docs.ros.org/en/foxy/_images/Action-SingleActionClient.gif  

 

ROS2 services are expected to compute and return quickly, since the client is generally waiting for the result. If the computation is long-running, actions should be used instead of services. For such long-running computations, a node can act as an action client to have another node perform the computation on their behalf, or as an action server to provide functionality to other nodes. Actions can be considered as long-running remote procedure call with feedback and the ability to cancel or preempt the goal. In ROS2, actions enable one node (the client) to send a request to another node (the action server) to perform a specific action. While the action is being performed, the server will constantly send feedback to the client with details about the progress of the action being performed. Once the action is completed, the server will send a result to the client with the final action outcome. ROS actions are like ROS services, except that the action server sends feedback, while the ROS service would not. 

 

Namespaces 

Namespaces provide a method to divide a ROS network into different isolated groups. This is very useful in multi-robot systems and when managing large projects. It creates a unique context for ROS nodes, topics, and services. In other words, namespaces allow the ROS nodes to have the same name but operate in different contexts. For example, when two robots in the same network have nodes and topics with the same name, giving unique namespaces allow them to operate independently. 

 

Parameters 

In ROS2, parameters are linked to nodes and are used to configure the nodes at startup or during runtime, without any changes to the code. Parameters can be created and used to control the behavior of the nodes, even during runtime. They act like settings for a node and each node maintains its own parameters. A node can register a callback to be informed when a parameter is changed by user, allowing to tune the node behavior on the fly. 

 

Launch files 

For a complex ROS system, there will be multiple nodes and running each of their nodes will present a huge task. Hence ROS allows automation in this scenario using launch systems. The launch system in ROS automates the running of multiple nodes with a single command. It also contains the configuration of the system, nodes to execute, arguments to pass to nodes, etc. Launch files can be written in Python, XML, or YAML. 

 

Command line tools 

ROS2 has a plethora of commands that can be used for a variety of tasks. The main command is ros2 followed by a subcommand and arguments. As ROS2 uses this distributed discovery process for nodes to connect to each other, it can take time for ROS nodes to discover all other participants in the ROS graph. Because of this, a long-running daemon is automatically started in the background when the relevant command-line tools are used for the first time. This daemon stores information about the ROS graph to provide faster responses to queries. 

Reference

  • Sign in to reply
  • crisdeodates
    crisdeodates over 1 year ago in reply to DAB

    Thanks a lot for the feedback DAB  Slight smile

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 1 year ago

    I like it, nice simple and easy to use.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube