Main object:
1.to read and save images and point cloud data from a rosbag file(机器人文件数据包)
2. to prepare the data for lidar camera calibration.
Solution:
(1)使用helperDownloadRosbag helper函数从给定的URL下载rosbag文件 。
outputFolder = fullfile(tempdir,'RosbagFile');
rosbagURL = ['https://ssd.mathworks.com/supportfiles/lidar/data/' ...
'lccSample.zip'];
helperDownloadRosbag(outputFolder,rosbagURL);
解释:
outputFolder = fullfile(tempdir,'RosbagFile');
%%fullfile 函数作用是作用是利用文件各部分信息创建并合并成完整文件名
tempdir为临时文件夹(MATLAB中系统文件夹,查询过我的文件路径是'C:\Users\28674\AppData\Local\Temp\')
rosbagURL = ['https://ssd.mathworks.com/supportfiles/lidar/data/lccSample.zip’];
%%(这个网站暂时打不开)
helperDownloadRosbag(outputFolder,rosbagURL);
%%(outputFolder为接口文件的文件夹,此函数说明无法找到,个人理解将rosbagURL中的文件放入接口文件夹)
(2)从包文件中检索信息。
path = fullfile(outputFolder,'lccSample.bag');
bag = rosbag(path);
解释:
path = fullfile(outputFolder,'lccSample.bag');
%%拼接文件名
bag = rosbag(path);
%%提取所有路径名下的ros文件放入bag中