用MATLAB2020b和虚拟引擎(Unreal Engine)联合仿真输出AVM全景测试视频----配置并输出视频

原文参考:金书世界

参考:https://ww2.mathworks.cn/help/driving/ug/select-waypoints-for-3d-simulation.html

sceneName = 'LargeParkingLot';
[sceneImage, sceneRef] = helperGetSceneImage(sceneName);
sceneRef.XWorldLimits   % (in meters)
sceneRef.YWorldLimits   % (in meters)

显示如下

hScene = figure;
helperShowSceneImage(sceneImage, sceneRef)
title(sceneName)

存在报错但是不影响后续测试

开始描绘路线

hFig = helperSelectSceneWaypoints(sceneImage, sceneRef);

在图像开始描绘路线(如果不描绘直接执行下一步就是使用的默认路线

点击按钮后显示如下

点击去定按钮后显示如下(需要注意上述的wayPoints1和refPoses1,需要后面的代码输入的一致)

% Load variables to workspace if they do not exist
if exist('refPoses', 'var')==0 || exist('wayPoints', 'var')==0
    
    % Load MAT-file containing preselected waypoints
    data = load('waypointsLargeParkingLot');
    data = data.waypointsLargeParkingLot;
    
    % Assign to caller workspace
    assignin('caller', 'wayPoints', {data.waypoints1});%需要修改waypoints1
    assignin('caller', 'refPoses', {data.refPoses1});%需要修改refPoses1
end
numPoses = size(refPoses1{1}, 1);%需要修改refPoses1
refDirections  = ones(numPoses,1);   % Forward-only motion
numSmoothPoses = 50 * numPoses;      % Increase this to increase the number of returned poses
[smoothRefPoses,~,cumLengths] = smoothPathSpline(refPoses1{1}, refDirections, numSmoothPoses);%需要修改refPoses1

if ~ispc
    error(['3D Simulation is only supported on Microsoft', char(174), ' Windows', char(174), '.']);
end
modelName = 'VisualizeVehiclePathIn3DSimulation';
open_system(modelName);
snapnow;

显示如下

右侧的红框内的是没有的需要我们手动的添加

找到上述两个工具后添加到界面就和上述的界面显示相同了

配置左视的摄像头

双击Simulation 3D Fisheye Camera进入到一下界面并设置参数如下

双击To Multimedia File进入到一下界面并设置参数如下

左视的配置完成

同理设置右视

双击Simulation 3D Fisheye Camera进入到一下界面并设置参数如下

双击To Multimedia File进入到一下界面并设置参数如下

右视的配置完成

同理设置前视

双击Simulation 3D Fisheye Camera进入到一下界面并设置参数如下

双击To Multimedia File进入到一下界面并设置参数如下

前视的配置完成

同理设置后视

双击Simulation 3D Fisheye Camera进入到一下界面并设置参数如下

双击To Multimedia File进入到一下界面并设置参数如下

后视的配置完成

输入一下代码

% Configure the model to stop simulation at 5 seconds.
simStopTime = 50;%需要修改 决定运行的快慢
set_param(gcs, 'StopTime', num2str(simStopTime));

% Create a constant velocity profile by generating a time vector
% proportional to the cumulative path length.
timeVector = normalize(cumLengths, 'range', [0, simStopTime]);

% Create variables required by the Simulink model
refPosesX = [timeVector, smoothRefPoses(:,1)];
refPosesY = [timeVector, smoothRefPoses(:,2)];
refPosesT = [timeVector, smoothRefPoses(:,3)];

配置完成后开始运行

sim(modelName);%运行

显卡在燃烧

输出的结果视频保存路径

输出的测试视频

如果没有显卡或者想直接获取当前的视频直接使用请使用百度网盘下载

链接:https://pan.baidu.com/s/1Pqn6_t_eUPIBhLdjXq8Xxg?pwd=sqim 提取码:sqim 

  • 12
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值