歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

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-
Copyright © Linux教程網 All Rights Reserved