找回密码
 立即注册
查看: 596|回复: 0

Deepdrive on Unreal Engine 虚幻4无人驾驶模拟-代码Part-1

[复制链接]
发表于 2020-11-27 15:21 | 显示全部楼层 |阅读模式
上一篇文章Deepdrive on Unreal Engine 虚幻4无人驾驶模拟-Introduction我对Deepdrive 2.0的提出、设想、实现做了简要概述。
现在就来看看作者提供的程序代码吧!
GitHub :
    Deepdrive - Agents, training训练代码(net), and API to simulator 模拟器Deepdrive sim - Unreal project虚幻4项目, Unreal Plugin插件, assets配置, and Python extension
先简要介绍一下Deepdrive 2.0 的主要特点
    Modifiable source: Our AI, Unreal plugin, simulation assets and code, and Unreal Engine are all on GitHub, so you can modify the agent and the environment to automate labeling and iterate on ideas.Eight cameras with depth: Enable up to eight cameras with images and depth transferred at blazing speeds via shared memory (共享内存). i.e. Eight 512x512 48 bit RGB with 16 bit depth channel cameras, uncompressed on a GTX 980 over PCIe 3.0 x 16 are available at 20Hz as NumPy arrays.Linux / Windows support: First class support for Linux and Windows, one command python install.py, and you'll be piloting Deepdrive in minutes.Visual scripting: Quickly change anything in the simulation with Unreal Blueprints (虚幻引擎中的蓝图 - 可视化脚本系统) , using the full power of Unreal's C++ APIC++ extendability: Everything is C++ under the hood, so you can integrate existing systems and highly optimize anything you want.Python API: Interface through the Gym API using a reward function based on speed, safety, legality, and comfort
Deepdrive 2.0 的插件主要分为两块:

    Capturing:从simulation中提取任意数量的live streams、包含Agent的实时状态数据Control:Control capturing
Deepdrive Python C++拓展模块:
Deepdrive capture

    Reset : 重置Unreal Engine环境、与Shared Memory建立连接Step   :从UE获取下一个StepClose :关闭与Unreal Engine环境的链接
Capture模块主要包含以下几个cpp文件:
~ SharedMemory.cpp                        (Memory management、operation共享内存的管理、操作)
~ DeepDriveSharedMemoryClient.cpp  (Receive capture message从UE获取训练数据)
~ deepdrive_capture.cpp                   (Start/Close connection to shared memory共享内存的连接断开
                                                      Query next step from UE)
~ NumPyUtils.cpp                            (Copyvector3、Getvector3函数,数据操作)Deepdrive client

    Close  : Closes an existing client connection and frees all depending resourcesRegister_camera  :   Register a capture camera get_shared_memory :  Get data from shared memoryrequest_agent_control : Request control over agent release_agent_control : Release control over agentreset_agent : Reset the agent set_control_values :Send control value set to server
~ deepdrive_client.cpp   
~ DeepDriveClient.cpp:  Create/close client to Deepdrive Server
                                 Register camera
                                 Get shared memory name and size for client
                                 Control operation over agent
~ IP4Address.cpp
~ IP4ClientSocket.cpp:  Socket operation
~ NumPyUtils.cppExtra_compile_args

~ SharedMemoryImpl_Linux.cpp
~ IP4ClientSocketImpl_Linux.cpp
~ -std=c++11PyObject *res =
        g_SharedMemClient ? reinterpret_cast<PyObject*> (g_SharedMemClient->readMessage()) : 0;
/////////////////////////////////////////////////////////////////////////////////////////////
数据内容:
msg->
         capture_timestamp sequence_number
         speed
         is_game_driving is_resetting
         camera_count
         distance_along_route distance_to_center_of_lane
         lap_number
         steering
         throttle
         brake
         Handbrake
         position
         rotation
         velocity
         acceleration
         dimension
         angular_velocity
         angular_acceleration
         forward_vector forward_vector
         up_vector
         right_vector下一篇将对Deepdrive的数据Recording源码作详解。
何时是个头呀

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-12-25 14:50 , Processed in 0.100150 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表