基于自动驾驶的虚拟感知展示(avs)

0x01是什么

提供了一个展示自动驾驶小车收集到的数据的方式
需要数据:kiitti数据,这里只是用了别人已经收集好的kitti数据。

这个项目可以实现
展示视频,展示收集到的点云数据
效果:

基于自动驾驶的虚拟感知展示(avs)_第1张图片
基于自动驾驶的虚拟感知展示(avs)_第2张图片
(这里我进行过了处理:为了加快访问的速度去除了视频,减少了点云的点数。后面会有具体的处理)

学习地址:AVS主页https://avs.auto/#/streetscape.gl/getting-started/starter-kit

0x02kitti数据
组织形式
基于自动驾驶的虚拟感知展示(avs)_第3张图片
参考https://blog.csdn.net/solomon1558/article/details/70173223

这里是我下载的
基于自动驾驶的虚拟感知展示(avs)_第4张图片
基于自动驾驶的虚拟感知展示(avs)_第5张图片
基于自动驾驶的虚拟感知展示(avs)_第6张图片
基于自动驾驶的虚拟感知展示(avs)_第7张图片
image_00 image_01 是灰度相机捕捉到的照片。
image_02 image_03 是彩色相机捕捉到的照片
timestamps.txt 文件里面记录了照片的时间信息
基于自动驾驶的虚拟感知展示(avs)_第8张图片

基于自动驾驶的虚拟感知展示(avs)_第9张图片
基于自动驾驶的虚拟感知展示(avs)_第10张图片
image_00:左侧灰度相机图像序列
image_01:右侧灰度相机图像序列
image_02:左侧彩色相机图像序列
image_03:右侧彩色相机图像序列
oxts:GPS/IMU位姿相关信息序列
velodyne_points:激光雷达数据序列
里面的一些其他文件是校验,连接的信息

kitti官网 http://www.cvlibs.net/datasets/kitti/raw_data.php

0x03流程

基于自动驾驶的虚拟感知展示(avs)_第11张图片
原始数据就是kitti数据

Xviz 地址https://github.com/uber/xviz 就是上图的server
原始数据转化为kitti数据------->运行 (运行起来之后会发送xviz数据给client client也可以同时运行在服务器,访问者只需要访问ip+port就行了)

streetscape.gl 地址https://github.com/uber/streetscape.gl 就是上图的client
进行数据处理和渲染在浏览器中显示。


0x04环境搭建

需要安装nodejs和yarn
在这里插入图片描述
安装npm的版本控制工具(就是设置nodejs的版本)

 npm install n -g

制定版本

$ n v10.15.3

换源
npm install -g cnpm --registry=https://registry.npm.taobao.org
yarn安装https://yarnpkg.com/lang/zh-hans/docs/install/#debian-stable
做完上述的操作会少很多错误。


0x05server
Xviz服务器说明

Xviz 地址https://github.com/uber/xviz
服务器端用来提供数据
1.下载kitti数据 ./scripts/download-kitti-data 2011_09_26_drive_0005
2. 安装依赖 yarn bootstrap
3. 转化ketti数据为xviz流并运行服务器 ./scripts/run-kitti-example.sh

原始kitti数据保存/root/AutoDrive/xviz/scripts/…/data/kitti/2011_09_26
生成的xviz数据保存在
/root/AutoDrive/xviz/scripts/…/data/generated/kitti/2011_09_26/2011_09_26_drive_0005_sync/

为了方便写了一个server启动的sh(目录需要根据自己的更改)

cd /root/AutoDrive/xviz/examples/converters/kitti
#--frame-limit=154 设置总帧数(并不是随机减少帧数,而是直接去除后面的帧)
# --disable-streams=image_01,image_02,image_03,image_00  这些照片将不会转化(最终的网页上不显示视频)
# /root/AutoDrive/xviz/data/kitti/2011_09_26/2011_09_26_drive_0005_sync  kitti数据下载到了这里
#生成的xviz数据保存到这里-o /root/AutoDrive/xviz/data/xviz/
 yarn start -d /root/AutoDrive/xviz/data/kitti/2011_09_26/2011_09_26_drive_0005_sync --frame-limit=154 --image-max-width=300 --disable-streams=image_01,image_02,image_03,image_00  -o /root/AutoDrive/xviz/data/xviz/

#运行服务
cd /root/AutoDrive/xviz/examples/server
yarn start -d /root/AutoDrive/xviz/data/xviz/

0x06客户端
streetscape.gl客户端说明

streetscape.gl 地址https://github.com/uber/streetscape.gl
进行数据处理和渲染在浏览器中显示。
yarn start 从github加载示例数据显示
yarn start-streaming 从服务器加载数据服务器的地址
流的设置 streetscape.gl-master/examples/get-started/src/log-from-stream.js
基于自动驾驶的虚拟感知展示(avs)_第12张图片

cd streetscape.gl
安装依赖
$ yarn bootstrap
启动
$ cd examples/get-started
$ yarn
$ yarn start 用这个命令会从默认的作者提供的服务器上面获取数据
或者$ yarn start-streaming 这个会从上面更改的流文件中获取数据

切换到服务器目录
$ cd ./examples/server
安装依赖项
$ yarn
启动服务器将其指向XVIZ数据文件夹
$ node index.js -d

运行客户端(记得把log-from-stream.js文件里面的ip和xviz服务器的ip对应)

cd examples/get-started
yarn start-streaming

/home/tower/1t/share/autoDrive/streetscape.gl-master/examples/get-started/src/log-from-stream.js 更改流

渲染需要加上地图这里加上了topmap的token进行访问
http://47.104.75.97:8080/?access_token=pk.eyJ1IjoidG93ZXIxMTEiLCJhIjoiY2p1aXA1NWZtMWQzdDRlcDRnaW1mdjM2MCJ9.xjJEsyWVHeMVMWfJefUM7A
如果8080端口被占用的话访问8082 8081端口用来传输xviz数据

0x07补充
为了加快访问速度,需要减少点云的数据。问了一下作者,这个功能暂时还没有,自己简单加了一个

代价是变得不清晰,不过速度会明显变快,配合上上面的禁用视频
# cat xviz/examples/converters/kitti/src/parsers/parse-lidar-points.js

import {Parser as BinaryParser} from 'binary-parser';
const parser = new BinaryParser().floatle();
 var STEP=5*4;      #这里的5表示美10个点显示5个
function readBinaryData(binary) {
  const res = [];

  for (let i = 0; i < binary.length; i = i+4 ) {
    if (i + 4 > binary.length) {
      break;
    }
    const parsed = parser.parse(binary.slice(i, i +4));
    res.push(parsed);
  }
  return res;
}
export function loadLidarData(data) {

  const binary = readBinaryData(data);
  const float = new Float32Array(binary);
  const size = Math.round(binary.length / STEP);

  // We could return interleaved buffers, no conversion!
  const positions = new Float32Array(3 * size);
  const colors = new Uint8Array(4 *  size).fill(255);

//dian de mi du
  for (let i = 0; i < size; i++) {
    positions[i * 3 + 0] = float[i * STEP + 0];
    positions[i * 3 + 1] = float[i * STEP + 1];
    positions[i * 3 + 2] = float[i * STEP + 2];

    const reflectance = Math.min(float[i * 4 + 3], 3);//zhe li
    colors[i * 4 + 0] = 80 + reflectance * 80;
    colors[i * 4 + 1] = 80 + reflectance * 80;
    colors[i * 4 + 2] = 80 + reflectance * 60;
    //you xie dian hui bu xian shi
  }
  return {positions, colors};
}


遇到的问题和解决方案

[root@VM_0_7_centos ~]# cd AutoDrive/xviz/
[root@VM_0_7_centos xviz]# yarn bootstrap
yarn run v1.15.2
$ scripts/bootstrap.sh
Bootstrapping xviz, installing in all directories
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
[5/5] Building fresh packages...
[-/5] ⡀ waiting...
[2/5] ⡀ puppeteer
[-/5] ⡀ waiting...
[-/5] ⡀ waiting...
error /root/AutoDrive/xviz/node_modules/puppeteer: Command failed.
Exit code: 1
Command: node install.js
Arguments: 
Directory: /root/AutoDrive/xviz/node_modules/puppeteer
Output:
ERROR: Failed to download Chromium r588429! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
{ Error: read ECONNRESET




error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[root@VM_0_7_centos xviz]# yarn bootstrap
yarn run v1.15.2
$ scripts/bootstrap.sh
Bootstrapping xviz, installing in all directories
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
[5/5] Building fresh packages...
[-/5] ⠈ waiting...
[2/5] ⠈ puppeteer
[-/5] ⠈ waiting...
[-/5] ⠁ waiting...
error /root/AutoDrive/xviz/node_modules/puppeteer: Command failed.
Exit code: 1
Command: node install.js
Arguments: 
Directory: /root/AutoDrive/xviz/node_modules/puppeteer
Output:
ERROR: Failed to download Chromium r588429! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
{ Error: read ECONNRESET




error Command failed with exit co

1.换yarn版本为1.10.0
2.换npm源
npm config set puppeteer_download_host=https://npm.taobao.org/mirrors
npm i puppeteer
npm install --save-dev puppeteer


/home/tower/1t/share/autoDrive/streetscape.gl-master/examples/get-started/src/log-from-stream.js  更改流


./scripts/run-kitti-example.sh
运行

运行客户端   yarn start-streaming


访问
http://localhost:8080?access_token=pk.eyJ1IjoidG93ZXIxMTEiLCJhIjoiY2p1aXA1NWZtMWQzdDRlcDRnaW1mdjM2MCJ9.xjJEsyWVHeMVMWfJefUM7A




rm -rf ~/.node-gyp
#rm -rf ~/.npmrc &&rm -rf ~/npm &&rm -rf node_modules # <- in project folder (这个我试过,我的问题不能被解决)

yum groupinstall "Development tools"
 xml2json组件安装错误

error /root/AutoDrive/xviz-master/examples/converters/kitti/node_modules/node-expat: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /root/AutoDrive/xviz-master/examples/converters/kitti/node_modules/node-expat
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp http GET https://nodejs.org/download/release/v10.0.0/node-v10.0.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v10.0.0/node-v10.0.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v10.0.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v10.0.0/SHASUMS256.txt
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/local/bin/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/root/AutoDrive/xviz-master/examples/converters/kitti/node_modules/node-expat/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/bin/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.node-gyp/10.0.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.node-gyp/10.0.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/bin/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.node-gyp/10.0.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/root/AutoDrive/xviz-master/examples/converters/kitti/node_modules/node-expat',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: 进入目录“/root/AutoDrive/xviz-master/examples/converters/kitti/node_modules/node-expat/build”
  CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlparse.o
make: cc:命令未找到
make: *** [Release/obj.target/expat/deps/libexpat/lib/xmlparse.o] 错误 127
make: 离开目录“/root/AutoDrive/xviz-master/examples/converters/kitti/node_modules/node-expat/build”
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/bin/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Linux 3.10.0-862.el7.x86_64
gyp ERR! command "/usr/local/bin/bin/node" "/usr/local/bin/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/AutoDrive/xviz-master/examples/converters/kitti/node_modules/node-expat
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok





error /root/AutoDrive/xviz-master/node_modules/puppeteer: Command failed.
Exit code: 1
Command: node install.js
Arguments: 
Directory: /root/AutoDrive/xviz-master/node_modules/puppeteer
Output:
ERROR: Failed to download Chromium r588429! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.


npm config set puppeteer_download_host=https://npm.taobao.org/mirrors
npm i puppeteer

你可能感兴趣的:(工具使用说明)