当前位置:网站首页>Get to know ROS for the first time

Get to know ROS for the first time

2022-07-05 00:09:00 DWQY

   Need to use ROS, Just learn ROS. As Xiaobai , It's hard to avoid mistakes , Please, Haihan . Help me point out more mistakes . The purpose of this article is to make novices understand ROS Have a simple understanding , Basically speaking, they are conceptual things . I hope this article can explain the following questions clearly :
  1.ROS What is it? /ROS Can do ?
  2.ROS What is your infrastructure ?
  3.ROS Explanation of some proper nouns :ROS node (node)、 Node manager (master)、 Parameter server (parameter server)、 news (message)、 topic of conversation (topic)、 service (service)、 Message logging package (bag)

1.ROS What is it? /ROS Can do ?

  ROS The full name is Robot Operating System, That is, the robot operating system . Literally, it helps us operate robots . But and Linux This kind of bottom os Different ,ROS It's based on the bottom layer os Of , That is to say Linux above , It can be understood as in Linux It is encapsulated so that you can directly call all kinds of packages used to operate robots .ROS There are several versions of , There are different corresponding Linux Environmental Science ( You can find it online , Is not the point , No more details here . But the author uses kinetic The corresponding is ubuntu16.04 La ~).
   that ROS What are the benefits ? Why use ROS Well ? This is from ROS The design goal of :ROS It is convenient for code reuse in robot research and development , Is a distributed process framework , The core lies in the middleware framework that can transfer message data synchronously or asynchronously . To put it simply ROS Its modularity and reusability are particularly good , In this way, developers can focus on the design of main logic . It's also a bit like building blocks ( The building blocks have been built ). I think another advantage is :ROS Description using simplified type description language ros Published data , Through this description language ,ros You can use multiple programming languages (C++ PYTHON java matlab) Write different nodes , Realize the communication between nodes ( Not limited to one , That's great !)

   about ROS Can do ? In fact, I think it is used to develop robots . Now all kinds of robots, no matter UAV、UGV It's all based on ROS On the development of drops . Want to let robot Do something personalized ,ROS It should be learned . and ROS Now it has been recognized as a standard ( The good news : Open source !).

2.ROS What is your infrastructure ?

   Leave it alone ROS What's the specific , First, give it a sample from the macro view .ROS The architecture of has three parts :ROS file system 、ROS Calculation chart 、ROS Community
  ROS file system : The file system is actually ROS The organizational structure of the document , Knowing the file system, you will know which file is called when the program executes to which step . File system has many basic concepts :package、manifest.
  ROS Calculation chart : The calculation diagram is equivalent to ROS The mechanism of operation , Including how nodes communicate . Some places are also called Computing Networks , All nodes can connect to this network for communication . I think this is ROS The core part of . The concept of design includes :node、master、message、topic、service
  ROS Community : It is rare to see communities in the framework , but ROS At present, it looks like a completely open source thing . Open source projects need to be maintained by the community , Maybe the keynote set by the initial design is like this .
( Many concepts have been mentioned above , I will explain one by one in the following )

3.ROS Conceptual explanation ( According to the structural division )

package( Function pack )

  package In fact, it can be regarded as an organization ROS A basic unit of code .ROS in package More refers to the code package . If we say the biggest one should be workspace( working space ), The workspace includes the code space (src, The main code to implement the application can be cpp/py), Compilation space (build, Mainly the compilation environment catkin_make After that, I don't care ), Development space (devel, Save the compiled package ), Installation space (install, After this command is generated, it is basically useless ).package That is, a basic unit in code space . An application corresponds to a package.ROS utilize package Realize modularity and reusability
  package The structure of is as follows ( Because it just introduces the basic concepts , So I won't talk about the role of each document in detail ~)
 Insert picture description here

   Picture source :ROS Learning notes ( One ) ROS file system _ My proud blog -CSDN Blog

manifest

   Full name package manifest, by package Provide dependencies between . What's preserved is package Some basic information of : edition 、 Maintainer 、 Dependent options 、 Compilation flags and so on . The implementation of specific documents is package The inside package.xml

metapackage( Meta function pack )

  metapackage It's better than package A higher level concept , yes package Set . It used to be called stack, Now and abandoned

metapackage manifest

   This ratio manifest A higher level , Function like manifest, It's just for metapackage

node( node )

  ROS On the whole, it is a distributed architecture , That is, there are many nodes . Maybe it can also be said ROS The basic action execution unit of , You can assign tasks to nodes . The same workspace There cannot be a node with the same name under ( This is not certain ), But there can be nodes with the same name in different workspaces
As a whole , There should also be mutual cooperation between nodes .ROS Have their own communication mechanism , So let's talk about that :
  ROS There are two means of communication : The messaging 、 The service call

message( news )/topic( The theme )

  message It corresponds to messaging , But the news can't be passed directly . With the help of carrier : That is to say topic( It can be understood as a pipe ). If a node wants to send a message , Just choose one topic( This topic It can be created by yourself or by others ), choose topic Hair message This action is pulish( Release ). If you want to accept the message , Also through topic. And this action is called subscribe( subscribe ). The two nodes are based on actions , Known as publisher and subscriber.

server( service )

  server Corresponding to service invocation , however server The audience is smaller . Between two nodes . The process of service invocation is :client The node sends request to server node ,server After the node performs processing , send out response to client node
   What's the difference between messaging and service invocation ?
    1) Service invocation implements one-to-one , Message passing implements many to many . Service invocation is just between two parties , The same in messaging topic There can be multiple publishers and subscribers ( There is also a limitation : A message with the same name published by two publishers , The type must be the same )
    2) The service call ( two-way ), The messaging ( A one-way ). In the service, the sender will wait for the receiver response, In message delivery, the publisher doesn't care about this message after sending it —— One way transmission system ( It's a bit like in Jiwang TCP and UDP, Actually in ROS It's called in Chinese rostcp/rosudp)
    3) Service invocation is synchronous , Messaging is asynchronous . Therefore, in the process of message delivery, the queue is often set as a buffer to adjust the sending rate .
    4)topic Commonly used for data transmission , and service Commonly used in logical processing .

master( Node manager )

   There must be a leader when there are many nodes ,master Is responsible for managing all nodes . It will take charge of the related between each node topic、service Information list . Although there are managers , But when communicating, the message goes directly from the publishing node to the subscribing node , The middle does not pass through the node manager .ROS The parameter server is part of the node manager , All nodes can access and modify data ( data / Configuration information ). In all examples, first roscore once , What starts is master. But if two nodes have passed master Established a connection , And began to communicate . Turn it off at this time master It will not affect the communication between the two nodes .master It only works when establishing a connection .

bag( Message logging package )

   A bag is ROS For storing ROS File format of message data . Save and playback ROS File format of message data . The extension of the package is .bag. When using complex robots , Collecting data is cumbersome . You can go through bag Save data once , The later simulation can be played back bag The data in achieves the same purpose .

   Here is an example : Judge ros Whether the installation is successful or not, we will use an example of little turtle mobile , Then why can the little turtle move ? This is the process :
/teleop_turtle The node will issue these motion control commands to topic of conversation /turtle1/cmd_vel; meanwhile , because turtlesim_node Subscribed to this topic , So it will receive these messages , Control the turtle to move at the predetermined speed

Reference material :

ROS Introduction learning - coding-for-self - Blog Garden (cnblogs.com)
ROS The core concept 、 working space and Function pack .ROS Learning resources _Bruce’s blog-CSDN Blog

Due to the limited level of the author , If something is wrong , Please indicate in the comments section below , thank you !

原网站

版权声明
本文为[DWQY]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050005276697.html