ROS_Kinetic_10 ROS程序基础Eclipse_C++(一)
ROS_Kinetic_10 ROS程序基础Eclipse_C++(一)
编写简单的消息发布器和订阅器 (C++)
http://wiki.ros.org/cn/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29
这里简单用Eclipse实现一下。
首相将talker.cpp和listener.cpp复制到hello_kinetic/src目录下;
然后修改CMakeLists.txt;加入下列代码:
## Build talker and listener
include_directories(include ${catkin_INCLUDE_DIRS})
add_executable(kinetic_talker src/talker.cpp)
target_link_libraries(kinetic_talker ${catkin_LIBRARIES})
add_dependencies(kinetic_talker ${catkin_EXPORTED_TARGETS})
add_executable(kinetic_listener src/listener.cpp)
target_link_libraries(kinetic_listener ${catkin_LIBRARIES})
add_dependencies(kinetic_listener ${catkin_EXPORTED_TARGETS})
注意,可执行的节点不能重名,这里为kinetic_talker和kinetic_listener。
然后,就可以编译了,编译完成后。
开启终端,启动roscore:
-End-
文章来源: zhangrelay.blog.csdn.net,作者:zhangrelay,版权归原作者所有,如需转载,请联系作者。
原文链接:zhangrelay.blog.csdn.net/article/details/51494579
- 点赞
- 收藏
- 关注作者
评论(0)