ubuntu@ubuntu:~/catkin_ws/src$ catkin_create_pkg learning_sevice roscpp rospy std_msgs geometry_msgs turtlesim
Created file learning_sevice/package.xml
Created file learning_sevice/CMakeLists.txt
Created folder learning_sevice/include/learning_sevice
Created folder learning_sevice/src
Successfully created files in /home/ubuntu/catkin_ws/src/learning_sevice. Please adjust the values in package.xml.
3、编译工作空间
都编辑好在进行编译也可以。嫌麻烦的可以略过。
ubuntu@ubuntu:~/catkin_ws$ cd ~/catkin_ws/
ubuntu@ubuntu:~/catkin_ws$ catkin_make
1.3.2 定义srv文件
1、打开功能包路径,创建文件夹和文件
ubuntu@ubuntu:~/catkin_ws/src$ cd ~/catkin_ws/src/learning_sevice/
ubuntu@ubuntu:~/catkin_ws/src/learning_sevice$ mkdir srv
ubuntu@ubuntu:~/catkin_ws/src/learning_sevice$ cd srv/
ubuntu@ubuntu:~/catkin_ws/src/learning_sevice/srv$ ls
ubuntu@ubuntu:~/catkin_ws/src/learning_sevice/srv$ touch Person.srv
ubuntu@ubuntu:~/catkin_ws/src/learning_sevice/srv$ ls
Person.srv