Halo
发布于 2024-04-24 / 93 阅读 / 0 评论 / 0 点赞

ros常见命令和功能

roscore

roscore is a collection of nodes and programs that are pre-requisites of a ROS-based system. You must have a roscore running in order for ROS nodes to communicate. It is launched using the roscore command.

NOTE: If you use roslaunch, it will automatically start roscore if it detects that it is not already running (unless the --wait argument is supplied).

roscore will start up:

  • ROS Master
  • a ROS Parameter Server
  • a rosout logging node

common use(random port)

roscore

design port

export ROS_MASTER_URI=http://YourPC:1234/
roscore -p 1234

roslaunch

启动ROS节点,可以是多个

roslaunch [package] [filename.launch]
<launch>

  <group ns="turtlesim1">
    <node pkg="turtlesim" name="sim" type="turtlesim_node"/>
  </group>

  <group ns="turtlesim2">
    <node pkg="turtlesim" name="sim" type="turtlesim_node"/>
  </group>

  <node pkg="turtlesim" name="mimic" type="mimic">
    <remap from="input" to="turtlesim1/turtle1"/>
    <remap from="output" to="turtlesim2/turtle1"/>
  </node>

</launch>

在这里我们启动模仿节点,并将所有话题的输入和输出分别重命名为turtlesim1和turtlesim2,这样就会使turtlesim2模仿turtlesim1。

rosrun

启动一个节点,多个节点需要多次运行

rosrun [package_name] [node_name]

rosnode

ros的节点信息

rosnode list             显示了正在运行的ros的节点
rosnode info /node-name  显示指定节点信息
rosnode ping node-name   ping节点

rosservice

rosservice list  输出可用服务的信息
rosservice call  调用带参数的服务
rosservice type  输出服务类型
rosservice find  依据类型寻找服务find services by service type
rosservice uri   输出服务的ROSRPC uri

rosparam

rosparam set     设置参数
rosparam get     获取参数
rosparam load    从文件读取参数
rosparam dump    向文件中写入参数
rosparam delete  删除参数
rosparam list    列出参数名

rosbag

rosbag record      用指定的话题录制一个 bag 包
rosbag info        显示一个 bag 包的基本信息,比如包含哪些话题
rosbag play        回放一个或者多个 bag 包
rosbag check       检查一个 bag 包在当前的系统中是否可以回放和迁移
rosbag compress    压缩一个或多个 bag 包
rosbag decompress  解压缩一个或多个 bag 包
rosbag reindex     重新索引一个或多个损坏 bag 包

rostopic

rostopic bw     display bandwidth used by topic
rostopic delay  display delay for topic which has 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   print information about active topics
rostopic pub    publish data to topic
rostopic type   print topic type

评论