1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
| Study note for ROS * Core Concept ** Node and ROS Master *** Node implement functions for purposes support various language can have thousands of nodes *** ROS Master mange the registion and name of various nodes support(trace and record) communication between different nodes for nodes to find each other provide parameter server(store global variables...)[[about parameter]] ** Communication between nodes | | Topic | Service | |--------------------+---------------------+----------------| | sync | n | y | | model | publish/subscribe | service/client | | protocol | ROSTCP/ROSUDP | ROSTCP/ROSUDP | | response | n | y | | buffer | y | n | | real-time | weak | strong | | nodes relationship | multi/one to multi | one to multi | | scene | data transformation | logic process | *** Topic Node(publisher)->Topic(/example)&Message_Tyoe(std_msgs/String)->other ROS nodes(subscriber) Message: define the data type and struct of data, defined by .msg file async *** Service C/S model(Client/Server) client send requests, server return response data defined by .srv file, defines the structure of the requests and response ROS node(Service Server) ^ |response request| v ROS node(Service Client) sync ** Parameter <<about parameter>> talker -> ROS master : setParam("foo",1) listener -> ROS master: getParam("foo") ROS master ->listener: {"foo",1}
multiple variable dictionary for storing static nonbinary configuration, not suitable for dynamic ** File system *** package Basic unit in ROS, include the src of nodes, cfg, data def *** package manifest record the basic information of packages *** Meta packages orgnize multi packages for one common purpose * Commond Line Tools ** rqt_graph visualize tool display the calculate process graph ** rosnode display node information *** rosnode list list all node default node /rosout *** rosnode info /turtle_sim show info of a node ** rostopic usage like rosnode(list,info) *** rostopic pub /../.. data_structure data publish message as a topic add -r num to repeat sending at rate num/s ** rosmsg *** rosmsg show data_structure show the data structure ** rosservice | commond addition | | |------------------------+-----------------------------------| | list | list all service the node provide | | call service_name data | | ** rosbag | command addition | | | | |-------------------------+-----------------------------------------------+--------+-----------------| | record -a -O cmd_record | record the topic data in the system | -a:all | -O as a package | | play cmd_record.bag | play the recorded data of previous simulation | | | | | | | | * setup workspace and function package ** workspace *** overview | src | source space | | | build | build space | no need to touch | | devel | develop space | script, executable file | | install | install sapce | |
work space folder/ src/ CmakeLists.txt package_1/ CmakeList.txt package.xml ... package_n/ CmakeList.txt package.xml ... build/ CATKIN_IGNORE devel/ bin/ etc/ include/ lib/ share/ .catkin env.bash setup.bash setup.sh ... install/ bin/ etc/ include/ lib/ share/ .catkin env.bash setup.bash setup.sh ... *** setup **** establish ws mkdir -p ./catkin_ws/src cd ./catkin_ws/src catkin_init_workspace **** compile ws cd ./catkin_ws/ catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3 catkin_make install **** set env variables source devel/setup.bash **** check env variables echo $ROS_PACKAGE_PATHH ** fucntion package *** setup | establish package | cd ./src | | | | catkin_create_pkg <pkg_name> [depend1] [depend2].. (rospy,roscpp,std_msgs) | | | source env path | source devel/setup.bash | make sure that ros can detect the pkg |
*** package.xml | label | description | |------------------------------+-----------------------------------------------------| | <name> | | | <version> | | | <description> | | | <maintainer email=""> | maintainer's name and email | | <license> | | | <buildtool depend> | usually catkin | | <build_depend>/<exec_depend> | package dependencies ,usually roscpp rospy std_msgs | *** CmakeList.txt TODO
|