当前位置:网站首页>Ros- learn basic knowledge of 0 ROS - nodes, running ROS nodes, topics, services, etc
Ros- learn basic knowledge of 0 ROS - nodes, running ROS nodes, topics, services, etc
2022-07-05 08:45:00 【m0_ forty-six million ninety-three thousand eight hundred and t】
One 、 node
1.1 rosmaster
ros The system is composed of various nodes , Each node is equivalent to a subroutine , In addition to performing their respective duties, each node should also cooperate with each other , They communicate by delivering topic messages or providing services . Then each node is not human , They don't cook themselves , So we need an intermediary to help them contact . This intermediary is rosmaster. Every ros The system must have rosmaster, And there has to be only one rosmaster. Every ros The node needs to be started before it works rosmaster.
That's important rosmaster How does it work ? adopt roscore Instructions .
roscore
function roscore The following page is displayed after the command :
function roscore It will start automatically after the command :rosmaster,Parameter Server,rosout. See :
We can also pass rosnode list Command to see Currently active The node of
1.2 function ros node
Run one ros Nodes have 2 Ways of planting :
1. rosrun ~
2.roslaunch ~
Among them rosrun You need to run manually before the command roscore Command to start rosmaster, But run roslaunch Don't use before instructions , because roslaunch Instructions can be automatically detected when running rosmaster Is it activated , If not, it will run automatically roscore.
For example, I take starting the little turtle as an example
When I started the little turtle node, I was using rosnode list View the currently active nodes :
Two 、 package package
A package can contain multiple nodes ,ros When the application is published , Usually, the unit is package , In our little turtle example , Package is turtlesim, How many nodes are there in this package , You can check through the following instructions :
rosrun turtlesim, Then press... Twice Tab key , Pictured :
Each node may be a publisher node , Subscriber node , Client node 、 Server node . These nodes with names will be introduced one by one below .
3、 ... and 、 topic of conversation topic
The topic and node are ros There are two basic components in the system , Nodes are basic processing units , Topic is one of the basic communication units between nodes . Among them, the nodes about publishing topics have special names called publisher nodes and subscriber nodes , How to program and define a publisher node in your own function package 、 The subscriber node is detailed in the learning notes below . It should be noted that the topic is the pipeline of data transmitted by the publisher node and the subscriber node , The data that is actually transmitted is called a message , among ros The system provides us with some common messages , We can also customize messages . We can go through rosmsg To see what we can do about the message .
Then back to the topic :
There are many operations for topics in a function package , You can enter rostipic Then press enter to check the specific operations .
About how to create a publisher node 、 Subscriber nodes and customized messages are detailed in the following :
ROS Study 2- Programming implementation of publisher node _m0_46093829 The blog of -CSDN Blog
ROS Study 3 subscriber Subscriber Programming of nodes _m0_46093829 The blog of -CSDN Blog
ROS Study 3 Custom message _m0_46093829 The blog of -CSDN Blog
It can be done by rostopic list View the current ros Active topics in the system , When I launched the little turtle Feature Pack draw_square After node , The active topics in my current system are as follows :
Four 、 service
service Service It is a way of synchronous communication between nodes ; Among them, there are also special names for the server and the served node, which are called the server node and the client node , client Client Nodes can issue requests Request; By the server Server Feedback response after node processing Response.
Services provided by the server node to the client node , that ros The system also defines some common services for us , We can also define service types by ourselves . That's about the type of service , We can go through rossrv To view the functions of relevant instructions .
When I started turtlesim Function pack , And run draw_square After node , We can go through rosservice list Check it out. Active services in the current system .
The active services in my current system are as follows :
There are many operations for services in a function package , You can enter rosservice Then press enter to check the specific operations .
Be careful : Be careful to distinguish rosservice and rossrv. The former is used with Currently, services provided by some nodes interact . The latter name comes from the extension used to declare the service data type file .srv, It is used to view service data types , Whether or not there is such a type of service available .
No matter the topic or the service , You can call it alone
Then I don't know if there will be any friends who have questions and say yes rosservice list I can only know that there is this service , How can I know exactly how to use it ?
Can pass rosservice call Service name Then press 2 Time tab, The system will automatically show you what parameters this service needs , Just use it according to the situation , For example, I want to use /kill This service , But I don't know how to use it, so I just tab 了 2 Next . Then see the display name:' ', So I input my kill The name of the tortoise , And then OK 了 .
How to program and define a publisher node in your own function package 、 The subscriber node is detailed in the learning notes below .
ROS Study 4- Client Programming of nodes _m0_46093829 The blog of -CSDN Blog
ROS Study 5 -Service Programming of nodes _m0_46093829 The blog of -CSDN Blog
边栏推荐
- js异步错误处理
- Cmder of win artifact
- [daiy4] copy of JZ35 complex linked list
- Example 005: three numbers sorting input three integers x, y, Z, please output these three numbers from small to large.
- Guess riddles (4)
- Bluebridge cup internet of things competition basic graphic tutorial - clock selection
- [formation quotidienne - Tencent Selection 50] 557. Inverser le mot III dans la chaîne
- [牛客网刷题 Day4] JZ35 复杂链表的复制
- 我从技术到产品经理的几点体会
- Explore the authentication mechanism of StarUML
猜你喜欢
Pytorch entry record
319. 灯泡开关
猜谜语啦(3)
Halcon: check of blob analysis_ Blister capsule detection
Example 008: 99 multiplication table
Bluebridge cup internet of things competition basic graphic tutorial - clock selection
Halcon blob analysis (ball.hdev)
Yolov4 target detection backbone
Example 009: pause output for one second
Guess riddles (11)
随机推荐
猜谜语啦(7)
Guess riddles (2)
[matlab] matlab reads and writes Excel
An enterprise information integration system
【日常訓練--騰訊精選50】557. 反轉字符串中的單詞 III
golang 基础 ——map、数组、切片 存放不同类型的数据
Run菜单解析
[Niuke brush questions day4] jz55 depth of binary tree
[daily training] 1200 Minimum absolute difference
Infix expression evaluation
Esphone Feixun DC1 soft change access homeassstant
Go dependency injection -- Google open source library wire
整形的分类:short in long longlong
MATLAB skills (28) Fuzzy Comprehensive Evaluation
Task failed task_ 1641530057069_ 0002_ m_ 000000
Pytorch entry record
Numpy 小坑:维度 (n, 1) 和 维度 (n, ) 数组相加运算后维度变为 (n, n)
Mathematical modeling: factor analysis
RT-Thread内核快速入门,内核实现与应用开发学习随笔记
Basic number theory -- Euler function