All you need to know about ROS Messages | Tutorial

Поділитися
Вставка
  • Опубліковано 11 лип 2024
  • Soft_illusion is here with a new tutorial series on "'All you need to know about". (A channel that aims to help the robotics community). This series will focus on several important ROS topics and will aim at providing ROS users with a good foundational understanding of various concepts. This series has been started to enlighten new ROS enthusiasts with understanding the basics and applications of different projects before diving deep into complex projects.
    Video link for custom messages video: (@ROBOMECHTRIX )
    • How to Create and Publ...
    #ROBOMECHTRIX #ROS #ROS101 #ROSMESSAGES
    In this second tutorial of the series we introduce the viewers to ROS Messages.
    0:20 Introductions to ROS Messages
    01:00 What is ROS messages?
    01:56 Types of ROS Messages
    02:43 rosmsg
    06:56 Catagories of ROS Messages
    07:17 ROS Messages for Topics
    09:57 ROS Messages for Services
    12:13 ROS Messages for Actionlib
    We start with the basic definition of what are ROS messages:
    1. A simple data structure, comprising typed fields.
    2. It can include arbitrarily nested structures and arrays (much like C structs).
    3. Messages can be used by services, topics and actionlibs.
    4. Custom Message descriptions are stored in .msg/.srv files in the msg/ or srv/ subdirectory of a ROS package. Eg. xyz.msg
    5. Inbuilt ROS messages can directly be used just by including in header file.
    Next we move on to the different types of ROS messages i.e the inbuilt and custom messages. Some examples of inbuilt msgs are given such as std_msgs, geometry_msgs, actionlib_msgs, gazebo_msgs etc. On the other hand, custom msgs are created as a mix and match of several inbuilt msgs.
    Some real time examples of the messages are shown on the terminal to further the understanding of the viewers. This examples shows the usage of the rosmsg tool.
    Next different categories of msgs are explained i.e
    1. Topic
    2. Service
    3. Actionlib
    Before proceeding, the basics of ROS Topics is explained, i.e.
    1. Topics are intended for unidirectional, streaming communication.
    2. Named buses over which nodes exchange messages.
    3. In general,
    1. Nodes are not aware of who they are communicating with.
    2. Instead, nodes that are interested in data subscribe to the relevant topic;
    3. Nodes that generate data publish to the relevant topic.
    4. There can be multiple publishers and subscribers to a topic.
    An example of a custom msg is shown as follows:
    Header header
    string child_frame_id
    geometry_msgs/PoseWithCovariance pose
    Next we show how to define a message type for a publisher and a subscriber:
    For publisher :
    ros::Publisher pub = nh.advertise(msg_type)("topic_name", 1000);
    For subscriber :
    ros::Subscriber sub = nh.subscribe("topic_name", 1000, sub_Callback);
    void sub_Callback(const (msg_type) msg){}
    Moving on to ROS Services, we first briefly describe why it's necessary.
    1. The publish / subscribe model is a very flexible communication paradigm, but its many-to-many one-way transport is not appropriate for RPC request / reply interactions, which are often required in a distributed system.
    2. Request / reply is done via a Service, which is defined by a pair of messages: one for the request and one for the reply.
    3. A providing ROS node offers a service under a string name, and a client calls the service by sending the request message and awaiting the reply.
    4. Client libraries usually present this interaction to the programmer as if it were a remote procedure call.
    5. A client can make a persistent connection to a service, which enables higher performance at the cost of less robustness to service provider changes.
    An example of a custom service msg type is shown: (XYZ.srv)
    int64 A
    int64 B
    ---
    int64 Sum
    The definition of a msg type for a sever and client is as follows:
    For Server :
    ros::ServiceServer service = n.advertiseService("srv_name", function);
    bool function(srv_msg::Request &req, srv_msg::Response &res){}
    For Client :
    ros::ServiceClient client = n.serviceClient(srv_msg)("srv_name");
    Finally we proceed to actionlibs:
    1. The actionlib stack provides a standardized interface for interfacing with preemptable tasks.
    2. Examples of this include moving the base to a target location, performing a laser scan and returning the resulting point cloud, detecting the handle of a door, etc.
    Example of actionlib msgs:
    Define the goal
    uint32 dishwasher_id # Specify which dishwasher we want to use
    ---
    Define the result
    uint32 total_dishes_cleaned
    ---
    Define a feedback message
    float32 percent_complete
    Definition of msg type for actionlib client and server:
    For ActionServer :
    actionlib::SimpleActionServer(actionlib_msg) action_s_;
    For ActionClient :
    actionlib::SimpleActionClient(actionlib_msg)ac(action_server, true); // individual thread.
    Hope you enjoyed the video. Do comment if you have any doubts or concerns.

КОМЕНТАРІ • 5

  • @motionsmoments6254
    @motionsmoments6254 3 роки тому +2

    this is a good explanation.

  • @Think____different
    @Think____different Рік тому +1

    Watching the video one year after it was posted....but to be honest I can say thanks to u because I pissed off in searching for right lecture on basics since morning ..finally got it .. don't stop this ..pls continue

    • @coolrobotics
      @coolrobotics  Рік тому

      Thank you very much.
      Do share the channel to increase the visibility

  • @vienyish
    @vienyish 2 роки тому +2

    I'd appreciate it more if you were not only showing a powerpoint presentation but if you showed actual code that does what you say in the presentation.
    I would love to see you create a custom message type, use it to publish on a topic and see a subscriber to that topic do a simple task with the content of the message.

    • @coolrobotics
      @coolrobotics  2 роки тому

      That is a great thought but there are great resources for the same
      ua-cam.com/video/baAE0i8Rzvg/v-deo.html
      Or
      wiki.ros.org/ROS/Tutorials/CreatingMsgAndSrv