2017-08-10 18:28:00 zhuyingqingfen 阅读数 2370
  • 虚幻4开发入门

    UnrealEngine向来以一流效果和难以上手而著称,本课程就是帮助你跨过入门的这道门槛,能够上手掌握这个国际一流的3D引擎。

    64988 人正在学习 去看看 房燕良
问题参见:http://blog.csdn.net/zhuyingqingfen/article/details/53147947
针对这个问题,有两种方法都是Ok的,
1. 在不同电脑间加上同步随机种子的功能。
2. 采用FixedSeed  方式  ,可以参见UE4的代码部分

FApp::bUseFixedSeed = bDeterministic || FApp::IsBenchmarking() || FParse::Param(FCommandLine::Get(),TEXT("FixedSeed"));


下图是在一台电脑上模拟测试的(左、中、右、下),等有时间可以测试一下多台电脑间的同步,理论上应该都是Ok的







1. 在单机情况下可以录制普通立体视频。

2. 在同步的情况下,可以输出高清同步立体视频,这样就可以在CAVE中播放了。



2017-09-15 18:00:58 cqh963852 阅读数 160
  • 虚幻4开发入门

    UnrealEngine向来以一流效果和难以上手而著称,本课程就是帮助你跨过入门的这道门槛,能够上手掌握这个国际一流的3D引擎。

    64988 人正在学习 去看看 房燕良

electron仿制UnrealEngine4蓝图功能模块


这里写图片描述
1. electron的下载和安装
2. 右键菜单的实现
右键菜单
累的吐血。。。
这里写图片描述
2017/9/22更新
菜单节点控制

var treeMenuNode = {
    instantObject: function (name,type) {
        var treeMenuNode = new Object();
        // console.log('generate treeMenuNode');

        treeMenuNode.name = arguments[0];
        treeMenuNode.tpye = arguments[1];
        treeMenuNode.childrenNodes = new Array();
        treeMenuNode.setChildrenNodes = function(array){
            // this.childrenNodes = arguments[0].slice();
            this.childrenNodes = arguments[0];
        }
        treeMenuNode.addChild = function(treeMenuNode){
            // console.log('addChild')
            this.childrenNodes.push(arguments[0]);
        }
        treeMenuNode.attacheTo = function(Node){
            // console.log('attacheTo')
            arguments[0].childrenNodes.push(treeMenuNode)
        }
        treeMenuNode.testfunction = function(){

        }
        treeMenuNode.traverse = function(textStack,tempStack){
            // console.log()
            // // console.log()
            // arguments[0].push(treeMenuNode.name);
            if(treeMenuNode.tpye == 'folder')
            {   
                arguments[0].push(
                '<customFolder>'+
                "<customFolderDeatils isOpen='false'>"+
                '>'+
                treeMenuNode.name+
                "</customFolderDeatils>"
                )
                // arguments[1].push(treeMenuNode)
                for(var i = 0;i<treeMenuNode.childrenNodes.length;i++)
                {
                    // console.log('test')
                    treeMenuNode.childrenNodes[i].traverse(arguments[0],arguments[1]);
                }
                arguments[0].push(
                    '</customFolder>'
                )
            }
            else
            {
                arguments[0].push(
                    '<customNode>'+
                    treeMenuNode.name+
                    '</customNode>'
                )
            }
            return;
        }
        return treeMenuNode;
    }
}

var treeMenuOptions = {
    instantObject: function(elem,MenuNodes){
        var treeMenuOptions = new Object();
        treeMenuOptions.elem = arguments[0];
        treeMenuOptions.treeMenuNodes = new Array();
        treeMenuOptions.treeMenuNodes = arguments[1];
        // console.log('generate treeMenuOptions')
        return treeMenuOptions
    }
}

var treeMenu = {
    instantObject: function (MenuOptions) {
        var treeMenu = new Object();
        treeMenu.treeMenuOptions = arguments[0];
        treeMenu.treeTextStack = new Array();
        treeMenu.treeTempStack = new Array();
        treeMenu.spawnTreeMenu = function(){
            for(var i = 0;i<treeMenu.treeMenuOptions.treeMenuNodes.length;i++)
            {
                treeMenu.treeMenuOptions.treeMenuNodes[i].traverse(treeMenu.treeTextStack);
            }
            var x = document.getElementById(treeMenu.treeMenuOptions.elem)
            x.innerHTML = treeMenu.treeTextStack.join('');
        }

        // console.log('generate treeMenu');
        return treeMenu;
    }
}


var treeMenuNode_1_3 = treeMenuNode.instantObject('testobject3');
var treeMenuNode_1_2 = treeMenuNode.instantObject('testobject2');
var treeMenuNode_1_1 = treeMenuNode.instantObject('testobject1');
var treeMenuNode_2_3 = treeMenuNode.instantObject('testobject3');
var treeMenuNode_2_2 = treeMenuNode.instantObject('testobject2');
var treeMenuNode_2_1 = treeMenuNode.instantObject('testobject1');


var treeMenuNode_1 = treeMenuNode.instantObject('object','folder');
var treeMenuNode_2 = treeMenuNode.instantObject('function','folder');
treeMenuNode_1.setChildrenNodes([treeMenuNode_1_1,treeMenuNode_1_2,treeMenuNode_1_3]);
treeMenuNode_2.setChildrenNodes([treeMenuNode_2_1,treeMenuNode_2_2,treeMenuNode_2_3]);


var myTreeMenuOptions = treeMenuOptions.instantObject('test',[treeMenuNode_1,treeMenuNode_2]);
var myTreeMenu = treeMenu.instantObject(myTreeMenuOptions);
myTreeMenu.spawnTreeMenu();
// console.log(myTreeMenu.treeMenuOptions.elem);
console.log(myTreeMenu.treeTextStack.join(''));

function addTree()
{
    var treeMenuNode_1_3 = treeMenuNode.instantObject('testobject3');
    var treeMenuNode_1_2 = treeMenuNode.instantObject('testobject2');
    var treeMenuNode_1_1 = treeMenuNode.instantObject('testobject1');
    var treeMenuNode_2_3 = treeMenuNode.instantObject('testobject3');
    var treeMenuNode_2_2 = treeMenuNode.instantObject('testobject2');
    var treeMenuNode_2_1 = treeMenuNode.instantObject('testobject1');


    var treeMenuNode_1 = treeMenuNode.instantObject('object','folder');
    var treeMenuNode_2 = treeMenuNode.instantObject('function','folder');
    treeMenuNode_1.setChildrenNodes([treeMenuNode_1_1,treeMenuNode_1_2,treeMenuNode_1_3]);
    treeMenuNode_2.setChildrenNodes([treeMenuNode_2_1,treeMenuNode_2_2,treeMenuNode_2_3]);


    var myTreeMenuOptions = treeMenuOptions.instantObject('test',[treeMenuNode_1,treeMenuNode_2]);
    var myTreeMenu = treeMenu.instantObject(myTreeMenuOptions);
    // myTreeMenu.spawnTreeMenu();
    // alert('123')
    // alert(myTreeMenu.treeTextStack.length)
    myTreeMenu.spawnTreeMenu();
}

暂时功能为:生成树状菜单,
需要结合css进行样式控制
控制js脚本进行折叠控制。
代码写在博客里面还是有点麻烦,等有空了去git开个仓库。思路写博客,代码存仓库

2017/9/27
调整项目结构
目录结构
渲染与页面分开
3. 节点的实现
4. 通过菜单放置节点
5. 节点的完善
6. 抽象二叉树的生成
7. LLVM接口调用
8. 程序运行
flag立好了,哈哈哈。

2017-11-23 13:50:18 zhuyingqingfen 阅读数 868
  • 虚幻4开发入门

    UnrealEngine向来以一流效果和难以上手而著称,本课程就是帮助你跨过入门的这道门槛,能够上手掌握这个国际一流的3D引擎。

    64988 人正在学习 去看看 房燕良


通过修改UnrealEngine4的源代码,可以让头盔和立体电视协同展示相同的画面,已经测试过的是SteamVR HTC vive头盔,理论上使用Ocluse 应该也是OK的,不过需要进一步测试。


整体效果还是很不错的,不会影响头盔的立体效果,也可以让电视同时出左右眼的主动立体。


临时占个坑,有空上图展示。


2017-11-19 09:38:13 CSDNhuaong 阅读数 4711
  • 虚幻4开发入门

    UnrealEngine向来以一流效果和难以上手而著称,本课程就是帮助你跨过入门的这道门槛,能够上手掌握这个国际一流的3D引擎。

    64988 人正在学习 去看看 房燕良

1. Airsim 概述

AirSim是基于Unreal Engine引擎或者Unity引擎,打造的一个无人机/无人车的仿真平台,凭借着Unreal Engine的性能,能够出色的进行基于计算机视觉算法的autonomous vehicles的仿真,AirSim在使用时作为一个UE4的插件,可以嵌到任意Unreal environment中,所以我们可以根据需求实现不同任务,不同场景的仿真。

Our goal is to develop AirSim as a platform for AI research to experiment with deep learning, computer vision and reinforcement learning algorithms for autonomous vehicles. For this purpose, AirSim also exposes APIs to retrieve data and control vehicles in a platform independent way.
         ——Microsoft

微软想把它打造成人工智能研究的仿真平台,以无人驾驶为主(比如自主无人机、自动驾驶汽车),在Airsim中跑深度学习,计算机视觉和强化学习算法。

2. Unreal Engine 概述

The Unreal Engine is a game engine developed by Epic Games.With its code written in C++, the Unreal Engine features a high degree of portability and is a tool used by many game developers today.The current release is Unreal Engine 4, designed for Microsoft Windows, macOS, Linux, SteamOS, HTML5, iOS, Android, Nintendo Switch, PlayStation 4, Xbox One and virtual reality (SteamVR/HTC Vive, Oculus Rift, PlayStation VR, Google Daydream, OSVR and Samsung Gear VR).

3. 在Linux下环境搭建

3.1. 手动 编译安装 UnrealEngine

UnrealEngine在github上私有的项目,https://github.com/EpicGames/UnrealEngine.git 不信你点点看。
但是只要你申请加入Unreal engine项目的组织,还是可以Clone下来的,具体步骤。

1、首先登陆UnrealEngine的缔造者Epic的官网,注册一个账号
2、然后在Epic的个人页面下–账号关联,关联到自己的GitHub账号 (这个关联表明你申请加入EpicGames的开发,他会向你发出一个加入邀请)
3、登陆GitHub,在https://github.com/EpicGames 确认邀请就可以了

这里写图片描述

接下来就按照Build It on Linux的步骤,下载、编译安装 就可以啦

git clone -b 4.18 https://github.com/EpicGames/UnrealEngine.git
cd UnrealEngine
//few times Epic folks broke the build so we will get commit that works
// git checkout af96417313a908b20621a443175ba91683c238c8
./Setup.sh
./GenerateProjectFiles.sh
 make
 //注意 UnrealEngine这个东西很占地方,不仅下载大,编译更大,所以你的HOME下至少要有20G的Free Space,不然等你编译的时候,空间占满了,就失败了,我开始就这样,后来把我的双系统Windows下的一个分区挂到home下的一个文件夹下,才解决。

3.2 编译airsim 插件

     # go to folder where you clone GitHub projects
     git clone https://github.com/Microsoft/AirSim.git
     cd AirSim
     ./setup.sh  // 配置依赖
     ./build.sh  //编译airsim库
     cd ros
     catkin_make // 编译airsim_ros接口
     

./Engine/Binaries/Linux/UE4Editor 执行这个这个路径下的可执行程序,启动Unreal Engine试试。有两点说明。

  1. 如果在初始化启动的过程中出错了(比如OpenGL的错误),说明你要按照NVIDIA的显卡驱动
  2. 这个软件很大,对显卡的显存要求也比较高

3.3 使用编译好的binaries环境+Airsim

These are experimental Linux binaries for Ubuntu 16.04
https://github.com/microsoft/AirSim/releases/tag/v1.2.0Linux

  • Africa (safari-like environment with moving animals and poachers)
  • Blocks
  • City (large environment with moving vehicles and pedestrians)
  • Forest
  • LandscapeMountains
  • Neighborhood (small urban neighbourhood block)
  • SimpleMaze
  • SubT
  • TrapCam (hunting trap camera simulator with large and small game)
  • Warehouse
  • ZhangJiaJie
场景 描述
Africa.zip 1.05G
Blocks.zip 327 MB
CityEnviron.zip.001 1.66 GB
CityEnviron.zip.002 1.24 GB
Forest.zip 1.17 GB
LandscapeMountains.zip 657 MB
Neighborhood.zip 1.42 GB
SimpleMaze.zip 423 MB
TrapCam.zip.001 1.76 GB
TrapCam.zip.002 1.33 GB
Warehouse.zip 837 MB
ZhangJiaJie.zip 517 MB

Source code (zip)
Source code (tar.gz)

OK 至此,Airsim+UnrealEngine 在Linux下的环境就搭建好了,可以自己先体验一下。
后面再分享Airsim+UnrealEngine的使用

4. 如何启动 无人车/无人机自动驾驶仿真环境

要启动基于Airsim+UnrealEngine4 搭建无人车/无人机自动驾驶仿真环境,需要两个方面:

  • airsim+UE4 也就是配置了airsim插件的UE4 environment
  • airsim settings 不同的配置可以设置不同的仿真类型/传感器类型等
  • airsim API, 有了以上两者,我们通过什么方式取回image, 得到vehicle的状态,并执行control cmd,这就要通过api与其进行数据交互。

首先关于airsim+UE4

  • 简单的方式,可以使用airsim发布的编译好的binaries环境,这种二进制文件,通过执行一个脚本可以直接运行。
  • 另一种方式是自己编译UE4,以及enviromnent,并且在环境中添加airsim plugin,这种方式更加灵活,有时编译容易出错,说版本不匹配。

其次关于settings.json的设置:

AirSim Settings.json 很总要

最后是airsim API

airsim 采用RPC网络通信,所以可以通过创建rpc client与仿真器的rpc server进行交互。airsim提供了C++ /Python的接口用于基于api的程序开发。可以参考相应的C++ APIs Guide设计

[参考文档]

5. 最简单的方式配置示例

实现UE4+airsim 实现无人机在simple_flight mode下带有双目+深度的模式

- 场景, 使用linux下预先编译好的 Block.zip 
执行命令: ./Blocks.sh

- settign文件
- api
- 

6. 四种仿真类型

{
  "SettingsVersion": 1.2,
  "SimMode": "Multirotor" // Car or ComputerVision
}

6.1 Hardware-in-Loop(HITL)

  • flight controller runs in actual hardware such as Naze32 or Pixhawk chip.
  • connect this hardware to PC using USB port
  • Simulator talks to the device to retrieve actuator signals and send it simulated sensor data
{
  "SettingsVersion": 1.2,
  "SimMode": "Multirotor",
  "Vehicles": {
    "PX4": {
      "VehicleType": "PX4Multirotor"
    }
  }
}

参考文档px4_setup.md

6.2 Software-In-Loop Simulation (SITL)

{
    "SettingsVersion": 1.2,
    "SimMode": "Multirotor",
    "Vehicles": {
        "PX4": {
            "VehicleType": "PX4Multirotor",
            "UseSerial": false
        }
    }
}
  • firmware runs in your computer as opposed to separate board

参考文档 px4_sitl.md
Airsim SIL简单说明

6.3 airsim simple_flight (default)

参考simple_flight.md

  • 特性:可以通过输入 angle rate, angle level, velocity or position的方式控制

6.4 Computer Vision (without flight controller)

{
  "SettingsVersion": 1.2,
  "SimMode": "ComputerVision"
}
  • In this mode, physics engine is disabled and there is no vehicle, just cameras
  • You can move around using keyboard (use F1 to see help on keys). Or you can call APIs to move cameras around and take images.
  • You can press Record button to continuously generate images.

7. 获取传感器的类型和数据

参考文档 sensors.md

airsim 目前支持六种类型传感器

Camera 
Barometer = 1
Imu = 2
Gps = 3
Magnetometer = 4
Distance Sensor = 5
Lidar = 6

7.1 camera数据

  • 首先指定哪个位置的摄像头,可以使用id或者name [“0”, “1”, “2”, “3”, “4”] or [front_center, front_right, front_left, bottom_center and back_center]
  • 指定图像的类型/分辨率以及各种相机参数
    图像的类型指 [场景图/深度图/视差图/语义分割图等等吧]
// ImageType 0~7
  Scene = 0, 
  DepthPlanner = 1,   //(更类似于双目深度估计结果SGM) all points that are in plan parallel to camera have same depth
  DepthPerspective = 2,//(类似于depth_image_proc 来参生点云)using a projection ray that hits that pixel.
  DepthVis = 3, //用于深度可视化的 从近到远被量化成 从黑到白
  DisparityNormalized = 4,// 视差图,视差被归一化0-1  use (Xl - Xr)/Xmax
  Segmentation = 5, //场景的语义分割图
  SurfaceNormals = 6,
  Infrared = 7 //根据 object ID 映射成 grey scale 0-255
{
  "SettingsVersion": 1.2,
  "CameraDefaults": {
      "CaptureSettings": [
        {
          "ImageType": 0,
          "Width": 256,
          "Height": 144,
          "FOV_Degrees": 90,
          "AutoExposureSpeed": 100,
          "MotionBlurAmount": 0
        }
    ]
  },
  "SimMode": "ComputerVision"
}

参考image_apis.md
一个获取双目和深度图的示例

7.2 Lidar data

{
    "SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/master/docs/settings_json.md",
    "SettingsVersion": 1.2,

    "SimMode": "Multirotor",

     "Vehicles": {
		"Drone1": {
			"VehicleType": "simpleflight",
			"AutoCreate": true,
			"Sensors": {
			    "LidarSensor1": { 
					"SensorType": 6,
					"Enabled" : true,
					"NumberOfChannels": 16,
					"RotationsPerSecond": 10,
					"PointsPerSecond": 100000,
					"X": 0, "Y": 0, "Z": -1,
					"Roll": 0, "Pitch": 0, "Yaw" : 0,
					"VerticalFOVUpper": -15,
					"VerticalFOVLower": -25,
					"HorizontalFOVStart": -20,
					"HorizontalFOVEnd": 20,
					"DrawDebugPoints": true,
					"DataFrame": "SensorLocalFrame"
				},
				"LidarSensor2": { 
				   "SensorType": 6,
					"Enabled" : true,
					"NumberOfChannels": 4,
					"RotationsPerSecond": 10,
					"PointsPerSecond": 10000,
					"X": 0, "Y": 0, "Z": -1,
					"Roll": 0, "Pitch": 0, "Yaw" : 0,
					"VerticalFOVUpper": -15,
					"VerticalFOVLower": -25,
					"DrawDebugPoints": true,
					"DataFrame": "SensorLocalFrame"
				}
			}
		}
    }
}

参考文档 lidar.md

Aerial Informatics and Robotics Platform 官方Airsim说明文档

【1/编译安装】
Unreal Engine + AirSim/docs/build_linux.md
[Unreal Engine + AirSim/docs/build_windows.md]

【2/启动与使用】

camera_views.md
通过F1开关camera settings.json设置image mode 机器性能影响帧率

flight_controller.md
简要说明 Flight Controller HIL SIL simple_flight PX4

hello_drone.md 介绍hello drone如何工作的
Airsim启动时,会启动RPC server, Hello Drone uses the RPC client to connect it.

multi_vehicle.md :Setting Up Multiple Vehicles

px4_build.md  
make posix_sitl_default
./build_posix_sitl_default/src/firmware/posix/px4 ./posix-configs/SITL/init/ekf2/iris

px4_setup.md PX4 Setup for AirSim
Setting up PX4 Hardware-in-Loop
Setting up PX4 Software-in-Loop

px4_sitl.md 详细讲Setting up PX4 Software-in-Loop

FAQ.md

log_viewer.md Log Viewer是一个数据调试工具

【3/深究Airsim】
design.md & paper

code_structure.md Airsim代码组织结构
AirLib包含(Physics engine、Sensor models、Vehicle models、Control library)
Unreal/Plugins/AirSim Unreal Engine中用于自动驾驶的一个插件
MavLinkCom  
Sample Programs 一些例程examples hellocar helloDrone Droneshell

custom_drone.md AirLib on a Real Drone

apis.md —— c++ API hello drone/ hello car
python.md——Python API接口使用
image_apis.md

reinforcement_learning.md Reinforcement Learning in AirSim

Remote Control.md 遥控的使用

Hardware-In-Loop Simulation)(HIL)

YouTube有关HIL using Airsim的视频教程
UE+AirSim& PX4+遥控器 在Windows环境下搭建

Pixhawk 有关硬件在环仿真的说明


强化学习demo
DeepQNeuralNetwork in AirSim using CNTK
https://github.com/Microsoft/AirSim/blob/master/PythonClient/DQNdrone.py

Autonomous vehicle navigation based on Deep Reinforcement Learnin using AirSim

参考文档:
Building On Linux

2016-11-04 23:38:33 insul 阅读数 2814
  • 虚幻4开发入门

    UnrealEngine向来以一流效果和难以上手而著称,本课程就是帮助你跨过入门的这道门槛,能够上手掌握这个国际一流的3D引擎。

    64988 人正在学习 去看看 房燕良
打不开ue4工程时或者运行UEEditor崩溃,删除临时文件,只需保留以下文件夹
Conifg,  Content & Source 以及 .uproject
没有更多推荐了,返回首页