Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##创建msg
- ###msg是什么
- msg是一个普通的文本文件,描述了一个消息的数据成员(数据结构),它将作为原型去生成各种编程语言能够使用的数据类型。
- ###Creating a msg
- Firstly, we need a msg folder with a filename.msg file under the package folder.
- Then, write the msg file with the format <type> <name> per line.
- Then, open package.xml, and make sure these two lines are in it and uncommented:
- ```xml
- <build_depend>message_generation</build_depend>
- <run_depend>message_runtime</run_depend>
- ```
- And in CMakeLists.txt, check the content below:
- ```makefile
- # Do not just add this to your CMakeLists.txt,
- # modify the existing text to add message_generation before the closing parenthesis
- find_package(catkin REQUIRED COMPONENTS
- roscpp
- rospy
- std_msgs
- message_generation
- )
- catkin_package(
- ...
- CATKIN_DEPENDS message_runtime ...
- ...)
- add_message_files(
- FILES
- yours.msg
- )
- ```
- ##创建srv$ rosmsg sh
- $ rosmsg sh
- ###srv是什么
- 同msg一样,srv是用来描述service的纯文本和原型描述;特别地,它需要描述请求和响应两个部分。
- ###Creating a srv
- Create .srv file in package_path/srv/your.srv
- Check the content in package.xml:
- ```xml
- <build_depend>message_generation</build_depend>
- <run_depend>message_runtime</run_depend>
- ```
- and check these content in CMakeLists.txt:
- ```makefile
- # Do not just add this line to your CMakeLists.txt,
- # modify the existing line
- find_package(catkin REQUIRED COMPONENTS
- roscpp
- rospy
- std_msgs
- message_generation
- )
- add_service_files(
- FILES
- your.srv
- )
- Similar to msg, use `rossrv show <srvname>` to check it.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement