(三)阅读教程Understanding ROS 2 nodes

ROS 中概念的参考链接

Linux里 Ctrl+shift+C/V

1、ROS2 graph

The ROS graph is a network of ROS 2 elements processing data together at one time. It encompasses all executables and the connections between them if you were to map them all out and visualize them.

ROS图是由ROS 2元素同时处理数据的网络。 如果要将它们全部映射并可视化,则它包含所有可执行文件及其之间的连接。

2、Nodes in ROS2

每个模块都有一个他负责干的专门的事情(a single, module purpose)

每个模块都可以通过 topics, services, actions, or parameters 来收发数据

一个机器人系统需要多个模块协同工作。(在ROS2 中,单个可执行程序可以包含一个或多个节点)

 

3、练习

命令:ros2 run

命令的参数含义:第一个为包名第二个为应用程序名
The command ros2 run launches an executable from a package.
ros2 run <package_name> <executable_name>

#To run turtlesim, open a new terminal, and enter the following command:

ros2 run turtlesim turtlesim_node

The turtlesim window will open, as you saw in the previous tutorial.
Here, the package name is turtlesim and the executable name is turtlesim_node.
We still don’t know the node name, however. You can find node names by using ros2 node list

 

命令: ros2 node list

用途:显示正在运行的节点的名字

(ros2 node list will show you the names of all running nodes.

   This is especially useful when you want to interact with a node, or when you have a system running many nodes and need to keep track of them.)

#Open a new terminal while turtlesim is still running in the other one, and enter the following command:

ros2 node list

#Open another new terminal and start the teleop node with the command:

ros2 run turtlesim turtle_teleop_key

#Here, we are searching the turtlesim package again, this time for the executable named turtle_teleop_key.
#Return to the terminal where you ran ros2 node list and run it again. You will now see the names of two active nodes:

 

命令:remapping

功能:修改默认的节点参数

(Remapping allows you to reassign default node properties, like node name, topic names, service names, etc., to custom values. In the last tutorial, you used remapping on turtle_teleop_key to change the default turtle being controlled.)

#Now, lets reassign the name of our /turtlesim node. In a new terminal, run the following command:

ros2 run turtlesim turtlesim_node --ros-args --remap __node:=my_turtle

#Since you’re calling ros2 run on turtlesim again, another turtlesim window will open. However, now if you return to the terminal where you ran ros2 node list, and run it again, you will see three node names:

 

命令: ros2 node info

功能:通过节点的名称来了解节点的详细信息

Now that you know the names of your nodes, you can access more information about them with:

ros2 node info <node_name>

#To examine your latest node, my_turtle, run the following command:

ros2 node info /my_turtle

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值