$ roscd beginner_tutorials
$ mkdir msg
$ echo “int64 num” > msg/Num.msg
$ vi package.xml
add:
1 2 |
<build_depend>message_generation</build_depend> <run_depend>message_runtime</run_depend> |
$ vi CMakeList.txt
insert message_generation in the find_package
1 2 3 4 5 6 |
find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs message_generation ) |
make sure CATKIN_DEPENDS message_runtime in catkin_package
1 2 3 4 |
catkin_package( ... CATKIN_DEPENDS message_runtime ... ...) |
Find add_message_files and make like this:
1 2 3 4 |
add_message_files( FILES Num.msg ) |
uncomment generate_messages:
1 2 3 4 |
generate_messages( DEPENDENCIES std_msgs ) |
$ rosmsg show beginner_tutorials/Num
$ rosmsg show Num
$ roscd beginner_tutorials
$ mkdir srv
$ roscp rospy_tutorials AddTwoInts.srv srv/AddTwoInts.srv
$ vi package.xml
make sure:
1 2 |
build_depend>message_genertion</build_depend> <run_depend>message_runtime</run_depend> |
$ vi CMakeLists.txt
make sure:
1 2 3 4 5 6 |
find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs message_generation ) |
find add_service_files and make like this:
1 2 3 4 |
add_service_files( FILES AddTwoInts.srv ) |
$ rossrv show beginner_tutorials/AddTwoInts
$ vi CMakeList.txt
make sure:
1 2 3 4 |
generate_messages( DEPENDENCIES std_msgs ) |
now !!!!!
$ roscd beginnner_tutorials
$ cd ../..
$ catkin_make install
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 |
allen@T420:~/catkin_ws$ catkin_make install Base path: /home/allen/catkin_ws Source space: /home/allen/catkin_ws/src Build space: /home/allen/catkin_ws/build Devel space: /home/allen/catkin_ws/devel Install space: /home/allen/catkin_ws/install #### #### Running command: "make cmake_check_build_system" in "/home/allen/catkin_ws/build" #### -- Using CATKIN_DEVEL_PREFIX: /home/allen/catkin_ws/devel -- Using CMAKE_PREFIX_PATH: /home/allen/catkin_ws/devel;/opt/ros/lunar -- This workspace overlays: /home/allen/catkin_ws/devel;/opt/ros/lunar -- Using PYTHON_EXECUTABLE: /usr/bin/python -- Using Debian Python package layout -- Using empy: /usr/bin/empy -- Using CATKIN_ENABLE_TESTING: ON -- Call enable_testing() -- Using CATKIN_TEST_RESULTS_DIR: /home/allen/catkin_ws/build/test_results -- Found gtest sources under '/usr/src/gtest': gtests will be built -- Using Python nosetests: /usr/bin/nosetests-2.7 -- catkin 0.7.6 -- BUILD_SHARED_LIBS is on -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- ~~ traversing 1 packages in topological order: -- ~~ - beginner_tutorials -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- +++ processing catkin package: 'beginner_tutorials' -- ==> add_subdirectory(beginner_tutorials) -- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy -- beginner_tutorials: 1 messages, 1 services -- Configuring done -- Generating done -- Build files have been written to: /home/allen/catkin_ws/build #### #### Running command: "make install -j4 -l4" in "/home/allen/catkin_ws/build" #### Scanning dependencies of target _beginner_tutorials_generate_messages_check_deps_Num Scanning dependencies of target _beginner_tutorials_generate_messages_check_deps_AddTwoInts Scanning dependencies of target std_msgs_generate_messages_eus Scanning dependencies of target std_msgs_generate_messages_lisp [ 0%] Built target std_msgs_generate_messages_eus [ 0%] Built target std_msgs_generate_messages_lisp Scanning dependencies of target std_msgs_generate_messages_py Scanning dependencies of target std_msgs_generate_messages_nodejs [ 0%] Built target std_msgs_generate_messages_py [ 0%] Built target std_msgs_generate_messages_nodejs Scanning dependencies of target std_msgs_generate_messages_cpp [ 0%] Built target _beginner_tutorials_generate_messages_check_deps_Num [ 0%] Built target _beginner_tutorials_generate_messages_check_deps_AddTwoInts [ 0%] Built target std_msgs_generate_messages_cpp Scanning dependencies of target beginner_tutorials_generate_messages_eus Scanning dependencies of target beginner_tutorials_generate_messages_py Scanning dependencies of target beginner_tutorials_generate_messages_lisp Scanning dependencies of target beginner_tutorials_generate_messages_nodejs [ 7%] Generating Python from MSG beginner_tutorials/Num [ 15%] Generating EusLisp code from beginner_tutorials/Num.msg [ 23%] Generating Lisp code from beginner_tutorials/Num.msg [ 30%] Generating Javascript code from beginner_tutorials/Num.msg [ 38%] Generating Python code from SRV beginner_tutorials/AddTwoInts [ 46%] Generating Lisp code from beginner_tutorials/AddTwoInts.srv [ 53%] Generating EusLisp code from beginner_tutorials/AddTwoInts.srv [ 61%] Generating Javascript code from beginner_tutorials/AddTwoInts.srv [ 69%] Generating Python msg __init__.py for beginner_tutorials [ 69%] Built target beginner_tutorials_generate_messages_lisp [ 69%] Built target beginner_tutorials_generate_messages_nodejs Scanning dependencies of target beginner_tutorials_generate_messages_cpp [ 76%] Generating Python srv __init__.py for beginner_tutorials [ 84%] Generating EusLisp manifest code for beginner_tutorials [ 92%] Generating C++ code from beginner_tutorials/Num.msg [100%] Generating C++ code from beginner_tutorials/AddTwoInts.srv [100%] Built target beginner_tutorials_generate_messages_py [100%] Built target beginner_tutorials_generate_messages_cpp [100%] Built target beginner_tutorials_generate_messages_eus Scanning dependencies of target beginner_tutorials_generate_messages [100%] Built target beginner_tutorials_generate_messages Install the project... -- Install configuration: "" -- Installing: /home/allen/catkin_ws/install/_setup_util.py -- Installing: /home/allen/catkin_ws/install/env.sh -- Installing: /home/allen/catkin_ws/install/setup.bash -- Installing: /home/allen/catkin_ws/install/setup.sh -- Installing: /home/allen/catkin_ws/install/setup.zsh -- Installing: /home/allen/catkin_ws/install/.rosinstall -- Installing: /home/allen/catkin_ws/install/share/beginner_tutorials/msg/Num.msg -- Installing: /home/allen/catkin_ws/install/share/beginner_tutorials/srv/AddTwoInts.srv -- Installing: /home/allen/catkin_ws/install/share/beginner_tutorials/cmake/beginner_tutorials-msg-paths.cmake -- Installing: /home/allen/catkin_ws/install/include/beginner_tutorials -- Installing: /home/allen/catkin_ws/install/include/beginner_tutorials/AddTwoIntsRequest.h -- Installing: /home/allen/catkin_ws/install/include/beginner_tutorials/AddTwoIntsResponse.h -- Installing: /home/allen/catkin_ws/install/include/beginner_tutorials/AddTwoInts.h -- Installing: /home/allen/catkin_ws/install/include/beginner_tutorials/Num.h -- Installing: /home/allen/catkin_ws/install/share/roseus/ros/beginner_tutorials -- Installing: /home/allen/catkin_ws/install/share/roseus/ros/beginner_tutorials/srv -- Installing: /home/allen/catkin_ws/install/share/roseus/ros/beginner_tutorials/srv/AddTwoInts.l -- Installing: /home/allen/catkin_ws/install/share/roseus/ros/beginner_tutorials/msg -- Installing: /home/allen/catkin_ws/install/share/roseus/ros/beginner_tutorials/msg/Num.l -- Installing: /home/allen/catkin_ws/install/share/roseus/ros/beginner_tutorials/manifest.l -- Installing: /home/allen/catkin_ws/install/share/common-lisp/ros/beginner_tutorials -- Installing: /home/allen/catkin_ws/install/share/common-lisp/ros/beginner_tutorials/srv -- Installing: /home/allen/catkin_ws/install/share/common-lisp/ros/beginner_tutorials/srv/beginner_tutorials-srv.asd -- Installing: /home/allen/catkin_ws/install/share/common-lisp/ros/beginner_tutorials/srv/_package.lisp -- Installing: /home/allen/catkin_ws/install/share/common-lisp/ros/beginner_tutorials/srv/_package_AddTwoInts.lisp -- Installing: /home/allen/catkin_ws/install/share/common-lisp/ros/beginner_tutorials/srv/AddTwoInts.lisp -- Installing: /home/allen/catkin_ws/install/share/common-lisp/ros/beginner_tutorials/msg -- Installing: /home/allen/catkin_ws/install/share/common-lisp/ros/beginner_tutorials/msg/Num.lisp -- Installing: /home/allen/catkin_ws/install/share/common-lisp/ros/beginner_tutorials/msg/_package_Num.lisp -- Installing: /home/allen/catkin_ws/install/share/common-lisp/ros/beginner_tutorials/msg/beginner_tutorials-msg.asd -- Installing: /home/allen/catkin_ws/install/share/common-lisp/ros/beginner_tutorials/msg/_package.lisp -- Installing: /home/allen/catkin_ws/install/share/gennodejs/ros/beginner_tutorials -- Installing: /home/allen/catkin_ws/install/share/gennodejs/ros/beginner_tutorials/srv -- Installing: /home/allen/catkin_ws/install/share/gennodejs/ros/beginner_tutorials/srv/AddTwoInts.js -- Installing: /home/allen/catkin_ws/install/share/gennodejs/ros/beginner_tutorials/srv/_index.js -- Installing: /home/allen/catkin_ws/install/share/gennodejs/ros/beginner_tutorials/msg -- Installing: /home/allen/catkin_ws/install/share/gennodejs/ros/beginner_tutorials/msg/_index.js -- Installing: /home/allen/catkin_ws/install/share/gennodejs/ros/beginner_tutorials/msg/Num.js -- Installing: /home/allen/catkin_ws/install/share/gennodejs/ros/beginner_tutorials/_index.js Listing /home/allen/catkin_ws/devel/lib/python2.7/dist-packages/beginner_tutorials ... Compiling /home/allen/catkin_ws/devel/lib/python2.7/dist-packages/beginner_tutorials/__init__.py ... Listing /home/allen/catkin_ws/devel/lib/python2.7/dist-packages/beginner_tutorials/msg ... Compiling /home/allen/catkin_ws/devel/lib/python2.7/dist-packages/beginner_tutorials/msg/_Num.py ... Compiling /home/allen/catkin_ws/devel/lib/python2.7/dist-packages/beginner_tutorials/msg/__init__.py ... Listing /home/allen/catkin_ws/devel/lib/python2.7/dist-packages/beginner_tutorials/srv ... Compiling /home/allen/catkin_ws/devel/lib/python2.7/dist-packages/beginner_tutorials/srv/_AddTwoInts.py ... Compiling /home/allen/catkin_ws/devel/lib/python2.7/dist-packages/beginner_tutorials/srv/__init__.py ... -- Installing: /home/allen/catkin_ws/install/lib/python2.7/dist-packages/beginner_tutorials -- Installing: /home/allen/catkin_ws/install/lib/python2.7/dist-packages/beginner_tutorials/srv -- Installing: /home/allen/catkin_ws/install/lib/python2.7/dist-packages/beginner_tutorials/srv/_AddTwoInts.pyc -- Installing: /home/allen/catkin_ws/install/lib/python2.7/dist-packages/beginner_tutorials/srv/__init__.py -- Installing: /home/allen/catkin_ws/install/lib/python2.7/dist-packages/beginner_tutorials/srv/__init__.pyc -- Installing: /home/allen/catkin_ws/install/lib/python2.7/dist-packages/beginner_tutorials/srv/_AddTwoInts.py -- Installing: /home/allen/catkin_ws/install/lib/python2.7/dist-packages/beginner_tutorials/__init__.py -- Installing: /home/allen/catkin_ws/install/lib/python2.7/dist-packages/beginner_tutorials/msg -- Installing: /home/allen/catkin_ws/install/lib/python2.7/dist-packages/beginner_tutorials/msg/__init__.py -- Installing: /home/allen/catkin_ws/install/lib/python2.7/dist-packages/beginner_tutorials/msg/_Num.pyc -- Installing: /home/allen/catkin_ws/install/lib/python2.7/dist-packages/beginner_tutorials/msg/__init__.pyc -- Installing: /home/allen/catkin_ws/install/lib/python2.7/dist-packages/beginner_tutorials/msg/_Num.py -- Installing: /home/allen/catkin_ws/install/lib/python2.7/dist-packages/beginner_tutorials/__init__.pyc -- Installing: /home/allen/catkin_ws/install/lib/pkgconfig/beginner_tutorials.pc -- Installing: /home/allen/catkin_ws/install/share/beginner_tutorials/cmake/beginner_tutorials-msg-extras.cmake -- Installing: /home/allen/catkin_ws/install/share/beginner_tutorials/cmake/beginner_tutorialsConfig.cmake -- Installing: /home/allen/catkin_ws/install/share/beginner_tutorials/cmake/beginner_tutorialsConfig-version.cmake -- Installing: /home/allen/catkin_ws/install/share/beginner_tutorials/package.xml allen@T420:~/catkin_ws$ |
$ cd –
$ rosmsg -h
$ rosmsg show -h