当前位置:网站首页>2021-7-18 ROS notes XML language related
2021-7-18 ROS notes XML language related
2022-06-11 01:48:00 【Captain xiaoyifeng】
XML Basic knowledge
In this paper, the reference http://wiki.ros.org/roslaunch/XML
The basic rule
xml Language consists of 、 A pair of labels , It's a markup language , According to the rules of depth first traversal and later overwriting the former .
Common attributes of nodes
name="name" Node name
type="filename" Executable file name
pkg="package" Function package name
output="screen" Output the node standard to the terminal screen
respawn="true" Reset properties , When node stops , It will restart automatically
required="true" Necessary nodes , At the end of , Other nodes also terminate
ns="namespace" Namespace , Add a namespace prefix to the relative names within the node
args="arguments" Parameters entered by the node
arg
arg Express argument, Is in launch Custom replacement parameters inside the file (substitution args), Cannot be used outside the file
arg The creation of
<arg name="arg_name" default="arg_value"/>
<arg name="arg_name" value="arg_value"/>
Where the former is a variable , You can change the value , The initial value is arg_value; The latter is a constant , Do not modify the
arg Call to
<param name="foo" value=$(arg arg_name)/>
arg The transfer
use include
<include file="included.launch">
<!-- all vars that included.launch requires must be set -->
<arg name="hoge" value="fuga" />
</include>
<launch>
<!-- declare arg to be passed in -->
<arg name="hoge" />
<!-- read value of arg -->
<param name="param" value="$(arg hoge)"/>
</launch>
Use terminal
$ roslaunch %YOUR_ROS_PKG% my_file.launch hoge:=my_value
Other substitution parameters (substitution args)
Environment configuration is omitted
$(find pkg)
Returns the address of the specified package , for example :
<include file="$(find 2dnav_pr2)/config/map_server.xml" />
$(anon name)
First, let's talk about anonymity (anonymous name), because ros Nodes with the same name can only appear once in the system of , The node with the same name that appears later will kill the previous running node . Anonymous nodes make names unique , This prevents duplicate node names .
Usage method :
<launch>
<node name="$(anon my_infra_red_sensor)" pkg="your_package" type="infra_red_sensor.py" />
</launch>
$(eval [expression])
Express python The result of the operation expression
usage :
<param name="circumference" value="$(eval 2.* 3.1415 * arg('radius'))"/>
Convenience , The following two are equivalent in the expression
arg('radius')
radius
because xml A language cannot have two variables superimposed on each other , Such as
a=$(path)$(name)
We can use eval Connect the variables together , such as :
"$(eval arg('foo') + env('PATH') + 'bar' + find('pkg')"
if and unless
if Express If the expression is true that Include this tag
unless Express If the expression is true So it doesn't include this tag
for example
<param name="foo" value="bar" unless="$(arg foo)" />
remap
ramap Is a remapping , adopt remap You can put a topic Remap to another topic, You don't have to be in py Modification in the document topic 了 , give an example :
<remap from="/different_topic" to="/needed_topic"/>
param
Express parameter, Exist ros Parameters on the server , Can be called externally
usage :
Defined in the file
<param name="publish_frequency" type="double" value="10.0" />
The documents ( adopt yaml file ) call
<rosparam command="load" file="FILENAME" />
It can be done by rospy.get_param() obtain
See http://wiki.ros.org/rospy_tutorials/Tutorials/Parameters
group
Equivalent to a container ,
You can modify namespace Parameters
notes
<!-- This is a comment -->
package
The basic format
Let's start with a paragraph .xml The contents of the document
<package format="2"> <!--2 Represents a new format -->
<name>foobar</name>
<version>1.2.4</version>
<description>
This package provides foo capability.
</description>
<maintainer email="[email protected]">PR-foobar</maintainer>
<license>BSD</license>
<!-- The above five attributes are the minimum set , necessary -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>std_msgs</build_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>std_msgs</exec_depend>
</package>
package Nested as the root element in the outermost layer Expressed as a feature pack
Nested inside is package Properties of
It can be seen that the attribute can not bring its own data , You can also bring your own data , Data types are strings
Yuan Bao
If it can be exported as a meta package , You need to add the following to the root element
<export> <!-- There needs to be export and metapacakge label , Pay attention to this fixed writing -->
<metapackage/>
</export>
Meta packaged CMakeList The most basic thing is
cmake_minimum_required(VERSION 2.8.3)
project(ros_academy_for_beginners)
find_package(catkin REQUIRED)
catkin_metapackage() # Declare that this package is a metapacakge
Generally, this is the case
cmake_minimum_required(VERSION 2.8.3)
project(foobar)
find_package(catkin REQUIRED roscpp std_msgs)
catkin_package()
*.launch
launch Used to run multiple nodes at the same time
Here's a piece of code
<launch>
<group name="wg">
<include file="$(find pr2_alpha)/$(env ROBOT).machine" />
<include file="$(find 2dnav_pr2)/config/new_amcl_node.xml" />
<include file="$(find 2dnav_pr2)/config/base_odom_teleop.xml" />
<include file="$(find 2dnav_pr2)/config/lasers_and_filters.xml" />
<include file="$(find 2dnav_pr2)/config/map_server.xml" />
<include file="$(find 2dnav_pr2)/config/ground_plane.xml" />
<!-- The navigation stack and associated parameters -->
<include file="$(find 2dnav_pr2)/move_base/move_base.xml" />
</group>
</launch>
Startup file (Launch File) yes ROS A way to start multiple nodes at the same time , It can also start automatically ROSMaster Node manager , And various configurations of each node can be realized , It provides great convenience for the operation of multiple nodes . This file contains a set of other files . Each included file contains a part of the system ( Such as positioning 、 Sensor processing and path planning ) Relevant nodes and parameters ( May be nested contains ).
边栏推荐
- “看似抢票实际抢钱”,别被花式抢票产品一再忽悠
- 懒汉式单例模式
- Yunna Qingyuan fixed assets management and barcode inventory system
- [ROS] review of 2021 ROS Summer School
- Using MySQL database in nodejs
- 1.4PX4程序下载
- SAS factor analysis (proc factor process, factor rotation and regression method for factor score function)
- Yanrong looks at how to realize the optimal storage solution of data Lake in a hybrid cloud environment
- 【云原生 | Kubernetes篇】Ingress案例实战
- Derivation of Kalman filter (KF) and extended Kalman filter (EKF)
猜你喜欢

Conda安装Pytorch后numpy出现问题

Garbled code when the command parameter contains% in VisualStudio debugging

Loki learning summary (1) -- the best choice of Loki small and medium-sized project log system
![[leetcode] reverse linked list II](/img/03/5e4921a8fe50b3489b4b99310d1afb.jpg)
[leetcode] reverse linked list II
![[leetcode] delete duplicate Element II in the sorting linked list](/img/24/0f8e4a2d15732997c8eb8973669bf7.jpg)
[leetcode] delete duplicate Element II in the sorting linked list

How to download web photos

1.4px4 program download

Threejs: pit encountered in drawing Bessel curve with two-point coordinates

Once you know these treasure websites, you can't live without them!!!
![[Li mu] how to read papers [intensive reading of papers]](/img/41/7e1ff1db2f7a848c8702c186c79fe5.jpg)
[Li mu] how to read papers [intensive reading of papers]
随机推荐
[leetcode] intersecting linked list
【云原生 | Kubernetes篇】Ingress案例实战
Px4 from abandonment to mastery (twenty four): customized model
Matlab digital operation function notes
今日睡眠质量记录80分
ros缺包怎么办
Classic questions: 01 backpack, complete backpack, multiple backpack, two-dimensional cost Backpack
Record the packaging of the googlechrome browser plug-in
QGC地面站使用教程
1.3 ROS 无人机简介
Application of object storage S3 in distributed file system
Tencent cloud database tdsql- a big guy talks about the past, present and future of basic software
CLIP论文详解
1.4PX4程序下载
2021-3-1matlas MNIST database training for CNN writing
“看似抢票实际抢钱”,别被花式抢票产品一再忽悠
Yunna PDA wireless fixed assets inventory management system
LeetCode 1749 Maximum Absolute Sum of Any Subarray (dp)
Leetcode permutation and combination problem backtracking
[path planning] week 1: Path Planning open source code summary (ROS) version