提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
提示:以下是本篇文章正文内容,下面案例可供参考
一、Ubuntu的双显卡设置
1)我这里介绍的是使用两张显卡去处理这2个fisheye,因此显卡会有些特殊配置,包括分辨率,下图就是我想去实现的概况;
2)通过nvidia-setting将下面显卡和Screen绑定起来,因为VTD需要通过绑定Screen,并将IG分配到对应的显卡上;
3)显示器配置(配置多个显示器1920x1280 30HZ的视频输出):
打开/etc/X11/xorg.conf,需要配置2个Screen,2个monitor,2个Device,并且需要通过AW EDID Editor的方式修改每个屏幕的分辨率(可以使用xrandr命令修改分辨率,我尝试是失败的),具体配置如下所示:
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" 1280 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "DELL D2720DS"
HorizSync 30.0 - 88.0
VertRefresh 50.0 - 76.0
Option "DPMS"
EndSection
Section "Monitor"
Identifier "Monitor1"
VendorName "Unknown"
ModelName "DELL D2720DS"
HorizSync 30.0 - 88.0
VertRefresh 50.0 - 76.0
Option "DPMS"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "NVIDIA GeForce RTX 3080"
BusID "PCI:115:0:0"
EndSection
Section "Device"
Identifier "Device1"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "NVIDIA GeForce RTX 3080"
BusID "PCI:213:0:0"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "CustomEDID" "GPU-0.DP-0:/home/ubunutuds/Desktop/edid_19201280_30.bin;GPU-0.DP-2:/home/ubunutuds/Desktop/edid_19201280_30.bin;GPU-0.DP-3:/home/ubunutuds/Desktop/edid_19201280_30.bin;GPU-0.DP-4:/home/ubunutuds/Desktop/edid_19201280_30.bin" //这部分修改对应显示屏的分辨率,.bin文件是通过AW EDID Editor进行编辑的,自己使用的显示屏没有修改;
Option "Stereo" "0"
Option "nvidiaXineramaInfoOrder" "DFP-0"
Option "metamodes" "nvidia-auto-select +0+0"
Option "SLI" "Off"
Option "MultiGPU" "Off"
Option "BaseMosaic" "off"
SubSection "Display"
Depth 24
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Device1"
Monitor "Monitor1"
DefaultDepth 24
Option "CustomEDID" "GPU-1.HDMI-0:/home/ubunutuds/Desktop/edid_19201280_30.bin;GPU-1.DP-0:/home/ubunutuds/Desktop/edid_19201280_30.bin;GPU-1.DP-2:/home/ubunutuds/Desktop/edid_19201280_30.bin;GPU-1.DP-3:/home/ubunutuds/Desktop/edid_19201280_30.bin;GPU-1.DP-4:/home/ubunutuds/Desktop/edid_19201280_30.bin" //这部分修改对应显示屏的分辨率,.bin文件是通过AW EDID Editor进行编辑的,可以网上搜索教程;
#Option "nvidiaXineramaInfoOrder" "DFP-1"
Option "Stereo" "0"
Option "nvidiaXineramaInfoOrder" "DFP-1"
Option "metamodes" "DP-0: nvidia-auto-select +0+0, DP-2: nvidia-auto-select +1920+0"
Option "SLI" "Off"
Option "MultiGPU" "Off"
Option "BaseMosaic" "off"
SubSection "Display"
Depth 24
EndSubSection
EndSection
注意:配置完成后显卡2没有视屏输出,黑屏属于正常现象,不影响IG画面的显示;
二、双Fisheyes的配置过程
1)VTD中各文件的依赖关系:
配置2个IG,Simserver.xml,AutoCfg.xml,AutoCfgDisplay.xml,IGbase,之间的依赖关系是:
重要:由于鱼眼摄像头是需要畸变的,所以我们需要通过lensDistortion工具配置畸变表、分辨率、像素点大小、焦距、FOV角度等参数生成对应的AutoCfgDisplay.xml、IGbase、.dat畸变插件等配置文件,而实现摄像头以畸变的状态显示在IG上(lensDistortion工具是跟VTD拿的)。
注意:.dat文件需要放置在~Date/Setups/Project_name/ImageGenerator中;
3)Simserver需要做什么?
①复制2个IG的Process,并修改该对应的name和cmdline的参数,1个IG对应一个Process,如下图所示,更改红色部分。
代码如下(示例):
<Process
group="igGroup"
name="igCtr1"
auto="false"
explicitLoad="false"
path="$VI_CORE_DIR/ImageGenerator/bin"
executable="vigcar"
cmdline="$VI_CURRENT_SETUP/Config/ImageGenerator/AutoCfg1.xml -m 0x01"
useXterm="true"
xtermOptions="-fg Black -bg LightGoldenRod -geometry 80x10+508+163"
affinitymask="0xFF"
schedPolicy="SCHED_RR"
schedPriority="20"
workDir="$VI_CURRENT_SETUP/Bin">
<EnvVar name="LD_LIBRARY_PATH" val="$VI_CORE_DIR/ImageGenerator/bin:$VI_CORE_DIR/ImageGenerator/lib"/>
</Process>
<Process
group="igGroup"
name="igCtr2"
auto="false"
explicitLoad="false"
path="$VI_CORE_DIR/ImageGenerator/bin"
executable="vigcar"
cmdline="$VI_CURRENT_SETUP/Config/ImageGenerator/AutoCfg2.xml -m 0x01"
useXterm="true"
xtermOptions="-fg Black -bg LightGoldenRod -geometry 80x10+508+163"
affinitymask="0xFF"
schedPolicy="SCHED_RR"
schedPriority="20"
workDir="$VI_CURRENT_SETUP/Bin">
<EnvVar name="LD_LIBRARY_PATH" val="$VI_CORE_DIR/ImageGenerator/bin:$VI_CORE_DIR/ImageGenerator/lib"/>
</Process>
4)AutoCfg.xml需要做什么?
①找到对应Project文件夹中的 ~Data/Setups/Project_name/ImageGenerator/AutoCfg.xml,复制2个IG所需要的副本文件AutoCfg1.xml,AutoCfg2.xml。
②修改AutoCfg1.xml文件中的下述红色部分:
<IGconfig>
<Includes>
<Include file="IGLinks/Setup/Config/ImageGenerator/TopViewShadows.xml" />
<Include file="IGLinks/Setup/Config/ImageGenerator/IGbase1.xml" />
<Include file="IGLinks/Vig/data/Sky/HighContrastSky.xml" />
<Include file="IGLinks/Distro/Config/ImageGenerator/MaterialsHCS.xml" />
<Include file="IGLinks/Distro/Config/ImageGenerator/SymbolsStd.xml" />
<Include file="IGLinks/Distro/Config/ImageGenerator/LightSrcStd.xml" />
<Include file="IGLinks/Setup/Config/ImageGenerator/AutoCfgDisplay1.xml" />
<Include file="IGLinks/Setup/Config/ImageGenerator/AutoCfgDatabase.xml" />
</Includes>
</IGconfig>
③修改AutoCfg2.xml文件中的下述红色部分:
<IGconfig>
<Includes>
<Include file="IGLinks/Setup/Config/ImageGenerator/TopViewShadows.xml" />
<Include file="IGLinks/Setup/Config/ImageGenerator/IGbase2.xml" />
<Include file="IGLinks/Vig/data/Sky/HighContrastSky.xml" />
<Include file="IGLinks/Distro/Config/ImageGenerator/MaterialsHCS.xml" />
<Include file="IGLinks/Distro/Config/ImageGenerator/SymbolsStd.xml" />
<Include file="IGLinks/Distro/Config/ImageGenerator/LightSrcStd.xml" />
<Include file="IGLinks/Setup/Config/ImageGenerator/AutoCfgDisplay2.xml" />
<Include file="IGLinks/Setup/Config/ImageGenerator/AutoCfgDatabase.xml" />
</Includes>
</IGconfig>
5)AutoCfgDisplay.xml需要做什么?
①复制lensDistortion工具生成的AutoCfgDisplay.xml 文件到Project文件夹中的 ~Data/Setups/Project_name/ImageGenerator路径,建立2个IG所需要的副本文件AutoCfgDisplay1.xml,AutoCfgDisplay2.xml。
②配置对应的drawThreadCPUAffinity和 appCullThreadCPUAffinity到不同的CPU上,用于资源合理分配(命令窗口输入top,再按1,可以看到不同CPU的状态)
③配置IG到不同的Screen上;
④配置对应的鱼眼摄像头到不同的车辆安装位置;
③修改AutoCfgDisplay1.xml文件中的下述红色部分:
<IGconfig>
<SystemConfig>
<Graphics smallFeatureCullPixelSize="3.9" lodscale="0.9" gamma="1 1 1"
enableCursor="1" enableDatabasePagerThread="0"
drawThreadCPUAffinity="2" appCullThreadCPUAffinity="1" //递增数字即可,一般不用CPU0;
enableTransparencyAntialiasing="1" enableMultisampling="1"
schedulerStabilization="1" configurationProfile="HIGH_CONTRAST"
isLocalLightingSupportEnabled="1"
threadingModel="CullThreadPerCameraDrawThreadPerContext"
targetFramerate="60">
<RenderSurface name="Fisheye" x="0" y="0" width="1280" height="960" //name要和renderSurface中的一致;
depthBits="24" stencilBits="1" sampleBuffers="0"
samples="0" borderVisible="1" overrideRedirect="0"
displayNum="0" screenNum="0" pbuffer="0"/> //由于IG1显示在显卡0,因此配置到screenNum0上即可,displayNum按照Nvidia-settings→X Screen 0中的设置填写;
<Camera name="cam1" renderSurface="Fisheye" viewPortX="0" viewPortY="0"
viewPortWidth="1280" viewPortHeight="960">
<SymmetricPerspectiveAngles fovX="210" fovY="210" near="1" far="1000"
offsetHPR="180 -25.59 0" offsetXYZ="0 -3.804 0.874"/> //自定义修改该镜头的安装参数;
</Camera>
</Graphics>
</SystemConfig>
</IGconfig>
③修改AutoCfgDisplay2.xml文件中的下述红色部分:
<IGconfig>
<SystemConfig>
<Graphics smallFeatureCullPixelSize="3.9" lodscale="0.9" gamma="1 1 1"
enableCursor="1" enableDatabasePagerThread="0"
drawThreadCPUAffinity="4" appCullThreadCPUAffinity="3" //递增数字即可,一般不用CPU0;
enableTransparencyAntialiasing="1" enableMultisampling="1"
schedulerStabilization="1" configurationProfile="HIGH_CONTRAST"
isLocalLightingSupportEnabled="1"
threadingModel="CullThreadPerCameraDrawThreadPerContext"
targetFramerate="60">
<RenderSurface name="Fisheye2" x="0" y="0" width="1280" height="960" //name要和renderSurface中的一致;
depthBits="24" stencilBits="1" sampleBuffers="0"
samples="0" borderVisible="1" overrideRedirect="0"
displayNum="0" screenNum="1" pbuffer="0"/> //由于IG1显示在显卡0,因此配置到screenNum0上即可,displayNum按照Nvidia-settings→X Screen 0中的设置填写;
<Camera name="cam2" renderSurface="Fisheye2" viewPortX="0" viewPortY="0"
viewPortWidth="1280" viewPortHeight="960">
<SymmetricPerspectiveAngles fovX="210" fovY="210" near="1" far="1000"
offsetHPR="180 -25.59 0" offsetXYZ="0 -3.804 0.874"/> //自定义修改该镜头的安装参数;
</Camera>
</Graphics>
</SystemConfig>
</IGconfig>
安装镜头时需要参考坐标系,原点是车辆后轴中心:
6)IGbase需要做什么?
①复制lensDistortion工具生成的IGbase.xml到对应Project文件夹中 ~Data/Setups/Project_name/ImageGenerator/,建立2个IG所需要的副本文件IGbase1.xml,IGbase2.xml。
②修改IGbase1中的RDBInterface、PostProcessingPipelineConfigurator部分:
RDBInterface:
<RDBInterface name="MyRDBInterfaceCam1" printDebugInfo="0" ignoreShmFlags="0">
<ShmLayoutImage key="0x08130" />
</RDBInterface> //配置独立的name,key,用于摄像头数据读取;
PostProcessingPipelineConfigurator:
<PostProcessingPipelineConfigurator name="OriginalSceneConfiguratorCam1" >
<Pipeline hideSceneFromDefaultView="1" viewName="cam1">
TAKATA:
connectImageTransferTCP="0" //多个IG即使显存足够也会出现屏幕渲染帧率低,因此需要设置0;
②修改IGbase2中的RDBInterface、PostProcessingPipelineConfigurator部分:
RDBInterface:
<RDBInterface name="MyRDBInterfaceCam2" printDebugInfo="0" ignoreShmFlags="0">
<ShmLayoutImage key="0x08130" />
</RDBInterface> //配置独立的name,key,用于摄像头数据读取;
PostProcessingPipelineConfigurator:
<PostProcessingPipelineConfigurator name="OriginalSceneConfiguratorCam2" >
<Pipeline hideSceneFromDefaultView="1" viewName="cam2">
TAKATA:
connectImageTransferTCP="0" //多个IG即使显存足够也会出现屏幕渲染帧率低,因此需要设置0;
7)修改GUI中的Setup:
imgPortConnect设置成false;
完成设置,点击运行看看效果;
三、Fisheyes效果图