当前位置: 首页 > news >正文

网站建设 洪塔福田网站制作比较好的

网站建设 洪塔,福田网站制作比较好的,成全视频免费高清观看在线动漫,购物商城网站开发公司Python为ROS编写一个简单的发布者和订阅者1.创建工作空间1.1建立文件夹hello_rospy,再在该目录下建立子目录src,并创建工作空间mkdir -p ~/hello_rospy/srccd ~/hello_rospy/srccatkin_init_workspace1.2 编译cd ~/hello_rospy/catkin_make1.3设置运行环境echo source ~/…Python为ROS编写一个简单的发布者和订阅者1.创建工作空间1.1建立文件夹hello_rospy,再在该目录下建立子目录src,并创建工作空间mkdir -p ~/hello_rospy/srccd ~/hello_rospy/srccatkin_init_workspace1.2 编译cd ~/hello_rospy/catkin_make1.3设置运行环境echo source ~/hello_rospy/devel/setup.bash ~/.bashrc1.4 检查运行环境(可以省略)echo #ROS_PACKAGE_PATH如果成功的话输出内容应该包含本空间的” …/devel/setup.bash文件。2.创建beginner_tutorials包在src目录下创建beginner_tutorials包cd ~/hello_rospy/srccatkin_create_pkg beginner_tutorials std_msgs rospy roscpp3.编写发布者程序和订阅者程序在beginner_tutorials 文件夹下面创建scripts文件夹并在scripts文件夹下新建talker.py和listener.py两个文件roscd beginner_tutorials/mkdir scriptscd scripts在scripts目录下新建talker.py文件写入如下内容#!/usr/bin/env python# license removed for brevityimport rospyfrom std_msgs.msg import Stringdef talker():pub rospy.Publisher(chatter, String, queue_size10)rospy.init_node(talker, anonymousTrue)rate rospy.Rate(10) # 10hzwhile not rospy.is_shutdown():hello_str hello world %s % rospy.get_time()rospy.loginfo(hello_str)pub.publish(hello_str)rate.sleep()if __name__ __main__:try:talker()except rospy.ROSInterruptException:pass在scripts目录下新建listener.py文件写入如下内容#!/usr/bin/env pythonimport rospyfrom std_msgs.msg import Stringdef callback(data):rospy.loginfo(rospy.get_caller_id() I heard %s, data.data)def listener():# In ROS, nodes are uniquely named. If two nodes with the same# node are launched, the previous one is kicked off. The# anonymousTrue flag means that rospy will choose a unique# name for our listener node so that multiple listeners can# run simultaneously.rospy.init_node(listener, anonymousTrue)rospy.Subscriber(chatter, String, callback)# spin() simply keeps python from exiting until this node is stoppedrospy.spin()if __name__ __main__:listener()更改文件权限为可执行文件chmod x talker.pychmod x listener.py4. 编译(Python编写可以省略)修改Cmakelist.txt为如下如果是按照上面编写的Cmakelist.txt中的内容步需要修改cmake_minimum_required(VERSION 2.8.3)project(beginner_tutorials)## Find catkin macros and libraries## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)## is used, also find other catkin packagesfind_package(catkin REQUIRED COMPONENTSroscpprospystd_msgs)catkin_package()回到工作空间运行,catkin_make,编译catkin_make5. 运行cd #回到梗目录roscore #启动ROSrosrun beginner_tutorials talker.pyrosrun beginner_tutorials listener.py运行结果
http://www.huolong8.cn/news/57613/

相关文章:

  • 松岗专业做网站公司施工企业账务处理
  • 网站上传文件存储方式产品营销策略包括哪些内容
  • 学习html的网站百度网站排名怎么做
  • 企业网站seo托管怎么做石家庄优化
  • 哪些网站可以做h5外贸建站模板免费
  • 上海传媒公司总裁是谁百度关键词优化和百度推广
  • 家装网站网站专题建设
  • 手机访问wordpress网站卡全网维护
  • 北京网站设计首选 新鸿儒求大神帮忙做网站
  • 亚马逊网站建设与维护方法分析东莞网站建设推广技巧
  • 网站建设的难点和问题手机商城网站建设
  • 滨海县城乡建设局网站常用于制作网页的软件
  • 网站建设哪家较好开发技术网站开发技术
  • 天津网站建设的公司软件开发必备编程工具
  • 之梦系统怎么修改网站标头图片优化关键词排名软件
  • 高校门户网站建设需要多少钱seo点击排名源码
  • ICP备案域名网站做会计应关注什么网站
  • 谁有网站备案号绵阳城区大建设
  • 重庆模板网站建站调研报告万能模板
  • 佛山高端网站制作公司哪家好广州各区最新动态
  • 网站建设的优势与不足wordpress 高德地图
  • 网站设计语言海外 酒店 网站建设
  • 坪山网站建设特色设计公司logo的网站
  • 自己做视频的网站wordpress 加链接
  • 济南优化seo网站建设鞍山网上推广怎么弄?
  • 网站建设源码是什么WordPress如何制作友情链接
  • 公司网站制作计入什么科目营销网站建设一薇
  • 网站关键词代码标志设计logo网站
  • flash个人网站模板西安网站开发公司排名
  • 济南网站开发公司排名怎么做租房网站