creat the publisher and use self-defined message

Step 1
creat the work space and catkin_init_workspace(in src folder) &catkin_make(in workspace folder)

Step 2
creat the package (in src),catkin_create_pkg

Step 3
copy and edit the code in the jan_7_duckietown
main change: the location of the message 'TW..' class

Step 4
add such code in the CMakeLists.txt in package

add_executable(car_publisher src/car_publisher.cpp)
target_link_libraries(car_publisher ${catkin_LIBRARIES})
add_dependencies(car_publisher ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

Step 5

add msg-'TW..'into car_controller'

Step 6

edit the CMakelists.txt in package

1.find_package(catkin REQUIRED COMPONENTS
  roscpp
  std_msgs
  message_generation ##added
)

2.
 add_message_files(
   FILES
   Twist2DStamped.msg
#   Message2.msg
 )
3.
 generate_messages(
   DEPENDENCIES
   std_msgs
 )
4.
catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES car_controller
  CATKIN_DEPENDS message_runtime
#  DEPENDS system_lib
)

Step 7  edit the package.xml

  <run_depend>message_runtime</run_depend>
  <build_depend>message_generation</build_depend>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值