Linux-world-2012-January->6

本文详细介绍了SED编辑器的基本概念、常用命令及其应用场景。SED是一种强大的文本处理工具,支持文本的查找、替换、删除等功能,适用于自动编辑文件、简化重复任务及编写转换程序。

模拟面试 shell-sed linuxrc etc rcS i2cfrom Mr wang

 c++ morefunction

 

(shell-sed )

Table of Contents
1. Sed简介
2. 定址
3. Sed命令
4. 选项
5. 元字符集
6. 实例
7. 脚本

1. Sed简介

sed是一种在线编辑器,它一次处理一行内容。处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区中的内容,处理完成后,把缓冲区的内容送往屏幕。接着处理下一行,这样不断重复,直到文件末尾。文件内容并没有 改变,除非你使用重定向存储输出。Sed主要用来自动编辑一个或多个文件;简化对文件的反复操作;编写转换程序等。以下介绍的是Gnu版本的Sed 3.02。

方法1:
sed -i 's/被替换的内容/要替换成的内容/' file

方法2:
sed 's/被替换的内容/要替换成的内容/g' file > file.out
mv file.out file

这里注意:
不能这样做:
sed 's/被替换的内容/要替换成的内容/g' file > file
这样只会清空源文件。


2. 定址

可以通过定址来定位你所希望编辑的行,该地址用数字构成,用逗号分隔的两个行数表示以这两行为起止的行的范围(包括行数表示的那两行)。如1,3表示1,2,3行,美元符号($)表示最后一行。范围可以通过数据,正则表达式或者二者结合的方式确定 。


3. Sed命令

调用sed命令有两种形式:


sed [options] 'command' file(s)

sed [options] -f scriptfile file(s)


<
a\
在当前行后面加入一行文本。

b lable
分支到脚本中带有标记的地方,如果分支不存在则分支到脚本的末尾。

c\
用新的文本改变本行的文本。

d
从模板块(Pattern space)位置删除行。

D
删除模板块的第一行。

i\
在当前行上面插入文本。

h
拷贝模板块的内容到内存中的缓冲区。

H
追加模板块的内容到内存中的缓冲区

g
获得内存缓冲区的内容,并替代当前模板块中的文本。

G
获得内存缓冲区的内容,并追加到当前模板块文本的后面。

l
列表不能打印字符的清单。

n
读取下一个输入行,用下一个命令处理新的行而不是用第一个命令。

N
追加下一个输入行到模板块后面并在二者间嵌入一个新行,改变当前行号码。

p
打印模板块的行。

P(大写)
打印模板块的第一行。

q
退出Sed。

r file
从file中读行。

t label
if分支,从最后一行开始,条件一旦满足或者T,t命令,将导致分支到带有标号的命令处,或者到脚本的末尾。

T label
错误分支,从最后一行开始,一旦发生错误或者T,t命令,将导致分支到带有标号的命令处,或者到脚本的末尾。

w file
写并追加模板块到file末尾。

W file
写并追加模板块的第一行到file末尾。

!
表示后面的命令对所有没有被选定的行发生作用。

s/re/string
用string替换正则表达式re。

=
打印当前行号码。

#
把注释扩展到下一个换行符以前。

以下的是替换标记

g表示行内全面替换。

p表示打印行。

w表示把行写入一个文件。

x表示互换模板块中的文本和缓冲区中的文本。

y表示把一个字符翻译为另外的字符(但是不用于正则表达式)


4. 选项
<
-e command, --expression=command
允许多台编辑。

-h, --help
打印帮助,并显示bug列表的地址。

-n, --quiet, --silent
取消默认输出。

-f, --filer=script-file
引导sed脚本文件名。

-V, --version
打印版本和版权信息。


5. 元字符集
<
^
锚定行的开始 如:/^sed/匹配所有以sed开头的行。

$
锚定行的结束 如:/sed$/匹配所有以sed结尾的行。

.
匹配一个非换行符的字符 如:/s.d/匹配s后接一个任意字符,然后是d。

*
匹配零或多个字符 如:/*sed/匹配所有模板是一个或多个空格后紧跟sed的行。

[]
匹配一个指定范围内的字符,如/[Ss]ed/匹配sed和Sed。

[^]
匹配一个不在指定范围内的字符,如:/[^A-RT-Z]ed/匹配不包含A-R和T-Z的一个字母开头,紧跟ed的行。

\(..\)
保存匹配的字符,如s/\(love\)able/\1rs,loveable被替换成lovers。

&
保存搜索字符用来替换其他字符,如s/love/**&**/,love这成**love**。

\<
锚定单词的开始,如:/\

\>
锚定单词的结束,如/love\>/匹配包含以love结尾的单词的行。

x\{m\}
重复字符x,m次,如:/0\{5\}/匹配包含5个o的行。

x\{m,\}
重复字符x,至少m次,如:/o\{5,\}/匹配至少有5个o的行。

x\{m,n\}
重复字符x,至少m次,不多于n次,如:/o\{5,10\}/匹配5--10个o的行。

6. 实例
删除:d命令
$ sed '2d' example-----删除example文件的第二行。

$ sed '2,$d' example-----删除example文件的第二行到末尾所有行。

$ sed '$d' example-----删除example文件的最后一行。

$ sed '/test/'d example-----删除example文件所有包含test的行。

替换:s命令
$ sed 's/test/mytest/g' example-----在整行范围内把test替换为mytest。如果没有g标记,则只有每行第一个匹配的test被替换成mytest。

$ sed -n 's/^test/mytest/p' example-----(-n)选项和p标志一起使用表示只打印那些发生替换的行。也就是说,如果某一行开头的test被替换成mytest,就打印它。

$ sed 's/^192.168.0.1/&localhost/' example-----&符号表示替换换字符串中被找到的部份。所有以192.168.0.1开头的行都会被替换成它自已加 localhost,变成192.168.0.1localhost。

$ sed -n 's/\(love\)able/\1rs/p' example-----love被标记为1,所有loveable会被替换成lovers,而且替换的行会被打印出来。

$ sed 's#10#100#g' example-----不论什么字符,紧跟着s命令的都被认为是新的分隔符,所以,“#”在这里是分隔符,代替了默认的“/”分隔符。表示把所有10替换成100。

选定行的范围:逗号
$ sed -n '/test/,/check/p' example-----所有在模板test和check所确定的范围内的行都被打印。

$ sed -n '5,/^test/p' example-----打印从第五行开始到第一个包含以test开始的行之间的所有行。

$ sed '/test/,/check/s/$/sed test/' example-----对于模板test和west之间的行,每行的末尾用字符串sed test替换。

多点编辑:e命令
$ sed -e '1,5d' -e 's/test/check/' example-----(-e)选项允许在同一行里执行多条命令。如例子所示,第一条命令删除1至5行,第二条命令用check替换test。命令的执 行顺序对结果有影响。如果两个命令都是替换命令,那么第一个替换命令将影响第二个替换命令的结果。

$ sed --expression='s/test/check/' --expression='/love/d' example-----一个比-e更好的命令是--expression。它能给sed表达式赋值。

从文件读入:r命令
$ sed '/test/r file' example-----file里的内容被读进来,显示在与test匹配的行后面,如果匹配多行,则file的内容将显示在所有匹配行的下面。

写入文件:w命令
$ sed -n '/test/w file' example-----在example中所有包含test的行都被写入file里。


追加命令:a命令
$ sed '/^test/a\\--->this is a example' example<-----'this is a example'被追加到以test开头的行后面,sed要求命令a后面有一个反斜杠。

插入:i命令
$ sed '/test/i\\

new line

-------------------------' example

如果test被匹配,则把反斜杠后面的文本插入到匹配行的前面。

下一个:n命令
$ sed '/test/{ n; s/aa/bb/; }' example-----如果test被匹配,则移动到匹配行的下一行,替换这一行的aa,变为bb,并打印该行,然后继续。

变形:y命令
$ sed '1,10y/abcde/ABCDE/' example-----把1--10行内所有abcde转变为大写,注意,正则表达式元字符不能使用这个命令。

退出:q命令
$ sed '10q' example-----打印完第10行后,退出sed。

保持和获取:h命令和G命令
$ sed -e '/test/h' -e '$G example-----在sed处理文件的时候,每一行都被保存在一个叫模式空间的临时缓冲区中,除非行被删除或者输出被取消,否则所有被处理的行都将 打印在屏幕上。接着模式空间被清空,并存入新的一行等待处理。在这个例子里,匹配test的行被找到后,将存入模式空间,h命令将其复制并存入一个称为保 持缓存区的特殊缓冲区内。第二条语句的意思是,当到达最后一行后,G命令取出保持缓冲区的行,然后把它放回模式空间中,且追加到现在已经存在于模式空间中 的行的末尾。在这个例子中就是追加到最后一行。简单来说,任何包含test的行都被复制并追加到该文件的末尾。

保持和互换:h命令和x命令
$ sed -e '/test/h' -e '/check/x' example -----互换模式空间和保持缓冲区的内容。也就是把包含test与check的行互换。

7. 脚本
Sed脚本是一个sed的命令清单,启动Sed时以-f选项引导脚本文件名。Sed对于脚本中输入的命令非常挑剔,在命令的末尾不能有任何空白或文本,如果在一行中有多个命令,要用分号分隔。以#开头的行为注释行,且不能跨行。


比如,如果要打印出含有字串”1024”的行,我就可能会用:
cat filename | sed –n ‘/1024/p’sed命令详解!!(要学习shell的 朋友要好好看看)

 

tzb@tzb:~/PX4_Firmware$ make px4_sitl_default gazebo -- PX4 version: v1.11.0-beta1 -- PX4 config file: /home/tzb/PX4_Firmware/boards/px4/sitl/default.cmake -- PX4 config: px4_sitl_default -- PX4 platform: posix -- PX4 lockstep: enabled -- cmake build type: RelWithDebInfo -- The CXX compiler identification is GNU 9.4.0 -- The C compiler identification is GNU 9.4.0 -- The ASM compiler identification is GNU -- Found assembler: /usr/bin/cc -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Building for code coverage -- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3") -- build type is RelWithDebInfo -- PX4 ECL: Very lightweight Estimation & Control Library v1.9.0-rc1-255-g47624a0 -- Configuring done -- Generating done -- Build files have been written to: /home/tzb/PX4_Firmware/build/px4_sitl_default [0/740] git submodule src/drivers/gps/devices [1/740] git submodule src/lib/ecl [7/740] git submodule mavlink/include/mavlink/v2.0 [10/740] git submodule Tools/sitl_gazebo [18/740] Performing configure step for 'sitl_gazebo' -- install-prefix: /usr/local -- The C compiler identification is GNU 9.4.0 -- The CXX compiler identification is GNU 9.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Performing Test COMPILER_SUPPORTS_CXX17 -- Performing Test COMPILER_SUPPORTS_CXX17 - Success -- Performing Test COMPILER_SUPPORTS_CXX14 -- Performing Test COMPILER_SUPPORTS_CXX14 - Success -- Performing Test COMPILER_SUPPORTS_CXX11 -- Performing Test COMPILER_SUPPORTS_CXX11 - Success -- Performing Test COMPILER_SUPPORTS_CXX0X -- Performing Test COMPILER_SUPPORTS_CXX0X - Success -- Using C++17 compiler -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.58") found components: system thread filesystem -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") -- Checking for module 'bullet>=2.82' -- Found bullet, version 2.88 -- Found ccd: /usr/include (found suitable version "2.0", minimum required is "2.0") -- Found fcl: /usr/include (found suitable version "0.5.0", minimum required is "0.3.2") -- Found assimp: /usr/include (found version "5.0.0") -- Found DART: /usr/include (Required is at least version "6.6") found components: dart -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.40.0") found components: thread system filesystem program_options regex iostreams date_time -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.6.1") -- Looking for ignition-math6 -- found version 6.15.1 -- Searching for dependencies of ignition-math6 -- Looking for OGRE... -- OGRE_PREFIX_WATCH changed. -- Checking for module 'OGRE' -- Found OGRE, version 1.9.0 -- Found Ogre Ghadamon (1.9.0) -- Found OGRE: optimized;/usr/lib/x86_64-linux-gnu/libOgreMain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreMain.so -- Looking for OGRE_Paging... -- Found OGRE_Paging: optimized;/usr/lib/x86_64-linux-gnu/libOgrePaging.so;debug;/usr/lib/x86_64-linux-gnu/libOgrePaging.so -- Looking for OGRE_Terrain... -- Found OGRE_Terrain: optimized;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so -- Looking for OGRE_Property... -- Found OGRE_Property: optimized;/usr/lib/x86_64-linux-gnu/libOgreProperty.so;debug;/usr/lib/x86_64-linux-gnu/libOgreProperty.so -- Looking for OGRE_RTShaderSystem... -- Found OGRE_RTShaderSystem: optimized;/usr/lib/x86_64-linux-gnu/libOgreRTShaderSystem.so;debug;/usr/lib/x86_64-linux-gnu/libOgreRTShaderSystem.so -- Looking for OGRE_Volume... -- Found OGRE_Volume: optimized;/usr/lib/x86_64-linux-gnu/libOgreVolume.so;debug;/usr/lib/x86_64-linux-gnu/libOgreVolume.so -- Looking for OGRE_Overlay... -- Found OGRE_Overlay: optimized;/usr/lib/x86_64-linux-gnu/libOgreOverlay.so;debug;/usr/lib/x86_64-linux-gnu/libOgreOverlay.so -- Looking for ignition-math6 -- found version 6.15.1 -- Looking for ignition-transport8 -- found version 8.5.0 -- Searching for dependencies of ignition-transport8 -- Config-file not installed for ZeroMQ -- checking for pkg-config -- Checking for module 'libzmq >= 4' -- Found libzmq , version 4.3.2 -- Found ZeroMQ: TRUE (Required is at least version "4") -- Checking for module 'uuid' -- Found uuid, version 2.34.0 -- Found UUID: TRUE -- Looking for ignition-msgs5 -- found version 5.11.0 -- Searching for dependencies of ignition-msgs5 -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found suitable version "3.6.1", minimum required is "3") -- Looking for ignition-math6 -- found version 6.15.1 -- Checking for module 'tinyxml2' -- Found tinyxml2, version 6.2.0 -- Looking for ignition-msgs5 -- found version 5.11.0 -- Looking for ignition-common3 -- found version 3.17.0 -- Searching for dependencies of ignition-common3 -- Looking for dlfcn.h - found -- Looking for libdl - found -- Found DL: TRUE -- Searching for <ignition-common3> component [graphics] -- Looking for ignition-common3-graphics -- found version 3.17.0 -- Searching for dependencies of ignition-common3-graphics -- Looking for ignition-math6 -- found version 6.15.1 -- Looking for ignition-fuel_tools4 -- found version 4.9.1 -- Searching for dependencies of ignition-fuel_tools4 -- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found version "7.68.0") -- Checking for module 'jsoncpp' -- Found jsoncpp, version 1.7.4 -- Found JSONCPP: TRUE -- Checking for module 'yaml-0.1' -- Found yaml-0.1, version 0.2.2 -- Found YAML: TRUE -- Checking for module 'libzip' -- Found libzip, version 1.5.1 -- Found ZIP: TRUE -- Looking for ignition-common3 -- found version 3.17.0 -- Looking for ignition-math6 -- found version 6.15.1 -- Looking for ignition-msgs5 -- found version 5.11.0 -- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3") -- Found OpenCV: /usr (found version "4.2.0") -- Found TinyXML: /usr/lib/x86_64-linux-gnu/libtinyxml.so -- Checking for module 'gstreamer-1.0 >= 1.0' -- Found gstreamer-1.0 , version 1.16.3 -- Checking for module 'gstreamer-base-1.0 >= 1.0' -- Found gstreamer-base-1.0 , version 1.16.3 -- Found GStreamer: GSTREAMER_INCLUDE_DIRS;GSTREAMER_LIBRARIES;GSTREAMER_VERSION;GSTREAMER_BASE_INCLUDE_DIRS;GSTREAMER_BASE_LIBRARIES (Required is at least version "1.0") -- Checking for module 'OGRE' -- Found OGRE, version 1.9.0 -- Building klt_feature_tracker without catkin -- Building OpticalFlow with OpenCV -- Found MAVLink: /home/tzb/PX4_Firmware/mavlink/include (found version "2.0") -- catkin DISABLED -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.6.1") -- Checking for module 'protobuf' -- Found protobuf, version 3.6.1 -- Gazebo version: 11.15 -- Found GStreamer: adding gst_camera_plugin -- Found GStreamer: adding gst_video_stream_widget -- Configuring done -- Generating done -- Build files have been written to: /home/tzb/PX4_Firmware/build/px4_sitl_default/build_gazebo [586/740] Performing build step for 'sitl_gazebo' [11/100] Generating /home/tzb/PX4_Firm...ls/mb1240-xl-ez4/mb1240-xl-ez4-gen.sdf /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/mb1240-xl-ez4/mb1240-xl-ez4.sdf.jinja -> /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/mb1240-xl-ez4/mb1240-xl-ez4-gen.sdf [12/100] Generating /home/tzb/PX4_Firm..._gazebo/models/px4flow/px4flow-gen.sdf /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/px4flow/px4flow.sdf.jinja -> /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/px4flow/px4flow-gen.sdf [13/100] Generating /home/tzb/PX4_Firm...models/3DR_gps_mag/3DR_gps_mag-gen.sdf /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/3DR_gps_mag/3DR_gps_mag.sdf.jinja -> /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/3DR_gps_mag/3DR_gps_mag-gen.sdf [14/100] Generating /home/tzb/PX4_Firm...s/sitl_gazebo/models/c920/c920-gen.sdf /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/c920/c920.sdf.jinja -> /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/c920/c920-gen.sdf [15/100] Generating /home/tzb/PX4_Firm...models/matrice_100/matrice_100-gen.sdf /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/matrice_100/matrice_100.sdf.jinja -> /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/matrice_100/matrice_100-gen.sdf [16/100] Generating /home/tzb/PX4_Firm...sitl_gazebo/models/sf10a/sf10a-gen.sdf /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/sf10a/sf10a.sdf.jinja -> /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/sf10a/sf10a-gen.sdf [17/100] Generating /home/tzb/PX4_Firm..._gazebo/models/pixhawk/pixhawk-gen.sdf /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/pixhawk/pixhawk.sdf.jinja -> /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/pixhawk/pixhawk-gen.sdf [18/100] Generating /home/tzb/PX4_Firm...s/sitl_gazebo/models/r200/r200-gen.sdf /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/r200/r200.sdf.jinja -> /home/tzb/PX4_Firmware/Tools/sitl_gazebo/models/r200/r200-gen.sdf [19/100] Generating /home/tzb/PX4_Firm...Tools/sitl_gazebo/models/iris/iris.sdf [100/100] Linking CXX shared library libgazebo_imu_plugin.so [739/740] cd /home/tzb/PX4_Firmware/bu...zb/PX4_Firmware/build/px4_sitl_default SITL ARGS sitl_bin: /home/tzb/PX4_Firmware/build/px4_sitl_default/bin/px4 debugger: none program: gazebo model: none world: none src_path: /home/tzb/PX4_Firmware build_path: /home/tzb/PX4_Firmware/build/px4_sitl_default empty model, setting iris as default GAZEBO_PLUGIN_PATH :/home/tzb/PX4_Firmware/build/px4_sitl_default/build_gazebo GAZEBO_MODEL_PATH :/home/tzb/PX4_Firmware/Tools/sitl_gazebo/models LD_LIBRARY_PATH /opt/ros/noetic/lib:/home/tzb/PX4_Firmware/build/px4_sitl_default/build_gazebo empty world, setting empty.world as default gzserver: /usr/include/boost/smart_ptr/shared_ptr.hpp:734: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = gazebo::event::Connection; typename boost::detail::sp_member_access<T>::type = gazebo::event::Connection*]: Assertion `px != 0' failed. /home/tzb/PX4_Firmware/Tools/sitl_run.sh:行 124: 8222 已放弃 (核心已转储) gzserver "${src_path}/Tools/sitl_gazebo/worlds/empty.world" SITL COMMAND: "/home/tzb/PX4_Firmware/build/px4_sitl_default/bin/px4" "/home/tzb/PX4_Firmware"/ROMFS/px4fmu_common -s etc/init.d-posix/rcS -t "/home/tzb/PX4_Firmware"/test_data INFO [px4] Creating symlink /home/tzb/PX4_Firmware/ROMFS/px4fmu_common -> /home/tzb/PX4_Firmware/build/px4_sitl_default/tmp/rootfs/etc ______ __ __ ___ | ___ \ \ \ / / / | | |_/ / \ V / / /| | | __/ / \ / /_| | | | / /^\ \ \___ | \_| \/ \/ |_/ px4 starting. INFO [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0 INFO [param] selected parameter default file eeprom/parameters_10016 [param] parameter file not found, creating eeprom/parameters_10016 SYS_AUTOCONFIG: curr: 0 -> new: 1 * SYS_AUTOSTART: curr: 0 -> new: 10016 BAT_N_CELLS: curr: 0 -> new: 3 CAL_ACC0_ID: curr: 0 -> new: 1311244 CAL_ACC_PRIME: curr: 0 -> new: 1311244 CAL_GYRO0_ID: curr: 0 -> new: 2294028 CAL_GYRO_PRIME: curr: 0 -> new: 2294028 CAL_MAG0_ID: curr: 0 -> new: 197388 CAL_MAG_PRIME: curr: 0 -> new: 197388 COM_DISARM_LAND: curr: 2.0000 -> new: 0.5000 COM_OBL_ACT: curr: 0 -> new: 2 COM_RC_IN_MODE: curr: 0 -> new: 1 EKF2_ANGERR_INIT: curr: 0.1000 -> new: 0.0100 EKF2_GBIAS_INIT: curr: 0.1000 -> new: 0.0100 COM_ARM_EKF_AB: curr: 0.0017 -> new: 0.0050 EKF2_REQ_GPS_H: curr: 10.0000 -> new: 0.5000 MC_PITCH_P: curr: 6.5000 -> new: 6.0000 MC_PITCHRATE_P: curr: 0.1500 -> new: 0.2000 MC_ROLL_P: curr: 6.5000 -> new: 6.0000 MC_ROLLRATE_P: curr: 0.1500 -> new: 0.2000 MPC_HOLD_MAX_Z: curr: 0.6000 -> new: 2.0000 MPC_Z_VEL_I: curr: 0.1000 -> new: 0.1500 MPC_Z_VEL_P: curr: 0.2000 -> new: 0.6000 MPC_XY_P: curr: 0.9500 -> new: 0.8000 MPC_XY_VEL_P: curr: 0.0900 -> new: 0.2000 MPC_XY_VEL_D: curr: 0.0100 -> new: 0.0160 MPC_SPOOLUP_TIME: curr: 1.0000 -> new: 0.5000 MPC_TKO_RAMP_T: curr: 3.0000 -> new: 1.0000 NAV_ACC_RAD: curr: 10.0000 -> new: 2.0000 NAV_DLL_ACT: curr: 0 -> new: 2 RTL_DESCEND_ALT: curr: 30.0000 -> new: 5.0000 RTL_LAND_DELAY: curr: -1.0000 -> new: 5.0000 RTL_RETURN_ALT: curr: 60.0000 -> new: 30.0000 SDLOG_MODE: curr: 0 -> new: 1 SDLOG_PROFILE: curr: 3 -> new: 131 SDLOG_DIRS_MAX: curr: 0 -> new: 7 SENS_BOARD_X_OFF: curr: 0.0000 -> new: 0.0000 SENS_DPRES_OFF: curr: 0.0000 -> new: 0.0010 TRIG_INTERFACE: curr: 4 -> new: 3 * RTL_DESCEND_ALT: curr: 5.0000 -> new: 10.0000 * RTL_LAND_DELAY: curr: 5.0000 -> new: 0.0000 PWM_MAX: curr: 2000 -> new: 1950 PWM_MIN: curr: 1000 -> new: 1075 GPS_UBX_DYNMODEL: curr: 7 -> new: 6 * SYS_AUTOCONFIG: curr: 1 -> new: 0 INFO [dataman] Unknown restart, data manager file './dataman' size is 11798680 bytes INFO [simulator] Waiting for simulator to accept connection on TCP port 4560 Gazebo multi-robot simulator, version 11.15.1 Copyright (C) 2012 Open Source Robotics Foundation. Released under the Apache 2 License. http://gazebosim.org # # ####### ####### ### ##### ####### ## # # # # # # # # # # # # # # # # # # # # # # # # # ##### # # # # # # # # # # ## # # # # # # # # # ####### # ### ##### ####### This version of Gazebo, now called Gazebo classic, reaches end-of-life in January 2025. Users are highly encouraged to migrate to the new Gazebo using our migration guides (https://gazebosim.org/docs/latest/gazebo_classic_migration/) [Msg] Waiting for master. [Err] [ConnectionManager.cc:121] Failed to connect to master in 30 seconds. [Err] [gazebo_shared.cc:106] Unable to initialize transport. [Err] [gazebo_client.cc:56] Unable to setup Gazebo ^A
08-01
timi@timi--R7000P2021:~/PX4-Autopilot$ make px4_sitl gazebo [0/4] Performing build step for 'sitl_gazebo-classic' ninja: no work to do. [3/4] cd /home/timi/PX4-Autopilot/buil...i/PX4-Autopilot/build/px4_sitl_default SITL ARGS sitl_bin: /home/timi/PX4-Autopilot/build/px4_sitl_default/bin/px4 debugger: none model: iris world: none src_path: /home/timi/PX4-Autopilot build_path: /home/timi/PX4-Autopilot/build/px4_sitl_default GAZEBO_PLUGIN_PATH /home/timi/model_editor_models/Plugin_v0/build::/home/timi/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic GAZEBO_MODEL_PATH :/home/timi/PX4-Autopilot/Tools/sitl_gazebo/models:/home/timi/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models LD_LIBRARY_PATH /home/timi/PX4-Autopilot/build/px4_sitl_default/build_gazebo:/opt/ros/noetic/lib:/home/timi/catkin_ws/devel/lib:/opt/ros/noetic/lib:/opt/ros/noetic/lib/x86_64-linux-gnu:/home/timi/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic empty world, setting empty.world as default Using: /home/timi/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models/iris/iris.sdf Warning [parser.cc:833] XML Attribute[version] in element[sdf] not defined in SDF, ignoring. gzserver: symbol lookup error: /home/timi/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic/libgazebo_mavlink_interface.so: undefined symbol: _ZN8mav_msgs4msgs17CommandMotorSpeedC1Ev SITL COMMAND: "/home/timi/PX4-Autopilot/build/px4_sitl_default/bin/px4" "/home/timi/PX4-Autopilot/build/px4_sitl_default"/etc ______ __ __ ___ | ___ \ \ \ / / / | | |_/ / \ V / / /| | | __/ / \ / /_| | | | / /^\ \ \___ | \_| \/ \/ |_/ px4 starting. INFO [px4] startup script: /bin/sh etc/init.d-posix/rcS 0 INFO [init] found model autostart file as SYS_AUTOSTART=10015 INFO [param] selected parameter default file parameters.bson INFO [param] selected parameter backup file parameters_backup.bson SYS_AUTOCONFIG: curr: 0 -> new: 1 SYS_AUTOSTART: curr: 0 -> new: 10015 CAL_ACC0_ID: curr: 0 -> new: 1310988 CAL_GYRO0_ID: curr: 0 -> new: 1310988 CAL_ACC1_ID: curr: 0 -> new: 1310996 CAL_GYRO1_ID: curr: 0 -> new: 1310996 CAL_ACC2_ID: curr: 0 -> new: 1311004 CAL_GYRO2_ID: curr: 0 -> new: 1311004 CAL_MAG0_ID: curr: 0 -> new: 197388 CAL_MAG0_PRIO: curr: -1 -> new: 50 CAL_MAG1_ID: curr: 0 -> new: 197644 CAL_MAG1_PRIO: curr: -1 -> new: 50 SENS_BOARD_X_OFF: curr: 0.0000 -> new: 0.0000 SENS_DPRES_OFF: curr: 0.0000 -> new: 0.0010 INFO [dataman] data manager file './dataman' size is 1208528 bytes INFO [init] PX4_SIM_HOSTNAME: localhost INFO [simulator_mavlink] Waiting for simulator to accept connection on TCP port 4560 Gazebo multi-robot simulator, version 11.15.1 Copyright (C) 2012 Open Source Robotics Foundation. Released under the Apache 2 License. http://gazebosim.org # # ####### ####### ### ##### ####### ## # # # # # # # # # # # # # # # # # # # # # # # # # ##### # # # # # # # # # # ## # # # # # # # # # ####### # ### ##### ####### This version of Gazebo, now called Gazebo classic, reaches end-of-life in January 2025. Users are highly encouraged to migrate to the new Gazebo using our migration guides (https://gazebosim.org/docs/latest/gazebo_classic_migration/) [Msg] Waiting for master. [Err] [ConnectionManager.cc:121] Failed to connect to master in 30 seconds. [Err] [gazebo_shared.cc:106] Unable to initialize transport. [Err] [gazebo_client.cc:56] Unable to setup Gazebo
08-30
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

doublewei1

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值