├── .gitignore ├── LICENSE ├── README.md ├── empty_ros_pkg ├── CMakeLists.txt └── package.xml ├── my_first_ros_pkg ├── CMakeLists.txt ├── package.xml └── src │ └── hello_world_node.cpp ├── ros_tutorials_action ├── CMakeLists.txt ├── action │ └── Fibonacci.action ├── package.xml └── src │ ├── action_client.cpp │ └── action_server.cpp ├── ros_tutorials_parameter ├── CMakeLists.txt ├── package.xml ├── src │ ├── service_client.cpp │ └── service_server.cpp └── srv │ └── SrvTutorial.srv ├── ros_tutorials_service ├── CMakeLists.txt ├── package.xml ├── src │ ├── service_client.cpp │ └── service_server.cpp └── srv │ └── SrvTutorial.srv ├── ros_tutorials_topic ├── CMakeLists.txt ├── launch │ └── union.launch ├── msg │ └── MsgTutorial.msg ├── package.xml └── src │ ├── topic_publisher.cpp │ └── topic_subscriber.cpp └── testbot_description ├── CMakeLists.txt ├── launch └── testbot.launch ├── package.xml └── urdf └── testbot.urdf /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ros_tutorials 2 | ROS Tutorials for beginner 3 | -------------------------------------------------------------------------------- /empty_ros_pkg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(empty_ros_pkg) 3 | 4 | ## Find catkin macros and libraries 5 | ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) 6 | ## is used, also find other catkin packages 7 | find_package(catkin REQUIRED COMPONENTS 8 | roscpp 9 | std_msgs 10 | ) 11 | 12 | ## System dependencies are found with CMake's conventions 13 | # find_package(Boost REQUIRED COMPONENTS system) 14 | 15 | 16 | ## Uncomment this if the package has a setup.py. This macro ensures 17 | ## modules and global scripts declared therein get installed 18 | ## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html 19 | # catkin_python_setup() 20 | 21 | ################################################ 22 | ## Declare ROS messages, services and actions ## 23 | ################################################ 24 | 25 | ## To declare and build messages, services or actions from within this 26 | ## package, follow these steps: 27 | ## * Let MSG_DEP_SET be the set of packages whose message types you use in 28 | ## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). 29 | ## * In the file package.xml: 30 | ## * add a build_depend tag for "message_generation" 31 | ## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET 32 | ## * If MSG_DEP_SET isn't empty the following dependency has been pulled in 33 | ## but can be declared for certainty nonetheless: 34 | ## * add a run_depend tag for "message_runtime" 35 | ## * In this file (CMakeLists.txt): 36 | ## * add "message_generation" and every package in MSG_DEP_SET to 37 | ## find_package(catkin REQUIRED COMPONENTS ...) 38 | ## * add "message_runtime" and every package in MSG_DEP_SET to 39 | ## catkin_package(CATKIN_DEPENDS ...) 40 | ## * uncomment the add_*_files sections below as needed 41 | ## and list every .msg/.srv/.action file to be processed 42 | ## * uncomment the generate_messages entry below 43 | ## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) 44 | 45 | ## Generate messages in the 'msg' folder 46 | # add_message_files( 47 | # FILES 48 | # Message1.msg 49 | # Message2.msg 50 | # ) 51 | 52 | ## Generate services in the 'srv' folder 53 | # add_service_files( 54 | # FILES 55 | # Service1.srv 56 | # Service2.srv 57 | # ) 58 | 59 | ## Generate actions in the 'action' folder 60 | # add_action_files( 61 | # FILES 62 | # Action1.action 63 | # Action2.action 64 | # ) 65 | 66 | ## Generate added messages and services with any dependencies listed here 67 | # generate_messages( 68 | # DEPENDENCIES 69 | # std_msgs 70 | # ) 71 | 72 | ################################################ 73 | ## Declare ROS dynamic reconfigure parameters ## 74 | ################################################ 75 | 76 | ## To declare and build dynamic reconfigure parameters within this 77 | ## package, follow these steps: 78 | ## * In the file package.xml: 79 | ## * add a build_depend and a run_depend tag for "dynamic_reconfigure" 80 | ## * In this file (CMakeLists.txt): 81 | ## * add "dynamic_reconfigure" to 82 | ## find_package(catkin REQUIRED COMPONENTS ...) 83 | ## * uncomment the "generate_dynamic_reconfigure_options" section below 84 | ## and list every .cfg file to be processed 85 | 86 | ## Generate dynamic reconfigure parameters in the 'cfg' folder 87 | # generate_dynamic_reconfigure_options( 88 | # cfg/DynReconf1.cfg 89 | # cfg/DynReconf2.cfg 90 | # ) 91 | 92 | ################################### 93 | ## catkin specific configuration ## 94 | ################################### 95 | ## The catkin_package macro generates cmake config files for your package 96 | ## Declare things to be passed to dependent projects 97 | ## INCLUDE_DIRS: uncomment this if you package contains header files 98 | ## LIBRARIES: libraries you create in this project that dependent projects also need 99 | ## CATKIN_DEPENDS: catkin_packages dependent projects also need 100 | ## DEPENDS: system dependencies of this project that dependent projects also need 101 | catkin_package( 102 | # INCLUDE_DIRS include 103 | # LIBRARIES empty_ros_pkg 104 | # CATKIN_DEPENDS roscpp std_msgs 105 | # DEPENDS system_lib 106 | ) 107 | 108 | ########### 109 | ## Build ## 110 | ########### 111 | 112 | ## Specify additional locations of header files 113 | ## Your package locations should be listed before other locations 114 | # include_directories(include) 115 | include_directories( 116 | ${catkin_INCLUDE_DIRS} 117 | ) 118 | 119 | ## Declare a C++ library 120 | # add_library(empty_ros_pkg 121 | # src/${PROJECT_NAME}/empty_ros_pkg.cpp 122 | # ) 123 | 124 | ## Add cmake target dependencies of the library 125 | ## as an example, code may need to be generated before libraries 126 | ## either from message generation or dynamic reconfigure 127 | # add_dependencies(empty_ros_pkg ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 128 | 129 | ## Declare a C++ executable 130 | # add_executable(empty_ros_pkg_node src/empty_ros_pkg_node.cpp) 131 | 132 | ## Add cmake target dependencies of the executable 133 | ## same as for the library above 134 | # add_dependencies(empty_ros_pkg_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 135 | 136 | ## Specify libraries to link a library or executable target against 137 | # target_link_libraries(empty_ros_pkg_node 138 | # ${catkin_LIBRARIES} 139 | # ) 140 | 141 | ############# 142 | ## Install ## 143 | ############# 144 | 145 | # all install targets should use catkin DESTINATION variables 146 | # See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html 147 | 148 | ## Mark executable scripts (Python etc.) for installation 149 | ## in contrast to setup.py, you can choose the destination 150 | # install(PROGRAMS 151 | # scripts/my_python_script 152 | # DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 153 | # ) 154 | 155 | ## Mark executables and/or libraries for installation 156 | # install(TARGETS empty_ros_pkg empty_ros_pkg_node 157 | # ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 158 | # LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 159 | # RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 160 | # ) 161 | 162 | ## Mark cpp header files for installation 163 | # install(DIRECTORY include/${PROJECT_NAME}/ 164 | # DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} 165 | # FILES_MATCHING PATTERN "*.h" 166 | # PATTERN ".svn" EXCLUDE 167 | # ) 168 | 169 | ## Mark other files for installation (e.g. launch and bag files, etc.) 170 | # install(FILES 171 | # # myfile1 172 | # # myfile2 173 | # DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 174 | # ) 175 | 176 | ############# 177 | ## Testing ## 178 | ############# 179 | 180 | ## Add gtest based cpp test target and link libraries 181 | # catkin_add_gtest(${PROJECT_NAME}-test test/test_empty_ros_pkg.cpp) 182 | # if(TARGET ${PROJECT_NAME}-test) 183 | # target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) 184 | # endif() 185 | 186 | ## Add folders to be run by python nosetests 187 | # catkin_add_nosetests(test) 188 | -------------------------------------------------------------------------------- /empty_ros_pkg/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | empty_ros_pkg 4 | 0.0.0 5 | The empty_ros_pkg package 6 | 7 | 8 | 9 | 10 | pyo 11 | 12 | 13 | 14 | 15 | 16 | TODO 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 | catkin 43 | roscpp 44 | std_msgs 45 | roscpp 46 | std_msgs 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /my_first_ros_pkg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(my_first_ros_pkg) 3 | find_package(catkin REQUIRED COMPONENTS roscpp std_msgs) 4 | catkin_package(CATKIN_DEPENDS roscpp std_msgs) 5 | include_directories(${catkin_INCLUDE_DIRS}) 6 | add_executable(hello_world_node src/hello_world_node.cpp) 7 | target_link_libraries(hello_world_node ${catkin_LIBRARIES}) 8 | -------------------------------------------------------------------------------- /my_first_ros_pkg/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | my_first_ros_pkg 4 | 0.0.1 5 | The my_first_ros_pkg package 6 | Apache License 2.0 7 | Yoonseok Pyo 8 | Yoonseok Pyo 9 | https://github.com/ROBOTIS-GIT/ros_tutorials/issues 10 | https://github.com/ROBOTIS-GIT/ros_tutorials.git 11 | http://www.robotis.com 12 | catkin 13 | std_msgs 14 | roscpp 15 | std_msgs 16 | roscpp 17 | 18 | 19 | -------------------------------------------------------------------------------- /my_first_ros_pkg/src/hello_world_node.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char **argv) 6 | { 7 | ros::init(argc, argv, "hello_world_node"); 8 | ros::NodeHandle nh; 9 | ros::Publisher chatter_pub = nh.advertise("say_hello_world", 1000); 10 | ros::Rate loop_rate(10); 11 | int count = 0; 12 | 13 | while (ros::ok()) 14 | { 15 | std_msgs::String msg; 16 | std::stringstream ss; 17 | ss << "hello world!" << count; 18 | msg.data = ss.str(); 19 | ROS_INFO("%s", msg.data.c_str()); 20 | chatter_pub.publish(msg); 21 | ros::spinOnce(); 22 | loop_rate.sleep(); 23 | ++count; 24 | } 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /ros_tutorials_action/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(ros_tutorials_action) 3 | 4 | find_package(catkin REQUIRED COMPONENTS 5 | message_generation 6 | std_msgs 7 | actionlib_msgs 8 | actionlib 9 | roscpp 10 | ) 11 | 12 | find_package(Boost REQUIRED COMPONENTS system) 13 | 14 | add_action_files(FILES Fibonacci.action) 15 | generate_messages(DEPENDENCIES actionlib_msgs std_msgs) 16 | 17 | catkin_package( 18 | LIBRARIES ros_tutorials_action 19 | CATKIN_DEPENDS std_msgs actionlib_msgs actionlib roscpp 20 | DEPENDS Boost 21 | ) 22 | 23 | include_directories(${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}) 24 | 25 | add_executable(action_server src/action_server.cpp) 26 | add_dependencies(action_server ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 27 | target_link_libraries(action_server ${catkin_LIBRARIES}) 28 | 29 | add_executable(action_client src/action_client.cpp) 30 | add_dependencies(action_client ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 31 | target_link_libraries(action_client ${catkin_LIBRARIES}) 32 | -------------------------------------------------------------------------------- /ros_tutorials_action/action/Fibonacci.action: -------------------------------------------------------------------------------- 1 | #goal definition 2 | int32 order 3 | --- 4 | #result definition 5 | int32[] sequence 6 | --- 7 | #feedback 8 | int32[] sequence 9 | -------------------------------------------------------------------------------- /ros_tutorials_action/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ros_tutorials_action 4 | 0.1.0 5 | ROS turtorial package to learn the action 6 | BSD 7 | Melonee Wise 8 | Yoonseok Pyo 9 | https://github.com/ROBOTIS-GIT/ros_tutorials/issues 10 | https://github.com/ROBOTIS-GIT/ros_tutorials.git 11 | http://www.robotis.com 12 | catkin 13 | roscpp 14 | actionlib 15 | message_generation 16 | std_msgs 17 | actionlib_msgs 18 | roscpp 19 | actionlib 20 | std_msgs 21 | actionlib_msgs 22 | message_runtime 23 | 24 | 25 | -------------------------------------------------------------------------------- /ros_tutorials_action/src/action_client.cpp: -------------------------------------------------------------------------------- 1 | #include // ROS Default Header File 2 | #include // action Library Header File 3 | #include // Action Goal Status Header File 4 | #include // FibonacciAction Action File Header 5 | 6 | int main (int argc, char **argv) // Node Main Function 7 | { 8 | ros::init(argc, argv, "action_client"); // Node Name Initialization 9 | 10 | // Action Client Declaration (Action Name: ros_tutorial_action) 11 | actionlib::SimpleActionClient ac("ros_tutorial_action", true); 12 | 13 | ROS_INFO("Waiting for action server to start."); 14 | ac.waitForServer(); //wait for the action server to start, will wait for infinite time 15 | 16 | ROS_INFO("Action server started, sending goal."); 17 | ros_tutorials_action::FibonacciGoal goal; // Declare Action Goal 18 | goal.order = 20; // Set Action Goal (Process the Fibonacci sequence 20 times) 19 | ac.sendGoal(goal); // Transmit Action Goal 20 | 21 | // Set action time limit (set to 30 seconds) 22 | bool finished_before_timeout = ac.waitForResult(ros::Duration(30.0)); 23 | 24 | // Process when action results are received within the time limit for achieving the action goal 25 | if (finished_before_timeout) 26 | { 27 | // Receive action target status value and display on screen 28 | actionlib::SimpleClientGoalState state = ac.getState(); 29 | ROS_INFO("Action finished: %s",state.toString().c_str()); 30 | } 31 | else 32 | ROS_INFO("Action did not finish before the time out."); 33 | 34 | //exit 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /ros_tutorials_action/src/action_server.cpp: -------------------------------------------------------------------------------- 1 | #include // ROS Default Header File 2 | #include // action Library Header File 3 | #include // FibonacciAction Action File Header 4 | 5 | class FibonacciAction 6 | { 7 | protected: 8 | 9 | ros::NodeHandle nh_; // Node handle declaration 10 | actionlib::SimpleActionServer as_; // Action server declaration, NodeHandle instance must be created before this line. Otherwise strange error occurs. 11 | std::string action_name_; // Use as action name 12 | // Create messages that are used to published feedback/result 13 | ros_tutorials_action::FibonacciFeedback feedback_; 14 | ros_tutorials_action::FibonacciResult result_; 15 | 16 | public: 17 | // Initialize action server (Node handle, action name, action callback function) 18 | FibonacciAction(std::string name) : 19 | as_(nh_, name, boost::bind(&FibonacciAction::executeCB, this, _1), false), 20 | action_name_(name) 21 | { 22 | as_.start(); 23 | } 24 | 25 | ~FibonacciAction(void) 26 | { 27 | } 28 | 29 | // A function that receives an action goal message and performs a specified 30 | // action (in this example, a Fibonacci calculation). 31 | void executeCB(const ros_tutorials_action::FibonacciGoalConstPtr &goal) 32 | { 33 | ros::Rate r(1); // Loop Rate: 1Hz 34 | bool success = true; // Used as a variable to store the success or failure of an action 35 | 36 | // Setting Fibonacci sequence initialization, 37 | // add first (0) and second message (1) of feedback. 38 | feedback_.sequence.clear(); 39 | feedback_.sequence.push_back(0); 40 | feedback_.sequence.push_back(1); 41 | 42 | // Notify the user of action name, goal, initial two values of Fibonacci sequence 43 | ROS_INFO("%s: Executing, creating fibonacci sequence of order %i with seeds %i, %i", action_name_.c_str(), goal->order, feedback_.sequence[0], feedback_.sequence[1]); 44 | 45 | // Action contents 46 | for(int i=1; i<=goal->order; i++) 47 | { 48 | // Confirm action cancellation from action client 49 | if (as_.isPreemptRequested() || !ros::ok()) 50 | { 51 | // Notify action cancellation 52 | ROS_INFO("%s: Preempted", action_name_.c_str()); 53 | // Action cancellation and consider action as failure and save to variable 54 | as_.setPreempted(); 55 | success = false; 56 | break; 57 | } 58 | // Store the sum of current Fibonacci number and the previous number in the feedback 59 | // while there is no action cancellation or the action target value is reached. 60 | feedback_.sequence.push_back(feedback_.sequence[i] + feedback_.sequence[i-1]); 61 | // publish the feedback 62 | as_.publishFeedback(feedback_); 63 | // this sleep is not necessary, the sequence is computed at 1 Hz for demonstration purposes 64 | r.sleep(); 65 | } 66 | 67 | // If the action target value is reached, 68 | // transmit current Fibonacci sequence as the result value. 69 | if(success) 70 | { 71 | result_.sequence = feedback_.sequence; 72 | ROS_INFO("%s: Succeeded", action_name_.c_str()); 73 | // set the action state to succeeded 74 | as_.setSucceeded(result_); 75 | } 76 | } 77 | 78 | 79 | }; 80 | 81 | int main(int argc, char** argv) // Node Main Function 82 | { 83 | ros::init(argc, argv, "action_server"); // Initializes Node Name 84 | FibonacciAction fibonacci("ros_tutorial_action"); // Fibonacci Declaration (Action Name: ros_tutorial_action) 85 | ros::spin(); // Wait to receive action goal 86 | return 0; 87 | } 88 | -------------------------------------------------------------------------------- /ros_tutorials_parameter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(ros_tutorials_parameter) 3 | 4 | find_package(catkin REQUIRED COMPONENTS message_generation std_msgs roscpp) 5 | 6 | add_service_files(FILES SrvTutorial.srv) 7 | generate_messages(DEPENDENCIES std_msgs) 8 | 9 | catkin_package( 10 | LIBRARIES ros_tutorials_parameter 11 | CATKIN_DEPENDS std_msgs roscpp 12 | ) 13 | 14 | include_directories(${catkin_INCLUDE_DIRS}) 15 | 16 | add_executable(service_server_with_parameter src/service_server.cpp) 17 | add_dependencies(service_server_with_parameter ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 18 | target_link_libraries(service_server_with_parameter ${catkin_LIBRARIES}) 19 | 20 | add_executable(service_client_with_parameter src/service_client.cpp) 21 | add_dependencies(service_client_with_parameter ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 22 | target_link_libraries(service_client_with_parameter ${catkin_LIBRARIES}) 23 | -------------------------------------------------------------------------------- /ros_tutorials_parameter/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ros_tutorials_parameter 4 | 0.1.0 5 | ROS turtorial package to learn the parameter 6 | Apache License 2.0 7 | Yoonseok Pyo 8 | Yoonseok Pyo 9 | https://github.com/ROBOTIS-GIT/ros_tutorials/issues 10 | https://github.com/ROBOTIS-GIT/ros_tutorials.git 11 | http://www.robotis.com 12 | catkin 13 | roscpp 14 | std_msgs 15 | message_generation 16 | roscpp 17 | std_msgs 18 | message_runtime 19 | 20 | 21 | -------------------------------------------------------------------------------- /ros_tutorials_parameter/src/service_client.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" // ROS Default Header File 2 | #include "ros_tutorials_service/SrvTutorial.h"// SrvTutorial Service File Header (Automatically created after build) 3 | #include // Library for using the "atoll" function 4 | 5 | int main(int argc, char **argv) // Node Main Function 6 | { 7 | ros::init(argc, argv, "service_client"); // Initializes Node Name 8 | 9 | if (argc != 3) // Input value error handling 10 | { 11 | ROS_INFO("cmd : rosrun ros_tutorials_service service_client arg0 arg1"); 12 | ROS_INFO("arg0: double number, arg1: double number"); 13 | return 1; 14 | } 15 | 16 | ros::NodeHandle nh; // Node handle declaration for communication with ROS system 17 | 18 | // Declares service client 'ros_tutorials_service_client' 19 | // using the 'SrvTutorial' service file in the 'ros_tutorials_service' package. 20 | // The service name is 'ros_tutorial_srv' 21 | ros::ServiceClient ros_tutorials_service_client = nh.serviceClient("ros_tutorial_srv"); 22 | 23 | // Declares the 'srv' service that uses the 'SrvTutorial' service file 24 | ros_tutorials_service::SrvTutorial srv; 25 | 26 | // Parameters entered when the node is executed as a service request value are stored at 'a' and 'b' 27 | srv.request.a = atoll(argv[1]); 28 | srv.request.b = atoll(argv[2]); 29 | 30 | // Request the service. If the request is accepted, display the response value 31 | if (ros_tutorials_service_client.call(srv)) 32 | { 33 | ROS_INFO("send srv, srv.Request.a and b: %ld, %ld", (long int)srv.request.a, (long int)srv.request.b); 34 | ROS_INFO("receive srv, srv.Response.result: %ld", (long int)srv.response.result); 35 | } 36 | else 37 | { 38 | ROS_ERROR("Failed to call service ros_tutorial_srv"); 39 | return 1; 40 | } 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /ros_tutorials_parameter/src/service_server.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" // ROS Default Header File 2 | #include "ros_tutorials_parameter/SrvTutorial.h"// action Library Header File 3 | 4 | #define PLUS 1 // Addition 5 | #define MINUS 2 // Subtraction 6 | #define MULTIPLICATION 3 // Multiplication 7 | #define DIVISION 4 // Division 8 | 9 | int g_operator = PLUS; 10 | 11 | // The process below is performed if there is a service request 12 | // The service request is declared as 'req', and the service response is declared as 'res' 13 | bool calculation(ros_tutorials_parameter::SrvTutorial::Request &req, 14 | ros_tutorials_parameter::SrvTutorial::Response &res) 15 | { 16 | // The operator will be selected according to the parameter value and calculate 'a' and 'b', 17 | // which were received upon the service request. 18 | // The result is stored as the Response value. 19 | switch(g_operator) 20 | { 21 | case PLUS: 22 | res.result = req.a + req.b; break; 23 | case MINUS: 24 | res.result = req.a - req.b; break; 25 | case MULTIPLICATION: 26 | res.result = req.a * req.b; break; 27 | case DIVISION: 28 | if(req.b == 0) 29 | { 30 | res.result = 0; break; 31 | } 32 | else 33 | { 34 | res.result = req.a / req.b; break; 35 | } 36 | default: 37 | res.result = req.a + req.b; break; 38 | } 39 | 40 | // Displays the values of 'a' and 'b' used in the service request, and the 'result' value 41 | // corresponding to the service response. 42 | ROS_INFO("request: x=%ld, y=%ld", (long int)req.a, (long int)req.b); 43 | ROS_INFO("sending back response: [%ld]", (long int)res.result); 44 | 45 | return true; 46 | } 47 | 48 | int main(int argc, char **argv) // Node Main Function 49 | { 50 | ros::init(argc, argv, "service_server"); // Initializes Node Name 51 | ros::NodeHandle nh; // Node handle declaration 52 | 53 | nh.setParam("calculation_method", PLUS); // Reset Parameter Settings 54 | 55 | // Declare service server 'service_server' using the 'SrvTutorial' service file 56 | // in the 'ros_tutorials_service' package. The service name is 'ros_tutorial_srv' and 57 | // it is set to execute a 'calculation' function when a service is requested. 58 | ros::ServiceServer ros_tutorials_service_server = nh.advertiseService("ros_tutorial_srv", calculation); 59 | 60 | ROS_INFO("ready srv server!"); 61 | 62 | ros::Rate r(10); // 10 hz 63 | 64 | while (ros::ok()) 65 | { 66 | nh.getParam("calculation_method", g_operator); // Select the operator according to the value received from the parameter. 67 | ros::spinOnce(); // Callback function process routine 68 | r.sleep(); // Sleep for routine iteration 69 | } 70 | 71 | return 0; 72 | } 73 | -------------------------------------------------------------------------------- /ros_tutorials_parameter/srv/SrvTutorial.srv: -------------------------------------------------------------------------------- 1 | int64 a 2 | int64 b 3 | --- 4 | int64 result 5 | -------------------------------------------------------------------------------- /ros_tutorials_service/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(ros_tutorials_service) 3 | 4 | find_package(catkin REQUIRED COMPONENTS message_generation std_msgs roscpp) 5 | 6 | add_service_files(FILES SrvTutorial.srv) 7 | generate_messages(DEPENDENCIES std_msgs) 8 | 9 | catkin_package( 10 | LIBRARIES ros_tutorials_service 11 | CATKIN_DEPENDS std_msgs roscpp 12 | ) 13 | 14 | include_directories(${catkin_INCLUDE_DIRS}) 15 | 16 | add_executable(service_server src/service_server.cpp) 17 | add_dependencies(service_server ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 18 | target_link_libraries(service_server ${catkin_LIBRARIES}) 19 | 20 | add_executable(service_client src/service_client.cpp) 21 | add_dependencies(service_client ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 22 | target_link_libraries(service_client ${catkin_LIBRARIES}) 23 | -------------------------------------------------------------------------------- /ros_tutorials_service/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ros_tutorials_service 4 | 0.1.0 5 | ROS turtorial package to learn the service 6 | Apache License 2.0 7 | Yoonseok Pyo 8 | Yoonseok Pyo 9 | https://github.com/ROBOTIS-GIT/ros_tutorials/issues 10 | https://github.com/ROBOTIS-GIT/ros_tutorials.git 11 | http://www.robotis.com 12 | catkin 13 | roscpp 14 | std_msgs 15 | message_generation 16 | roscpp 17 | std_msgs 18 | message_runtime 19 | 20 | 21 | -------------------------------------------------------------------------------- /ros_tutorials_service/src/service_client.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" // ROS Default Header File 2 | #include "ros_tutorials_service/SrvTutorial.h"// SrvTutorial Service File Header (Automatically created after build) 3 | #include // Library for using the "atoll" function 4 | 5 | int main(int argc, char **argv) // Node Main Function 6 | { 7 | ros::init(argc, argv, "service_client"); // Initializes Node Name 8 | 9 | if (argc != 3) // Input value error handling 10 | { 11 | ROS_INFO("cmd : rosrun ros_tutorials_service service_client arg0 arg1"); 12 | ROS_INFO("arg0: double number, arg1: double number"); 13 | return 1; 14 | } 15 | 16 | ros::NodeHandle nh; // Node handle declaration for communication with ROS system 17 | 18 | // Declares service client 'ros_tutorials_service_client' 19 | // using the 'SrvTutorial' service file in the 'ros_tutorials_service' package. 20 | // The service name is 'ros_tutorial_srv' 21 | ros::ServiceClient ros_tutorials_service_client = nh.serviceClient("ros_tutorial_srv"); 22 | 23 | // Declares the 'srv' service that uses the 'SrvTutorial' service file 24 | ros_tutorials_service::SrvTutorial srv; 25 | 26 | // Parameters entered when the node is executed as a service request value are stored at 'a' and 'b' 27 | srv.request.a = atoll(argv[1]); 28 | srv.request.b = atoll(argv[2]); 29 | 30 | // Request the service. If the request is accepted, display the response value 31 | if (ros_tutorials_service_client.call(srv)) 32 | { 33 | ROS_INFO("send srv, srv.Request.a and b: %ld, %ld", (long int)srv.request.a, (long int)srv.request.b); 34 | ROS_INFO("receive srv, srv.Response.result: %ld", (long int)srv.response.result); 35 | } 36 | else 37 | { 38 | ROS_ERROR("Failed to call service ros_tutorial_srv"); 39 | return 1; 40 | } 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /ros_tutorials_service/src/service_server.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" // ROS Default Header File 2 | #include "ros_tutorials_service/SrvTutorial.h"// SrvTutorial Service File Header (Automatically created after build) 3 | 4 | // The below process is performed when there is a service request 5 | // The service request is declared as 'req', and the service response is declared as 'res' 6 | bool calculation(ros_tutorials_service::SrvTutorial::Request &req, 7 | ros_tutorials_service::SrvTutorial::Response &res) 8 | { 9 | // The service name is 'ros_tutorial_srv' and it will call 'calculation' function upon the service request. 10 | res.result = req.a + req.b; 11 | 12 | // Displays 'a' and 'b' values used in the service request and 13 | // the 'result' value corresponding to the service response 14 | ROS_INFO("request: x=%ld, y=%ld", (long int)req.a, (long int)req.b); 15 | ROS_INFO("sending back response: %ld", (long int)res.result); 16 | 17 | return true; 18 | } 19 | 20 | int main(int argc, char **argv) // Node Main Function 21 | { 22 | ros::init(argc, argv, "service_server"); // Initializes Node Name 23 | ros::NodeHandle nh; // Node handle declaration 24 | 25 | // Declare service server 'ros_tutorials_service_server' 26 | // using the 'SrvTutorial' service file in the 'ros_tutorials_service' package. 27 | // The service name is 'ros_tutorial_srv' and it will call 'calculation' function 28 | // upon the service request. 29 | ros::ServiceServer ros_tutorials_service_server = nh.advertiseService("ros_tutorial_srv", calculation); 30 | 31 | ROS_INFO("ready srv server!"); 32 | 33 | ros::spin(); // Wait for the service request 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /ros_tutorials_service/srv/SrvTutorial.srv: -------------------------------------------------------------------------------- 1 | int64 a 2 | int64 b 3 | --- 4 | int64 result 5 | -------------------------------------------------------------------------------- /ros_tutorials_topic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(ros_tutorials_topic) 3 | 4 | find_package(catkin REQUIRED COMPONENTS message_generation std_msgs roscpp) 5 | 6 | add_message_files(FILES MsgTutorial.msg) 7 | generate_messages(DEPENDENCIES std_msgs) 8 | 9 | catkin_package( 10 | LIBRARIES ros_tutorials_topic 11 | CATKIN_DEPENDS std_msgs roscpp 12 | ) 13 | 14 | include_directories(${catkin_INCLUDE_DIRS}) 15 | 16 | add_executable(topic_publisher src/topic_publisher.cpp) 17 | add_dependencies(topic_publisher ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 18 | target_link_libraries(topic_publisher ${catkin_LIBRARIES}) 19 | 20 | add_executable(topic_subscriber src/topic_subscriber.cpp) 21 | add_dependencies(topic_subscriber ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 22 | target_link_libraries(topic_subscriber ${catkin_LIBRARIES}) 23 | -------------------------------------------------------------------------------- /ros_tutorials_topic/launch/union.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ros_tutorials_topic/msg/MsgTutorial.msg: -------------------------------------------------------------------------------- 1 | time stamp 2 | int32 data 3 | -------------------------------------------------------------------------------- /ros_tutorials_topic/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ros_tutorials_topic 4 | 0.1.0 5 | ROS turtorial package to learn the topic 6 | Apache License 2.0 7 | Yoonseok Pyo 8 | Yoonseok Pyo 9 | https://github.com/ROBOTIS-GIT/ros_tutorials/issues 10 | https://github.com/ROBOTIS-GIT/ros_tutorials.git 11 | http://www.robotis.com 12 | catkin 13 | roscpp 14 | std_msgs 15 | message_generation 16 | roscpp 17 | std_msgs 18 | message_runtime 19 | 20 | 21 | -------------------------------------------------------------------------------- /ros_tutorials_topic/src/topic_publisher.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" // ROS Default Header File 2 | #include "ros_tutorials_topic/MsgTutorial.h" // MsgTutorial Message File Header. The header file is automatically created when building the package. 3 | 4 | int main(int argc, char **argv) // Node Main Function 5 | { 6 | ros::init(argc, argv, "topic_publisher"); // Initializes Node Name 7 | ros::NodeHandle nh; // Node handle declaration for communication with ROS system 8 | 9 | // Declare publisher, create publisher 'ros_tutorial_pub' using the 'MsgTutorial' 10 | // message file from the 'ros_tutorials_topic' package. The topic name is 11 | // 'ros_tutorial_msg' and the size of the publisher queue is set to 100. 12 | ros::Publisher ros_tutorial_pub = nh.advertise("ros_tutorial_msg", 100); 13 | 14 | // Set the loop period. '10' refers to 10 Hz and the main loop repeats at 0.1 second intervals 15 | ros::Rate loop_rate(10); 16 | 17 | ros_tutorials_topic::MsgTutorial msg; // Declares message 'msg' in 'MsgTutorial' message file format 18 | int count = 0; // Variable to be used in message 19 | 20 | while (ros::ok()) 21 | { 22 | msg.stamp = ros::Time::now(); // Save current time in the stamp of 'msg' 23 | msg.data = count; // Save the the 'count' value in the data of 'msg' 24 | 25 | ROS_INFO("send msg = %d", msg.stamp.sec); // Prints the 'stamp.sec' message 26 | ROS_INFO("send msg = %d", msg.stamp.nsec); // Prints the 'stamp.nsec' message 27 | ROS_INFO("send msg = %d", msg.data); // Prints the 'data' message 28 | 29 | ros_tutorial_pub.publish(msg); // Publishes 'msg' message 30 | 31 | loop_rate.sleep(); // Goes to sleep according to the loop rate defined above. 32 | 33 | ++count; // Increase count variable by one 34 | } 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /ros_tutorials_topic/src/topic_subscriber.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" // ROS Default Header File 2 | #include "ros_tutorials_topic/MsgTutorial.h" // MsgTutorial Message File Header. The header file is automatically created when building the package. 3 | 4 | // Message callback function. This is a function is called when a topic 5 | // message named 'ros_tutorial_msg' is received. As an input message, 6 | // the 'MsgTutorial' message of the 'ros_tutorials_topic' package is received. 7 | void msgCallback(const ros_tutorials_topic::MsgTutorial::ConstPtr& msg) 8 | { 9 | ROS_INFO("recieve msg = %d", msg->stamp.sec); // Prints the 'stamp.sec' message 10 | ROS_INFO("recieve msg = %d", msg->stamp.nsec); // Prints the 'stamp.nsec' message 11 | ROS_INFO("recieve msg = %d", msg->data); // Prints the 'data' message 12 | } 13 | 14 | int main(int argc, char **argv) // Node Main Function 15 | { 16 | ros::init(argc, argv, "topic_subscriber"); // Initializes Node Name 17 | 18 | ros::NodeHandle nh; // Node handle declaration for communication with ROS system 19 | 20 | // Declares subscriber. Create subscriber 'ros_tutorial_sub' using the 'MsgTutorial' 21 | // message file from the 'ros_tutorials_topic' package. The topic name is 22 | // 'ros_tutorial_msg' and the size of the publisher queue is set to 100. 23 | ros::Subscriber ros_tutorial_sub = nh.subscribe("ros_tutorial_msg", 100, msgCallback); 24 | 25 | // A function for calling a callback function, waiting for a message to be 26 | // received, and executing a callback function when it is received. 27 | ros::spin(); 28 | 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /testbot_description/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(testbot_description) 3 | find_package(catkin REQUIRED COMPONENTS urdf) 4 | catkin_package() 5 | include_directories(${catkin_INCLUDE_DIRS}) 6 | -------------------------------------------------------------------------------- /testbot_description/launch/testbot.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /testbot_description/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | testbot_description 4 | 0.1.0 5 | ROS turtorial package to learn the URDF 6 | Apache License 2.0 7 | Yoonseok Pyo 8 | Yoonseok Pyo 9 | https://github.com/ROBOTIS-GIT/ros_tutorials/issues 10 | https://github.com/ROBOTIS-GIT/ros_tutorials.git 11 | http://www.robotis.com 12 | catkin 13 | urdf 14 | urdf 15 | 16 | 17 | -------------------------------------------------------------------------------- /testbot_description/urdf/testbot.urdf: -------------------------------------------------------------------------------- 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 | --------------------------------------------------------------------------------