ROS(008: Creating a ROS msg and srv)

$ roscd beginner_tutorials

$ mkdir msg

$ echo “int64 num” > msg/Num.msg

$ vi package.xml

add:

$ vi CMakeList.txt

insert message_generation in the find_package

make sure CATKIN_DEPENDS message_runtime in catkin_package

Find add_message_files and make like this:

uncomment generate_messages:

$ 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:

$ vi CMakeLists.txt

make sure:

find add_service_files and make like this:

$ rossrv show beginner_tutorials/AddTwoInts



$ vi CMakeList.txt

make sure:

now !!!!!

$ roscd beginnner_tutorials

$ cd ../..

$ catkin_make install

$ cd –

$ rosmsg -h

$ rosmsg show -h

 

打赏