当前位置:网站首页>rosbag data plotting MATLAB
rosbag data plotting MATLAB
2022-07-29 14:24:00 【confused orange】
本文介绍使用matlab对rosbagPlot the data
1rosbag用法
Start either one firstros程序,比如小乌龟,进行控制
一般而言,All it takes is a simple command
cd 桌面
rosbag record -a参考链接:rosbag使用方法汇总
After recording is complete,把bag文件拷到win系统下,打开matlab
2matlab数据处理
clear;
close all;
bag = rosbag('wugui.bag');After performing these three steps,在bagAll topics can be seen under this data


Then get the value of the specific data
sel = select(bag, 'Topic', '/turtle1/cmd_vel');
msgStructs = readMessages(sel,'DataFormat','struct');After reading the data,保存在了msgStructs这个数据里,Open this data,You can see the structure type inside


Take the topic of getting speed for example,比如XThe linear velocity in the direction can be knownLinear->X
Then do a single data fetch
vx1 = cellfun(@(m) double(m.Linear.X),msgStructs);
vy1 = cellfun(@(m) double(m.Linear.Y),msgStructs);然后vx1和vy1就是数组,It can be used for drawing
完整代码
clear;
close all;
bag = rosbag('wugui.bag');
sel = select(bag, 'Topic', '/turtle1/cmd_vel');
msgStructs = readMessages(sel,'DataFormat','struct');
vx1 = cellfun(@(m) double(m.Linear.X),msgStructs);
vy1 = cellfun(@(m) double(m.Linear.Y),msgStructs);
sel = select(bag, 'Topic', '/turtle1/pose');
msgStructs = readMessages(sel,'DataFormat','struct');
d01x = cellfun(@(m) double(m.X),msgStructs);
d01y = cellfun(@(m) double(m.Y),msgStructs);
figure(1)
hold on;
plot(d01x,d01y,'Color','b','LineStyle','-','LineWidth',1);
grid on;
边栏推荐
猜你喜欢

kubernetes cks strace etcd

【10点公开课】:快手GPU/FPGA/ASIC异构平台的应用探索

AI全流程开发难题破解之钥

威纶通触摸屏制作自定义欢迎界面的几种方法介绍

The new technical director, who is in the form of a isXxx Boolean type definition, tomorrow need not come!

蚂蚁三面滑铁卢!遭分布式截胡,靠这些笔记潜修30天,挺进京东

全开放式耳机怎么样?不塞耳朵的蓝牙耳机推荐

进程间通信 --- system V三种通信方式(图文案例讲解)

rosbag数据画图MATLAB

工作效率-十五分钟让你快速学习Markdown语法到精通排版实践备忘
随机推荐
国产手机将用户变成它们的广告肉鸡,难怪消费者都买iPhone了
【论文阅读】Anomaly Detection in Video via Self-Supervised and Multi-Task Learning
关于知识付费的一些思考
进程间通信 --- system V三种通信方式(图文案例讲解)
这么多年了,还搞不懂正则语法?
如何使用MISRA改进嵌入式编程
根据msql表的结构自动生成gorm的struct
TCP和UDP的基本认识
城市污水处理过程模型预测控制研究综述
app小程序开发的营销优势有什么?
HMS Core音频编辑服务音源分离与空间音频渲染,助力快速进入3D音频的世界
用TypeScript类型系统编程实现斐波那契数列
【模板引擎】微服务学习笔记六:freemarker模板引擎的常用命令介绍
解决:Parameter 0 of method ribbonServerList in com.alibaba.cloud.nacos.ribbon.NacosRibbonClientConfigu
如何返回一个数字的所有质因数?
你真的会用Console.log吗?
手摸手写一个互联网黑话生成器
EA&UML日拱一卒-活动图::StartClassifierBehavior和StartObjectBehavior
How to merge the code when there is a code conflict in the collaborative development of multiple people?
Bika LIMS 开源LIMS集—— SENAITE的使用(分析/测试、方法)