当前位置:网站首页>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
边栏推荐
- OpenFeign
- 轮子1:QCustomPlot初始化模板
- 【NOI模拟赛】汁树(树形DP)
- Several problems to be considered and solved in the design of multi tenant architecture
- Halcon color recognition_ fuses. hdev:classify fuses by color
- Count of C # LINQ source code analysis
- [牛客网刷题 Day4] JZ35 复杂链表的复制
- Old Wang's esp8266 and old Wu's ws2818 light strip
- Halcon shape_ trans
- U8g2 drawing
猜你喜欢
随机推荐
猜谜语啦(10)
Digital analog 1: linear programming
Apaas platform of TOP10 abroad
【日常训练--腾讯精选50】557. 反转字符串中的单词 III
Warning: retrying occurs during PIP installation
golang 基础 —— golang 向 mysql 插入的时间数据和本地时间不一致
Meta标签详解
多元线性回归(sklearn法)
L298N module use
Guess riddles (3)
Numpy pit: after the addition of dimension (n, 1) and dimension (n,) array, the dimension becomes (n, n)
深度学习模型与湿实验的结合,有望用于代谢通量分析
皮尔森相关系数
Infix expression evaluation
MPSoC QSPI Flash 升级办法
Dynamic dimensions required for input: input, but no shapes were provided. Automatically overriding
The first week of summer vacation
C# LINQ源码分析之Count
leetcode - 445. Add two numbers II
猜谜语啦(6)