ROS#05package and metapackage作成

Workspaceの作成が完成しました。次はそのWorkspaceの中にPackagesを作りましょう。Manualでやるにもいいけど、あまり勧めませんね~特に私のような雑な人 汗。

順調で作成終われば、Successfully created filesみたいなメッセージが出てきますね。

$ cd ~/myProject/catkin_ws/src/
$ catkin_create_pkg ch2_tutorials std_msgs roscpp rospy
Created file ch2_tutorials/package.xml
Created file ch2_tutorials/CMakeLists.txt
Created folder ch2_tutorials/include/ch2_tutorials
Created folder ch2_tutorials/src
Successfully created files in /home/abc/myProject/catkin_ws/src/ch2_tutorials. Please adjust the values in package.xml.

って、その中にいくつ出てきたのCatkin_create_pkgは作成するPackagesの名前ももちろん、どんなdepend(付属)が必要かも一緒に設定できます。

Catkin_create_pkg [package_name] [depend1] [depend2] [depend3]

では、先のコマンドで入れてdependを簡単に見てみましょう。

std_msgs: 

基本なDataを表現するMessage Typeが入っています。例えばBoolやInt、そして配列など。

roscpp: 

C++ Implementationです。Clientライブラリが提供され、C++のプログラマーが簡単で、早くROSのTopics,services,parametersをInterfaceすることができます。

rospy:

Python Implementationです。Clientライブラリが提供され、Pythonのプログラマーが簡単で、早くROSのTopics,services,parametersをInterfaceすることができます。

Docsによりますと、depends1は最近のROS パッケージをリストするのコマンドです。

Print newline-separated, ordered list of immediate dependencies of the package.

https://docs.ros.org/en/independent/api/rospkg/html/rospack.html

$ rospack depends1 ch2_tutorials
roscpp
rospy
std_msgs

そして、dependsはすべてのROS パッケージをリストするコマンドです。

Print newline-separated, ordered list of all dependencies of the package. This is used within rosmake.

$ rospack depends ch2_tutorials
cpp_common
rostime
roscpp_traits
roscpp_serialization
catkin
genmsg
genpy
message_runtime
gencpp
geneus
gennodejs
genlisp
message_generation
rosbuild
rosconsole
std_msgs
rosgraph_msgs
xmlrpcpp
roscpp
rosgraph
ros_environment
rospack
roslib
rospy

最後に、ROS パッケージを作りましょう。

catkin_makeコマンドを使います。

$ cd ~/myProject/catkin_ws/
$ catkin_make
Base path: /home/abc/myProject/catkin_ws
Source space: /home/abc/myProject/catkin_ws/src
Build space: /home/abc/myProject/catkin_ws/build
Devel space: /home/abc/myProject/catkin_ws/devel
Install space: /home/abc/myProject/catkin_ws/install
####
#### Running command: “cmake /home/abc/myProject/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/abc/myProject/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/abc/myProject/catkin_ws/install -G Unix Makefiles” in “/home/abc/myProject/catkin_ws/build”
####
— Using CATKIN_DEVEL_PREFIX: /home/abc/myProject/catkin_ws/devel
— Using CMAKE_PREFIX_PATH: /home/abc/myProject/catkin_ws/devel;/opt/ros/melodic
— This workspace overlays: /home/abc/myProject/catkin_ws/devel;/opt/ros/melodic
— Found PythonInterp: /usr/bin/python2 (found suitable version “2.7.15”, minimum required is “2”)
— Using PYTHON_EXECUTABLE: /usr/bin/python2
— Using Debian Python package layout
— Using empy: /usr/bin/empy
— Using CATKIN_ENABLE_TESTING: ON
— Call enable_testing()
— Using CATKIN_TEST_RESULTS_DIR: /home/abc/myProject/catkin_ws/build/test_results
— Found gtest sources under ‘/usr/src/googletest’: gtests will be built
— Found gmock sources under ‘/usr/src/googletest’: gmock will be built
— Found PythonInterp: /usr/bin/python2 (found version “2.7.15”)
— Using Python nosetests: /usr/bin/nosetests-2.7
— catkin 0.7.29
— BUILD_SHARED_LIBS is on
— BUILD_SHARED_LIBS is on
— ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
— ~~  traversing 1 packages in topological order:
— ~~  – ch2_tutorials
— ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
— +++ processing catkin package: ‘ch2_tutorials’
— ==> add_subdirectory(ch2_tutorials)
— Configuring done
— Generating done
— Build files have been written to: /home/abc/myProject/catkin_ws/build
####
#### Running command: “make -j2 -l2” in “/home/abc/myProject/catkin_ws/build”
####
Footer_Basic

Find ME

Twitter:@3threes2
Email:soup01threes*gmail.com (* to @)
YoutubeChannel:https://www.youtube.com/channel/UCQ3CHGAIXZAbeOC_9mjQiWQ

シェアする

  • このエントリーをはてなブックマークに追加

フォローする