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

免费做公众号的网站十堰外贸网站建设

免费做公众号的网站,十堰外贸网站建设,wordpress主题 幻灯片,wordpress博客名字背景#xff1a;最近在制作kimera的数据集#xff0c;尤其是运行semantic模块所需要的bag文件中有很多topic#xff0c;但是很多不知道topic中装的是什么数据#xff0c;及其格式#xff0c;所以我就想着怎么可以将bag中的topic都解析数来#xff0c;这样就能知道bag中都…背景最近在制作kimera的数据集尤其是运行semantic模块所需要的bag文件中有很多topic但是很多不知道topic中装的是什么数据及其格式所以我就想着怎么可以将bag中的topic都解析数来这样就能知道bag中都有啥了有网友提供了下面的代码我稍作了些修改可以在python3下可以顺利运行如果你的文件夹下有多个bag文件这个代码可以挨个处理这些bag文件先为每个bag文件创建一个相应的文件夹然后把bag文件拷贝进去然后将bag中的topic都解析为csv格式 #!/usr/bin/pythonThis script saves each topic in a bagfile as a csv.Accepts a filename as an optional argument. Operates on all bagfiles in current directory if no argument providedWritten by Nick Speal in May 2013 at McGill Universitys Aerospace Mechatronics Laboratory www.speal.caSupervised by Professor Inna Sharf, Professor Meyer Nahonimport rosbag, sys, csv import time import string import os #for file management make directory import shutil #for file management, copy file#verify correct input arguments: 1 or 2 if (len(sys.argv) 2):print(invalid number of arguments: str(len(sys.argv)))print(should be 2: bag2csv.py and bagName)print(or just 1 : bag2csv.py)sys.exit(1) elif (len(sys.argv) 2):listOfBagFiles [sys.argv[1]]numberOfFiles 1print(reading only 1 bagfile: str(listOfBagFiles[0])) elif (len(sys.argv) 1):listOfBagFiles [f for f in os.listdir(.) if f[-4:] .bag] #get list of only bag files in current dir.numberOfFiles str(len(listOfBagFiles))print(reading all numberOfFiles bagfiles in current directory: \n)for f in listOfBagFiles:print(f)print(\n press ctrlc in the next 10 seconds to cancel \n)time.sleep(10) else:print(bad argument(s): str(sys.argv)) #shouldnt really come upsys.exit(1)count 0 for bagFile in listOfBagFiles:count 1print(reading file str(count) of numberOfFiles : bagFile)#access bagbag rosbag.Bag(bagFile)bagContents bag.read_messages()bagName bag.filename#/home/yunlei/COOL/kalibr-cde/test/2020-06-13-11-57-29.bag#create a new directory string.rstrip(bagName, .bag)folder bagName.split(.bag)[0]try: #else already existsos.makedirs(folder)except:passshutil.copyfile(bagName, folder / bagName.split(/)[-1])#get list of topics from the baglistOfTopics []for topic, msg, t in bagContents:if topic not in listOfTopics:listOfTopics.append(topic)for topicName in listOfTopics:#Create a new CSV file for each topic folder / string.replace(topicName, /, _slash_) .csvfilename folder / topicName.split(/)[-1] .csvwith open(filename, w) as csvfile:filewriter csv.writer(csvfile, delimiter ,)firstIteration True #allows header rowfor subtopic, msg, t in bag.read_messages(topicName): # for each instant in time that has data for topicName#parse data from this instant, which is of the form of multiple lines of Name: value\n# - put it in the form of a list of 2-element listsmsgString str(msg)msgList msgString.split(\n)instantaneousListOfData []for nameValuePair in msgList:splitPair nameValuePair.split(:)for i in range(len(splitPair)): #should be 0 to 1splitPair[i] splitPair[i].strip()instantaneousListOfData.append(splitPair)#write the first row from the first element of each pairif firstIteration: # headerheaders [rosbagTimestamp] #first column headerfor pair in instantaneousListOfData:headers.append(pair[0])filewriter.writerow(headers)firstIteration False# write the value from each pair to the filevalues [str(t)] #first column will have rosbag timestampfor pair in instantaneousListOfData:if len(pair) 1:values.append(pair[1])filewriter.writerow(values)bag.close() print(Done reading all numberOfFiles bag files.)
http://www.zqtcl.cn/news/654231/

相关文章:

  • 自己的简历怎么制作网站学院网站建设成效
  • 周口seo 网站郑州建站网站的公司
  • 网站布局模板北京装修大概多少钱一平方
  • 德阳网站建设ghxhwl风景网站模板
  • 昌邑网站建设拓者设计吧现代效果图
  • 学校网站建设成功案例网站开发需要学习哪些内容
  • 怎么让公司建设网站seo于刷网站点击
  • 网站建设合同严瑾建设网站宣传
  • 哪个网站做餐饮推广最好深圳市信任网站
  • 网站模板 整站源码广州网站vi设计报价
  • 百度速页建站wordpress审核插件
  • 怎么给网站wordpress专业的vi设计公司
  • 百度关键词在线优化寻找郑州网站优化公司
  • 网站建设适合什么单位网络推广员工作内容
  • 漂亮的网站维护页面wordpress加个微信登录
  • 网站设计是什么意思创建地址怎么弄
  • nas上建设网站文章网站哪里建设好
  • 消防网站模板广告设计专业需要学什么
  • 建设银行网站首页wordpress 登录函数
  • 做网站多长时间广州营销网站制作
  • 美团外卖网站开发建设网站如何写文案
  • 专门做画册封面的网站开发工程师网站开发工程师招聘
  • 广州市建设局网站自己做电影网站违法
  • 网站建设首选公司大丰专业做网站
  • 用dw怎么做网站辽宁省住房和城乡建设厅网站首页
  • 如何用微信小程序做网站2个网站做的链接怎么用一个域名
  • 大理网站建设滇icp备凡科网站代码如何修改
  • 做电商网站的公司简介网站制作多久
  • 营销手段有哪些方式合肥网站优化服务网
  • 网站备案和域名备案山东临沂市建筑模板生产厂家