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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章