ROS学习笔记

官网教程:http://wiki.ros.org/cn/ROS/Tutorials

文件系统工具介绍

  • rospack
    rospack find [包名称]
    rospack depends1 [包名称](查看一级依赖关系)

  • roscd
    roscd [包名称]
    roscd log(进入日志目录)

  • rosls
    rosls [包名称]

  • rosed(编辑文件)
    rosed [包名] [文件名]

  • roscp
    roscp [包名] [文件名] [目的路径]

  • rosmsg

  • rossrv

创建工作空间

  • 创建目录并初始化
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace
  • 编译(即使为空,也可编译)
$ cd ~/catkin_ws/
$ catkin_make
  • 设置环境变量
$ source devel/setup.bash
  • 查看环境变量
$ echo $ROS_PACKAGE_PATH

创建程序包

  • catkin_create_pkg命令 e.g.
$ cd ~/catkin_ws/src
$ catkin_create_pkg beginner_tutorials std_msgs rospy roscpp
# catkin_create_pkg <package_name> [depend1] [depend2] [depend3]

编译程序包

  • 进入catkin_ws目录编译
$ cd ~/catkin_ws/
$ catkin_make

ROS节点

  • roscore
    运行所有ROS程序前首先要运行的命令
  • rosnode
    rosnode list;
    rosnode info [节点名];
    rosnode ping [节点名];
    rosnode cleanup;
  • rosrun
    rosrun [包名] [节点名]

  • roslaunch 启动多个节点
    roslaunch [package] [filename.launch]

ROS话题

  • rostopic
pi@raspberrypi:~ $ rostopic -h
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 type

Type rostopic <command> -h for more detailed usage, e.g. 'rostopic echo -h'

ROS服务和参数

  • rosservice
pi@raspberrypi:~ $ rosservice -h
Commands:
    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

Type rosservice <command> -h for more detailed usage, e.g. 'rosservice call -h'
  • rosparam
pi@raspberrypi:~ $ rosparam -h
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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值