ROS学习----依据ROS入门教程,整理的ROS命令
发布日期:2022-01-20 01:07:42 浏览次数:3 分类:技术文章

本文共 22194 字,大约阅读时间需要 73 分钟。

文章目录

ROS命令学习

参考链接:

1.
2.

文件系统介绍

1.Packages: Package是ROS系统中最底层最基本的组织,里面存放各种文件:库、工具、可执行文件等.

2.Manifest: 一个package描述xml文件,定义package之间的依赖关系.

3.Stacks: package的集合,比package这个概念高一级别

4.Stack Manifest: 作用类似package manifest文件,但是它是针对stack的.

在文件系统中很容易识别package和stack:

1.package是一个包含 manifest.xml 文件的目录.

2.stack是一个包含 stack.xml 文件的目录.
在这里插入图片描述

ROS文件系统工具命令:rospack,rosstack roscd,rosls

rospack find [package_name]rosstack find [stack_name]

rospack用于获取packages的信息.

rospack  [options] [package]  Allowed commands:    help    cflags-only-I     [--deps-only] [package]    cflags-only-other [--deps-only] [package]    depends           [package] (alias: deps)    depends-indent    [package] (alias: deps-indent)    depends-manifests [package] (alias: deps-manifests)    depends-msgsrv    [package] (alias: deps-msgsrv)    depends-on        [package]    depends-on1       [package]    depends-why --target=
[package] (alias: deps-why) depends1 [package] (alias: deps1) export [--deps-only] --lang=
--attrib=
[package] find [package] langs libs-only-L [--deps-only] [package] libs-only-l [--deps-only] [package] libs-only-other [--deps-only] [package] list list-duplicates list-names plugins --attrib=
[--top=
] [package] profile [--length=
] [--zombie-only] rosdep [package] (alias: rosdeps) rosdep0 [package] (alias: rosdeps0) vcs [package] vcs0 [package] Extra options: -q Quiets error reports. If [package] is omitted, the current working directory is used (if it contains a package.xml or manifest.xml).
roscd [locationname[/subdir]]

roscd用于改变当前目录到指定的package或者stack的目录(cd)

pwd

显示当前目录路径(unix命令)

echo $ROS_PACKAGE_PATH

查看环境变量

rosls [locationname[/subdir]]

rosls作用是列出指定的package或stack中的文件及目录.

rospack = ros + pack(age) rosstack = ros + stack roscd = ros + cd rosls = ros + ls

创建ROS程序包命令:roscreate,catkin程序包结构,catkin_create_pkg,package.xml讲解

ROS包有类似文件结构:manifests, CMakeLists.txt, mainpage.dox, and Makefiles

roscreate-pkg [package_name] [depend1] [depend2] [depend3]

ros包的依赖是存在manifest 文件–manifest.xml

roscd beginner_tutorialscat manifest.xml
1.roscreate-pkg = ros+create-pkg : 生成ROS包需要的文件2.rospack = ros+pack(age) : 提供ROS package相关的信息 3.rosstack = ros+stack  : 提供ROS stack 相关的信息

一个catkin程序包由什么组成?

一个程序包要想称为catkin程序包必须符合以下要求:

1.该程序包必须包含catkin compliant package.xml文件,这个package.xml文件提供有关程序包的元信息。

2.程序包必须包含一个catkin 版本的CMakeLists.txt文件,而Catkin metapackages中必须包含一个对CMakeList.txt文件的引用。

3.每个目录下只能有一个程序包。这意味着在同一个目录下不能有嵌套的或者多个程序包存在

workspace_folder/        -- WORKSPACE工作空间  src/                   -- SOURCE SPACE 源码目录    CMakeLists.txt       -- 'Toplevel' CMake file, provided by catkin    package_1/      CMakeLists.txt     -- CMakeLists.txt file for package_1      package.xml        -- Package manifest for package_1    ...    package_n/      CMakeLists.txt     -- CMakeLists.txt file for package_n      package.xml        -- Package manifest for package_n

catkin_create_pkg命令:

catkin_create_pkg 
[depend1] [depend2] [depend3]

自定义 package.xml:

**描述标签:
The beginner_tutorials package
将描述信息修改为任何你喜欢的内容,但是按照约定第一句话应该简短一些,因为它覆盖了程序包的范围。**维护者标签 7
8
9
10
user
这是package.xml中要求填写的一个重要标签,因为它能够让其他人联系到程序包的相关人员。至少需要填写一个维护者名称,但如果有需要的话你可以添加多个。除了在标签里面填写维护者的名称外,还应该在标签的email属性中填写邮箱地址:**许可标签 12
13
14
15
TODO
你应该选择一种许可协议并将它填写到这里。一些常见的开源许可协议有BSD、MIT、Boost Software License、GPLv2、GPLv3、LGPLv2.1和LGPLv3。你可以在Open Source Initiative中阅读其中的若干个许可协议的相关信息。对于本教程我们将使用BSD协议,因为ROS核心组件的剩余部分已经使用了该协议: 8
BSD
**依赖项标签接下来的标签用来描述程序包的各种依赖项,这些依赖项分为:build_dependbuildtool_dependrun_dependtest_depend更详细介绍请参考Catkin Dependencies相关的文档。

编译ROS程序包命令:rosmake, catkin_make,(src 、devel 、build)

rosmake是跟make类似的小工具, 但它会针对ROS做一些相应的处理。

当你执行rosmake beginner_tutorials命令, 编译beginner_tutorials 包,并按照正确的顺序链接所依赖的package。

因为我们在创建的ROS包的时候加入了对 rospy, roscpp, 和std_msgs 的依赖,所以这些package(以及它们的依赖项,等等,如此反复) 都将会被rosmake所编译。

rosmake [package]
Usage: rosmake [options] [PACKAGE]...rosmake recursively builds all dependencies before building a packageOptions:  -h, --help            show this help message and exit  --test-only           only run tests  -t                    build and test packages  -a, --all             select all packages  -i, --mark-installed  On successful build, mark specified packages as                        installed with ROS_NOBUILD  -u, --unmark-installed                        Remove ROS_NOBUILD from the specified packages.  This                        will not build anything.  -v                    display errored builds  -r, -k, --robust      do not stop build on error  --build-everything    build all packages regardless of errors  -V                    display all builds  -s, --specified-only  only build packages specified on the command line  --buildtest=BUILDTEST                        package to buildtest  --buildtest1=BUILDTEST1                        package to buildtest1  --output=OUTPUT_DIR   where to output results  --pre-clean           run make clean first  --bootstrap           DEPRECATED, UNUSED  --disable-logging     turn off all logs  --target=TARGET       run make with this target  --pjobs=ROS_PARALLEL_JOBS                        Override ROS_PARALLEL_JOBS environment variable with                        this number of jobs.  --threads=THREADS     Build up to N packages in parallel  --profile             print time profile after build  --skip-blacklist      skip packages containing a file called                        ROS_BUILD_BLACKLIST (Default behavior will ignore the                        presence of ROS_BUILD_BLACKLIST)  --skip-blacklist-osx  deprecated option. it will do nothing, please use                        platform declarations and --require-platform instead  --status-rate=STATUS_UPDATE_RATE                        How fast to update the status bar in Hz.  Default: 5Hz

同时编译多个package

rosmake [package1] [package2] [package3]
1.rosdep = ros+dep(endencies) : 安装package所需系统依赖项的小工具2.rosmake = ros+make : 编译 ROS package

catkin_make命令:

使用之前事先source你的环境配置(setup)文件。
catkin_make 是一个命令行工具,它简化了catkin的标准工作流程。
你可以认为catkin_make是在CMake标准工作流程中依次调用了cmake 和 make。

catkin_make [make_targets] [-DCMAKE_VARIABLES=...]

catkin_make默认空间(~/catkin_ws/src)

如果添加其他源,(例如存放在了~/catkin_ws/my_src中)命令为:

# In a catkin workspace$ catkin_make --source my_src$ catkin_make install --source my_src  # (optionally)

里面有三个目录:src 、devel 、build

src 工作空间
build目录是build space的默认所在位置,同时cmake和make也是在这里被调用来配置并编译你的程序包。
devel目录是devel space的默认所在位置, 同时也是在你安装程序包之前存放可执行文件和库文件的地方


ROS节点命令: ROS 图(graph)概念, chown ,rosnode, rosrun

ROS图概念:

Nodes:节点,一个节点即为一个可执行文件,它可以通过ROS与其它节点进行通信。
Messages:消息,消息是一种ROS数据类型,用于订阅或发布到一个话题。
Topics:话题,节点可以发布消息到话题,也可以订阅话题以接收消息。
Master:节点管理器,ROS名称服务 (比如帮助节点找到彼此)。
rosout:ROS中相当于stdout/stderr。
roscore: 主机+ rosout + 参数服务器 (参数服务器会在后面介绍)。

节点:一个节点其实只不过是ROS程序包中的一个可执行文件。

ROS节点可以使用ROS客户库与其他节点通信。
节点可以发布或接收一个话题。
节点也可以提供或使用某种服务。

修改该文件夹的用户归属关系:

sudo chown -R 
~/.ros

chown 命令可以获取root权限等命令 chown --help 命令即可查询用法

rosnode命令:

rosnode is a command-line tool for printing information about ROS Nodes.Commands:	rosnode ping	test connectivity to node	rosnode list	list active nodes	rosnode info	print information about node	rosnode machine	list nodes running on a particular machine or list machines	rosnode kill	kill a running node	rosnode cleanup	purge registration information of unreachable nodesType rosnode  -h for more detailed usage, e.g. 'rosnode ping -h'

rosrun用法:

rosrun [package_name] [node_name]
Usage: rosrun [--prefix cmd] [--debug] PACKAGE EXECUTABLE [ARGS]  rosrun will locate PACKAGE and try to find  an executable named EXECUTABLE in the PACKAGE tree.  If it finds it, it will run it with ARGS.

理解ROS话题命令:rostopic,rosmsg,rqt_plot

turtlesim_node节点和turtle_teleop_key节点之间是通过一个ROS话题来互相通信的。

turtle_teleop_key在一个话题上发布按键输入消息,而turtlesim则订阅该话题以接收该消息。
rqt_graph来显示当前运行的节点和话题。

rostopic is a command-line tool for printing information about ROS Topics.Commands:	rostopic bw	    display bandwidth used by topic	rostopic delay	display delay of topic from timestamp in header	rostopic echo	print messages to screen	rostopic find 	find topics by type	rostopic hz	   display publishing rate of topic    //查看数据发布的频率	rostopic info	   print information about active topic	rostopic list	   list active topics	rostopic pub	publish data to topic //可以把数据发布到当前某个正在广播的话题上。   rostopic type	  print topic typeType rostopic  -h for more detailed usage, e.g. 'rostopic echo -h'

例子:

rostopic echo /turtle1/cmd_vel  //查看turtle_teleop_key节点在 /turtle1/cmd_vel话题上发布的数据,同时也订阅了 /turtle1/cmd_vel 话题rostopic list -v   //列出详细数据,显示出有关所发布和订阅的话题及其类型的详细信息。

ROS Messages

话题之间的通信是通过在节点之间发送ROS消息实现的。

对于发布器(turtle_teleop_key和订阅器(turtulesim_node)之间的通信,发布器和订阅器之间必须发送和接收相同类型的消息。
这意味着话题的类型是由发布在它上面的消息类型决定的。
使用rostopic type命令可以查看发布在某个话题上的消息类型。

rostopic type [topic]

用rosmsg查看消息的详细情况

rosmsg show geometry_msgs/Twist
rosmsg is a command-line tool for displaying information about ROS Message types.Commands:	rosmsg show	Show message description	rosmsg list	List all messages	rosmsg md5	Display message md5sum	rosmsg package	List messages in a package	rosmsg packages	List packages that contain messages
rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'

-1:(单个破折号)这个参数选项使rostopic发布一条消息后马上退出。

- -:(双破折号)这会告诉命令选项解析器接下来的参数部分都不是命令选项。

rostopic pub /turtle1/cmd_vel geometry_msgs/Twist -r 1 -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'

这条命令以1Hz的频率发布速度命令到速度话题上。

rqt_plot命令可以实时显示一个发布到某个话题上的数据变化图形


理解ROS服务和参数命令:rosservice, rossrv,rosparam,YAML标记语言

服务(services)是节点之间通讯的另一种方式。

服务允许节点发送请求(request) 并获得一个响应(response)
rosservice可以很轻松的使用 ROS 客户端/服务器框架提供的服务:

rosservice args	    print service arguments	rosservice call	        call the service with the provided args  调用带参数的服务	rosservice find     	find services by service type 依据类型寻找服务	rosservice info	       print information about service	rosservice list			list active services   输出可用服务的信息	rosservice type	 	print service type  输出服务类型	rosservice uri			print service ROSRPC uri 输出服务的ROSRPC uri Type rosservice  -h for more detailed usage, e.g. 'rosservice call -h'

再生(spawn)

rosservice type spawn | rossrv show
rossrv is a command-line tool for displaying information about ROS Service types.Commands:	rossrv show	Show service description	rossrv list	List all services	rossrv md5	Display service md5sum	rossrv package	List services in a package	rossrv packages	List packages that contain servicesType rossrv  -h for more detailed usage
rosservice call spawn 2 2 0.2 ""

服务返回了新产生的乌龟的名字: name: turtle2

rosparam命令:

rosparam使得我们能够存储并操作ROS参数服务器(Parameter Server)上的数据。
参数服务器能够存储整型、浮点、布尔、字符串、字典和列表等数据类型。
rosparam使用YAML标记语言的语法。
一般而言,YAML的表述很自然:
1是整型
1.0是浮点型
one是字符串
true是布尔
[1,2,3]是整型列表
{a:b,c:d}是字典

rosparam is a command-line tool for getting, setting, and deleting parameters from the ROS Parameter Server.Commands:	rosparam set		set parameter	rosparam get		get parameter	rosparam load		load parameters from file    从文件读取参数 	rosparam dump		dump parameters to file 向文件中写入参数	rosparam delete		delete parameter	rosparam list		list parameter names

显示参数服务器上的所有内容:

rosparam get /
rosparam dump [file_name]rosparam load [file_name] [namespace]

例子:

rosparam dump params.yaml
rosparam load params.yaml copy
rosparam get copy/background_b


2019.03.13


命令: rqt_console,rqt_logger_level, roslaunch,launch.xml

rqt_console属于ROS日志框架(logging framework)的一部分,用来显示节点的输出信息

rqt_logger_level允许我们修改节点运行时输出信息的日志等级(logger levels)
logger levels包括 DEBUG、WARN、INFO和ERROR
日志等级说明:

FatalErrorWarnInfoDebug

Fatal是最高优先级,Debug是最低优先级。

通过设置日志等级你可以获取该等级及其以上优先等级的所有日志消息。

比如,将日志等级设为Warn时,你会得到Warn、Error和Fatal这三个等级的所有日志消息。

roslaunch命令:

roslaunch可以用来启动定义在launch文件中的多个节点。

roslaunch [package] [filename.launch]
Usage: roslaunch [options] [package] 
[arg_name:=value...] roslaunch [options]
[
...] [arg_name:=value...]If
is a single dash ('-'), launch XML is read from standard input.Options: -h, --help show this help message and exit --files Print list files loaded by launch file, including launch file itself --args=NODE_NAME Print command-line arguments for node --nodes Print list of node names in launch file --find-node=NODE_NAME Find launch file that node is defined in -c NAME, --child=NAME Run as child service 'NAME'. Required with -u --local Do not launch remote nodes --screen Force output of all local nodes to screen -u URI, --server_uri=URI URI of server. Required with -c --run_id=RUN_ID run_id of session. Required with -c --wait wait for master to start before launching -p PORT, --port=PORT master port. Only valid if master is launched --core Launch core services only --pid=PID_FN write the roslaunch pid to filename -v verbose printing --dump-params Dump parameters of all roslaunch files to stdout --skip-log-check skip check size of log folder --ros-args Display command-line arguments for this launch file --disable-title Disable setting of terminal title -w NUM_WORKERS, --numworkers=NUM_WORKERS override number of worker threads. Only valid for core services. -t TIMEOUT, --timeout=TIMEOUT override the socket connection timeout (in seconds). Only valid for core services.
1 
以launch标签开头以表明这是一个launch文件。 2 3
4
5
6 7
8
9
10 //创建了两个节点分组并以'命名空间(namespace)'标签来区分,其中一个名为turtulesim1,另一个名为turtlesim2,两个组里面都使用相同的turtlesim节点并命名为'sim'。这样可以让我们同时启动两个turtlesim模拟器而不会产生命名冲突。 11
12
13
14
15 启动模仿节点,并将所有话题的输入和输出分别重命名为turtlesim1和turtlesim2,这样就会使turtlesim2模仿turtlesim1。 16
launch文件的结束标签。

命令:rosed

rosed是rosbash 的一部分。

利用它可以直接通过package名来获取到待编辑的文件而无需指定该文件的存储路径了

rosed [package_name] [filename]

Edit a file within a package.

rosed默认的编辑器是vim。
如果想要将其他的编辑器设置成默认的,你需要修改你的 ~/.bashrc 文件,增加如下语句:

export EDITOR='emacs -nw'

创建ROS消息和服务:msg,srv,roscp,rosmake,CMakeLists.txt

介绍:

消息(msg): msg文件就是一个描述ROS中所使用消息类型的简单文本。它们会被用来生成不同语言的源代码。

服务(srv): 一个srv文件描述一项服务。它包含两个部分:请求和响应。

msg文件存放在package的msg目录下,srv文件则存放在srv目录下。

msg文件实际上就是每行声明一个数据类型和变量名。

msg可用的数据类型:

int8, int16, int32, int64 (plus uint*) float32, float64 string time, duration other msg files variable-length array[] and fixed-length array[C]

在ROS中有一个特殊的数据类型:Header,它含有时间戳和坐标系信息。

msg中:
Header header
string child_frame_id
geometry_msgs/PoseWithCovariance pose
geometry_msgs/TwistWithCovariance twist
srv文件分为请求和响应两部分,由’- - -'分隔:

int64 Aint64 B---int64 Sum

A和B是请求, 而Sum是响应。


创建msg:

echo “int64 num” > msg/Num.msg
在package.xml文件中添加:

message_generation
message_runtime

在构建的时候,我们只需要"message_generation"。

在运行的时候,我们只需要"message_runtime"。
在CMakeLists.txt文件中添加:

find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs message_generation)

设置运行依赖:

catkin_package(  ...  CATKIN_DEPENDS message_runtime ...  ...)

手动添加.msg文件

add_message_files(  FILES  Num.msg)

确保CMake知道在什么时候重新配置我们的project。

确保添加了如下代码:

generate_messages()增加Num.msg文件

generate_messages(DEPENDENCIES std_msgs)

确保msg文件被转换成为C++,Python和其他语言的源代码:

rosbuild_genmsg()

rosmsg show [message type]:

例如:rosmsg show Num


roscp是一个很实用的命令行工具,它实现了将文件从一个package复制到另外一个package的功能

roscp [package_name] [file_to_copy_path] [copy_path]

在CMakeLists.txt文件中增加了对message_generation的依赖:

find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs message_generation)

用你自己的srv文件名替换掉那些Service*.srv文件:

add_service_files(  FILES  AddTwoInts.srv)
rosbuild_gensrv()

查看服务:

rossrv show beginner_tutorials/AddTwoInts


msg和srv都需要的步骤

去掉注释并附加上所有你消息文件所依赖的那些含有.msg文件的package(这个例子是依赖std_msgs,不要添加roscpp,rospy),结果如下:
generate_messages(
DEPENDENCIES
std_msgs
)


rosbuild版本,由于增加了新的消息,所以我们需要重新编译我们的package:

$ rosmake beginner_tutorials

Usage: rosmake [options] [PACKAGE]...rosmake recursively builds all dependencies before building a packageOptions:  -h, --help            show this help message and exit  --test-only           only run tests  -t                    build and test packages  -a, --all             select all packages  -i, --mark-installed  On successful build, mark specified packages as                        installed with ROS_NOBUILD  -u, --unmark-installed                        Remove ROS_NOBUILD from the specified packages.  This                        will not build anything.  -v                    display errored builds  -r, -k, --robust      do not stop build on error  --build-everything    build all packages regardless of errors  -V                    display all builds  -s, --specified-only  only build packages specified on the command line  --buildtest=BUILDTEST                        package to buildtest  --buildtest1=BUILDTEST1                        package to buildtest1  --output=OUTPUT_DIR   where to output results  --pre-clean           run make clean first  --bootstrap           DEPRECATED, UNUSED  --disable-logging     turn off all logs  --target=TARGET       run make with this target  --pjobs=ROS_PARALLEL_JOBS                        Override ROS_PARALLEL_JOBS environment variable with                        this number of jobs.  --threads=THREADS     Build up to N packages in parallel  --profile             print time profile after build  --skip-blacklist      skip packages containing a file called                        ROS_BUILD_BLACKLIST (Default behavior will ignore the                        presence of ROS_BUILD_BLACKLIST)  --skip-blacklist-osx  deprecated option. it will do nothing, please use                        platform declarations and --require-platform instead  --status-rate=STATUS_UPDATE_RATE                        How fast to update the status bar in Hz.  Default: 5Hz

catkin版本,由于增加了新的消息,所以我们需要重新编译我们的package:

In your catkin workspace
$ cd …/…
$ catkin_make
$ cd -


所有在msg路径下的.msg文件都将转换为ROS所支持语言的源代码。

生成的C++头文件将会放置在~/catkin_ws/devel/include/beginner_tutorials/

Python脚本语言会在 ~/catkin_ws/devel/lib/python2.7/dist-packages/beginner_tutorials/msg目录下创建。

lisp文件会出现在~/catkin_ws/devel/share/common-lisp/ros/beginner_tutorials/msg/路径下.

详尽的消息格式请参考Message Description Language 页面.


编写消息发布器和订阅器:catkin,ROS代码解释

节点(Node)" 是ROS中指代连接到ROS网络的可执行文件的术语。

接下来,我们将会创建一个发布器节点(“talker”),它将不断的在ROS网络中广播消息。

转移到之前教程在catkin工作空间所创建的beginner_tutorials package路径下:
cd ~/catkin_ws/src/beginner_tutorials
ros代码讲解:
附链接:

测试消息发布器和订阅器:运行程序

链接https://www.ncnynl.com/archives/201608/511.html


编写简单的Service和Client (C++ catkin)

链接https://www.ncnynl.com/archives/201608/512.html

测试简单的Service和Client

链接:

录制与回放数据,rosbag

命令:

rostopic list -v
Published topics: * /turtle1/color_sensor [turtlesim/Color] 1 publisher * /turtle1/command_velocity [turtlesim/Velocity] 1 publisher * /rosout [roslib/Log] 2 publishers * /rosout_agg [roslib/Log] 1 publisher * /turtle1/pose [turtlesim/Pose] 1 publisherSubscribed topics: * /turtle1/command_velocity [turtlesim/Velocity] 1 subscriber * /rosout [roslib/Log] 1 subscriber

上面所发布话题部分列出的话题消息是唯一可以被录制保存到文件中的的话题消息,因为只有消息已经发布了才可以被录制。/turtle1/command_velocity话题是teleop_turtle节点所发布的命令消息并作为turtlesim节点的输入。

录制与回放命令主要有:

rosbag
Usage: rosbag 
[options] [args]A bag is a file format in ROS for storing ROS message data. The rosbag command can record, replay and manipulate bags.Available subcommands: check Determine whether a bag is playable in the current system, or if it can be migrated. compress Compress one or more bag files. decompress Decompress one or more bag files. filter Filter the contents of the bag. fix Repair the messages in a bag file so that it can be played in the current system. help info Summarize the contents of one or more bag files. play Play back the contents of one or more bag files in a time-synchronized fashion. record Record a bag file with the contents of specified topics. reindex Reindexes one or more bag files.For additional information, see http://wiki.ros.org/rosbag

mkdir ~/bagfilescd ~/bagfilesrosbag record -a

在这里我们先建立一个用于录制的临时目录,然后在该目录下运行rosbag record命令,并附加-a选项,该选项表示将当前发布的所有话题数据都录制保存到一个bag文件中。


在刚刚创建的bagfiles文件目录下,查看bag内容

rosbag info 文件名字

回放消息:

rosbag play 

默认模式下,rosbag play命令在公告每条消息后会等待一小段时间(0.2秒)后才真正开始发布bag文件中的内容

两倍速回放消息:

rosbag play -r 2 

录制特定话题数据

rosbag record -O subset /turtle1/command_velocity /turtle1/pose

上述命令中的-O参数告诉rosbag record将数据记录保存到名为subset.bag的文件中,同时后面的话题参数告诉rosbag record只能录制这两个指定的话题。

局限性
问题:turtle的路径可能并没有完全地映射到原先通过键盘控制时产生的路径上——整体形状应该是差不多的,但没有完全一样。

原因是turtlesim的移动路径对系统定时精度的变化非常敏感。

rosbag受制于其本身的性能无法完全复制录制时的系统运行行为。


检查roswtf

1.安装检查 :roswtf 可以检查你的ROS系统并尝试发现问题

roscdroswtf

2.运行检查:在有ROS节点运行时

roscoreroswtf

3.错误报告:

roswtf会对一些系统中看起来异常但可能是正常的运行情况发出警告。也会对确实有问题的情况报告错误。


2019.03.14


ros学习进一步计划

模拟器

RVIZ
TF
MOVEIT
NAVIGATION

管理系统依赖项:rosdep

ROS packages有时会需要操作系统提供一些外部函数库,这些函数库就是所谓的“系统依赖项”。

ROS提供了一个工具rosdep来下载并安装所需系统依赖项。
ROS packages必须在配置文件中声明他们需要哪些系统依赖项。
rosdep 是一个能够下载并安装ROS packages所需要的系统依赖项的小工具

Usage: rosdep [options]  
Commands:rosdep check
... check if the dependencies of package(s) have been met.rosdep install
... generate a bash script and then execute it.rosdep db generate the dependency database and print it to the console.rosdep init initialize rosdep sources in /etc/ros/rosdep. May require sudo.rosdep keys
... list the rosdep keys that the packages depend on.rosdep resolve
resolve
to system dependenciesrosdep update update the local rosdep database based on the rosdep sources.rosdep what-needs
... print a list of packages that declare a rosdep on (at least one of)
rosdep where-defined
... print a list of yaml files that declare a rosdep on (at least one of)
rosdep fix-permissions Recursively change the permissions of the user's ros home directory. May require sudo. Can be useful to fix permissions after calling "rosdep update" with sudo accidentally.

例如:

rosdep install packages
意思:generate a bash script and then execute it.
rosdep install turtlesim


Roslaunch在项目中的使用技巧

链接:

ROS在多机器人上的使用

展示如何在两台机器上使用ROS系统,详述了使用ROS_MASTER_URI来配置多台机器使用同一个master。

自定义消息CATKIN方式

转载地址:https://blog.csdn.net/answerMack/article/details/88539610 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:kinova机械臂GEN3的Ros操作开发教程
下一篇:ubuntu16.04下利用ROS启动LPMS-CURS、CURS2等型号IMU;用imu控制turtlesim--教程

发表评论

最新留言

逛到本站,mark一下
[***.202.152.39]2024年03月30日 14时04分42秒