0%

git不会读取和使用环境变量中的http_proxy和https_proxy来配置代理服务器,因此需要使用额外的git配置启用代理服务器。具体配置如下。

1
2
3
git config --global http.proxy http://{ip}:{port}
git config --global https.proxy http://{ip}:{port}
git config --global https.sslVerify false

第3行可以关掉ssl验证,在遇到证书问题时很有用。

在企业代理服务器之后使用docker时,需要配置代理服务器才能连接网络。然而,在docker desktop中配置了代理服务器,在docker build时却不生效。经过一番资料查阅,发现正确的方法如下:

1
docker build --build-args http_proxy=http://{ip_addr}:{port} --build-args https_proxy=http://{ip_addr}:{port} .

LAS是一种用于交换和存储激光点云数据的二进制数据格式。该格式由美国摄影测量与遥感学会(ASPRS)设计,在2003年发布了最初版本。该格式已经成为激光数据的事实标准。然而,LAS格式没有对数据进行任何压缩,所以文件大小通常都很大。

rapidlasso Gmbh.公司设计了LASzip,用于对LAS文件进行压缩,显著减小文件体积,压缩后的文件体积通常只有LAS文件的7%到20%。LASzip所使用的压缩算法不包含任何专利限制,软件使用LGPL license,易于集成,成为了LAS文件压缩的标准方法。

随着激光雷达设备在遥感,个人娱乐终端,自动驾驶等领域的应用,激光点云数据集数据量不断激增。在过去十年,激光点云压缩成为了产业界的研发热点。针对AR/VR娱乐领域,MPEG在2020年初推出了V-PCC和G-PCC两种压缩标准(链接)。谷歌针对点云网络传输的需求,推出了Draco。在自动驾驶领域,多篇学术文章探讨了针对车载激光雷达特点的点云压缩算法(Yu Feng et al. 2020)。在遥感和地图领域,LAS的互交换性得到广泛的认可,在多种GIS软件和地图服务器中兼容性好,并且具有较高的压缩率,因此适用于在高精地图和众包地图应用中使用。

LASzip简介

在介绍LASzip之前,先了解一下LAS点云文件。
LAS文件目前共有v1.0到v1.4数个版本,本文以最新的v1.4版本为例,LAS文件由文件头和数据记录组成,并且包含可选的可变长度记录(VLR)和扩展可变长度记录(EVLR)。

  • 文件头: 文件头包含文件版本,文件头长度等必要元信息;
  • 数据记录:文件标准要求统一使用小端顺序存储LAS数据记录。v1.4一共支持11种点数据格式,包含点云数据格式0 ~ 11。
  • VLR:在文件头之后可以包含可选的VLR数据,VLR数据包含参考坐标系信息,元信息,额外数据定义,或者其他用户自定义的信息。所有VLR的长度不超过65535字节。
  • EVLR:EVLR与VLR存储内容类似,但是允许存储更长的额外信息,并且附加在数据记录之后。
    关于LAS文件格式的更多信息,可以参考LAS 1.4的标准文件

LASzip文件格式

LASzip对于LAS文件头,VLR,EVLR不进行任何压缩,直接拷贝这些字段;只对数据记录段进行压缩。v1.4版本LAS文件与之前版本相比增加了多种点云数据格式,也就是类型6到类型10。针对v1.4版本LAS标准变化,LASzip也在听取了诸多开源社区建议之后,对v1.4版本LAS文件的压缩做出了相应改进。对于类型0-5的类型,文件格式和压缩方法与v1.0到v1.3版本的LAS压缩方法一致,不再叙述。使用类型6到10的点格式,v1.4版本的LAS文件使用最新的LASzip软件压缩后,.laz文件的典型结构如下:

  1. LAS文件头
  2. VLRs + LASzip VLR
  3. n个数据块(chunk)
    1. 块1
    2. 块2
    3. 块3

      块n
  4. 数据块表(块开始地址和点数量)
  5. EVLRs
  6. LASindex EVLR(用于未来实现更快的空间索引和查询)
  7. LASlayers EVLR(用于在文件中原地编辑点的分类和标识位)

数据块结构如下:

  1. 原始点
  2. 数量和字节数
    • 剩余点数
    • 每个层的字节数
  3. 数据记录层
    • 扫描通道、点来源变化、 GPS时间变化、扫描角度变化、返回计数、XY 层
    • Z 层
    • 分类层
    • 标志位层
    • 强度层
    • 扫描角度层
    • 用户数据层
    • 点来源ID层
      可选的:
    • RGB层
    • NIR层
    • 波形包层
    • 额外字节层
      与v1.0到v1.3版本的LAS文件压缩之后的格式相比,v1.4版本的.laz文件有两个主要变化:
  4. 数据块的大小可变;
  5. 每个数据块里按照不同字段分层编码。

LASzip压缩算法

LAS v1.4定义了0 - 10共11种点的类型,其中0-5型继承自v1.0 - v1.3版本,6-10型为v1.4新增类型。LASzip压缩器将不同点格式视作几种“成分”的组合。0-5型点格式由POINT10, GPSTIME10, RGB12, WAVEPACKET13和BYTE五种成分的不同组合表示。详见下表:
类型0-5的组成
6至10型的点由不同成分组成的“数据层”的组合表示。类型6至10的组成详见下表:
LAS v1.4类型6-10点

对每种数据LASzip设计了不同的压缩器。由不同成分组成的不同类型点可以复用这些压缩器,实现模块化复用。在每个数据块的开始,LASzip存储了第一个点的原始数据,并且初始化编码器。该点的数据用来作为后续预测的初值,之后每个点的数值全部依次进行编码。
LASzip采用了基于自适应的基于上下文的算术编码器对数值进行差分编码。对于每种不同的成分,采用不同策略进行压缩,追求最高的压缩率。详情可以参考文献。

LASzip压缩测试

测试数据准备

测试数据来自于众包地图构建中生成的一些道路点云数据集。数据集格式是二进制编码的pcd文件,在后续测试中,pcd格式文件的大小也是压缩率的基准。在本次测试中,一共准备了8组测试数据。

测试方法

  • 压缩倍率测试:
    1. 使用LASzip和zip对pcd文件进行编码,分别记录编码后文件的大小。
    2. 重复步骤1,多次测量,分别记录不同编码算法编码前后文件大小。
    3. 计算原始pcd文件大小之和,编码之后.laz文件大小之和,编码之后.zip文件大小之和。
    4. 根据公式“压缩倍率 = 原始文件大小 / 压缩后文件大小”计算多种编码方法的平均压缩率。
  • 编码速度测试:
    1. 使用PDAL库的writers.las模块测试.las、.laz文件的编码速度。
    2. 重复步骤1,对每一个数据pcd文件进行编码,记录所用时间。
    3. 根据公式“编码速度 = 模型点数/编码耗时”计算平均编码速度。
  • 解码速度测试:
    1. 对编码速度测试中生成的.las、.laz文件使用PDAL进行解码。
    2. 重复步骤1,对每一个文件解码,并计算总时间。
    3. 根据公式“解码速度 = 模型点数/解码耗时”计算平均解码速度。

测试结论

本文对LASzip的压缩性能进行了一些测试,下表对LASzip压缩测试结果进行了总结。

项目 PCD LAS LASzip GZIP
平均压缩倍率(源文件大小/压缩后文件大小) 1.0 0.42 4.61 1.52
编码+输出文件速度(万点/秒) - 21.3 17.8 -
解码速度(万点/秒) - - 51.8 -
点云存储效率 0.900 2.119 0.195 -
LICENSE BSD LGPL LGPL zlib license
LIBRARY PCL PDAL Libels Laszip Pylaz zlib

根据表格中的结果,可以得到以下结论:

  1. LASzip压缩算法的压缩倍率确实远高于通用压缩算法。
  2. LASzip编解码器的速度很快,可以满足自动驾驶的实时性要求。

LASzip项目集成

总的来说,LASzip具有压缩倍率高,无损,编解码速度快,受到业界广泛支持等优点,特别适用于高精地图和众包地图业务。在众包地图业务中,已经集成了LASzip作为点云存储格式。目前,比较流行的LASzip编解码库主要是LASzip,lazperf, 和PDAL。下面对这三种库进行比较。

  • LASzip:LASzip是rapidlasso Gmbh.官方出品的LASzip参考实现,使用c编码,对LASzip压缩算法的支持是最全面和可靠的,软件无专利限制,采用LGPL License,易于集成。
  • lazperf:lazperf是开源组织Hobu实现的LASzip替代编解码库。该库的实现采用C++编码,面向对象模式开发,更加直观简洁,据称在某些情况下性能更好。不过该库只能支持1.3之前版本的LASzip编解码,并且已经不再维护了。
  • PDAL:PDAL是主要由Hobu维护的一个点云数据抽象层库,采用LGPL授权,功能更加全面,远不止LASzip编解码功能,定位类似于适量和标量地图领域的GDAL。PDAL支持多种主流点云格式的编解码,点云的滤波等处理。PDAL对LASzip的支持也是通过封装LASzip库实现。相比c实现的LASzip库,功能更加全面,接口更加简洁。
    以上三个库都可以用于编解码LASzip,下表对他们的特性进行了一个总结。
LASzip Lazperf PDAL
License LGPL LGPL LGPL
支持LASzip v1.4
语言 c c++ c++
编码
解码
复杂功能
依赖其他第三方软件
是否符合车规

SimpleLight is a project I participate in Turku University. It’s an easy-to-use, web based remote control LED lamp.

Simple Light Project

Programmer: Gao Changyu, Qian Jiayan, Yang Xuerui
simplelightdemo

Hardware

The hardware is quite simple. We got 4 adafruit neopixel(ws2812b) led and connect them serially. The data in port is connected to pin 18, vcc and gnd are connected directly to raspberry pi.

Setup software for raspberry pi 2B

The project is configured for raspberry pi 2B. Before running the code, you need to install some dependencies.

  1. Install the newest raspbian image to a SD card. In our case, we use raspbian jessie.
  2. Connect the raspberry pi to the Internet with a cable. Log into the board with ssh.
  3. follow the instruction in (http://www.fernandocosentino.net/pyoconnect/) to install dependencies for PyoConnect 1.0.
  4. In the terminal, run the following commands to install other dependencies. $ sudo apt-get update
    $ sudo apt-get install git cmake nodejs mysql-server-5.5 libmysqlcppconn-dev python-mysqldb
    -y

when asked the root password of mysql, use 123456.

  1. configure the database: $ mysql -uroot -p
    mysql> create database lightcontrol
    mysql> use lightcontrol
    mysql> source ~/light_control_project/sql/database.sql
  2. get the source code: $ cd ~
    $ git clone https://github.com/gaochangyu/SimpleLight.git
  3. make the ws2812b_controller: $ cd ~/light_control_project/ws2812b_controller/
    $ cmake .
    $ make

Run the software

run the ws2812b controller:

$ sudo ~/light_control_project/ws2812b_controller/ws2812b_raspberry_pi2

run the webpage server:

$ nodejs ~/light_control_project/server/SimpleLight.nodejs

run the Myo Connect adapter:

$ python ~/light_control_project/PyoConnect_v1.0/light_control.pyoc

Enjoy it!

Connect raspberry pi to a router, then you can access the webpage at http://ip_of_raspberry_pi:3000. You should be able to change the light color of the leds through a palette (in mode one).
Myo connect is also supported. you can use double click gesture to change the visual effect.

  • mode 1: Rainbow Effect.
  • mode 2: Flash Effect.
  • mode 3: Flashing Rainbow Effect.
  • mode 4: Change the led color with the web palette.

Docs

All the documents about the project are in Docs folder.

a learning journal about class diagram.

I found a very useful website on this topic:reference.
Basically, now I know the meaning of different connections:

  • solid line with arrow: assosiation, means the static relationship between two classes along with the multiplicity.
  • solid line with triangle head: the inheritance feature of the object oriented concept. In Java this can relate to the “extends” keyword.
  • dotted line with arrow: Dependency is a relationship that shows that a class is dependent on another class for its existence or implementation.
  • dotted line with triangle head: This is related to the relationship between the class and the interface. The realization is equivalent to the “implements” keyword in Java.
  • solid line with hollow diamond: This shows “has a” relationship. It is a form of association relationship. This relationship highlights that a whole is made of its parts.So if a whole is destroyed the part still remains.
  • solid line with filled diamond: This is again a whole or part relationship where if the whole is destroyed then the part cannot exist independently. Another important point about Composition is that the part at any point in time can have only one owner.

In this blog, I will record the working progress in the capstone project and the problems I faced.

23.10.2016

  • changed the default hover controller. add three new actions PX4TakeoffAction, PX4LandAction and PX4 FlytoAction.

    30.9.2016

  • in statemachine, use file io to read a flight script.
  • in statemachine, timeout failure would be trigered if a state takes too long time.

    28.9.2016

  • modified the mode in states to OFFBOARD to match with PX4.

    5.9.2016

    Hover_Controller:
    Cablibrate the P I D and achieved better control. Proved that the controller structure is ok. But I still need to improve the controller structure itself.

    4.9.2016

    for the hover controller:
  • remove unnecessary files
  • rewrite the waypoint navigation logic
  • try to calibrate PID parameters but strange things always happen and the result gets even worse.

    26.8.2016

  • update the state machine and hover controller, now a simulation is achived but quite ugly.

    24.8.2016

  • update the state machine

    7.8.2016

    hover_controller: in gazebo simulation environment, the hover controller is now able to control a single drone to take off, land and navigate through the way point.

    7.6.2016

  • fix state machine compiling problem

    4.6.2016 - 7.6.2016

  • based on an APM FCU firmware, I started to code a position controller which is able to controll the quadcopter to takeoff ,land and fly through preset waypoints.

    28.5.2016

    mavlink streaming

Working Content: Today I tested the mavlink steaming rate of miniAPM. The original APM3.2.1 firmware support up to 25 Hz of message streaming. This is limited by the software, So I modified the firmware and successfully increased the rate to 50Hz. In fact the rate can be improved to up to 100 Hz. But I’m afraid this will harm the stability of the firmware.
In ArduCopter.pde, The scheduler update rate of gcs_data_stream_send() is set to 50Hz. This function is the regarding to the streaming of message. The function is in GCS_Mavlink.pde.

1
2
3
4
5
6
7
8
9
10
11
 \*  
\* send data streams in the given rate range on both links
\*
static void gcs\_data\_stream\_send(void)
{
for (uint8\_t i=0; i<num\_gcs; i++) {
if (gcs\[i\].initialised) {
gcs\[i\].data\_stream\_send();
}
}
}

In this function data_stream_send() is called, each stream is sent based on the following statement.

1
2
3
4
5
if(stream\_triger(STREAM\_RAW\_SENSORS)) {  
send\_message(MSG\_RAW\_IMU1);
send\_message(MSG\_RAW\_IMU2);
send\_message(MSG\_RAW\_IMU3);
}

The limit occurs in stream_triger(), as shown below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
if (stream\_ticks\[stream\_num\] == 0) {  
// we're triggering now, setup the next trigger point
if (rate > 50) {
rate = 50;
}else if(rate > 25){
stream\_ticks\[stream\_num\] = 0 + stream\_slowdown;
}else {
stream\_ticks\[stream\_num\] = (50 / rate) + stream\_slowdown;
}
return true;
}
// count down at 50Hz
stream\_ticks\[stream\_num\]--;
return false;

This is already my modified version. The stream_ticks is count down at 50 Hz. So when rate > 25, the streaming rate can not increase any more. So when rate > 25, I set the stream_ticks[stream_num] to 0, so they rate will go up to 50 Hz.
Time: 3 hour.

off board switch

Working Content: I figured out how every channel is used in Arducopter. channel 1 ~ channel 4 are used for throttle, roll, pitch, yaw. channel 5 is used for mode switch. channel 6 is optionally used for tuning and camera. channel 7 and above are aux switch for more functions. I think I can add a new auxilary function to switch on and off off-board mode. and connect the receiver’s channel 6 to channel 7. then we can use channel 6 on transmitter to toggle off-board.

24.5.2016

Working Content: I modified the pixy node and add a ros publisher. It doesn’t work at first with rosrun. Latter I found in the official guide of installation that I need to copy the /src/host/linux/pixy.ruls to /etc/udev/ruls.d reference.
Time: 1 hour.

19.5.2016

Working Content: I finally found the way to upgrade the firmware of the miniAPM. Before I tried to use the mission planner to upgrade the miniAPM but the transmission always fail. Today I downloaded an APM Planner to my mac and succesfully upgraded miniAPM to arducopter 3.2.1. In this version “arming” through mavlink is implemented. More over when the mavlink connection is down, the control will fail over to transmitter when RC_OVERRIDE is used. That’s also a good news.
Today I also modified the firmware source code of ArduCopter. I’m trying to enhance the failsafe feature in RC_OVERRIDE. I will enhance the code based on the orignal Arducopter 3.2.1 because that’s the newest firmware supported by miniAPM.
Time: 3 hours.

4.5.2016

Working Content: I tested the mavros arming service to arm the apm. It doesn’t work. But I don’t think it’s a bug of mavros. The mission planner cannot arm the apm neither.
I also tested the rcoverride function of mavros. It worked. The SYSID_MYGCS param of apm must be set to 1, so that the mavros can override the rc. But I found that once you use the rcoverride to take over the transmitter, you cannot use the transmitter to take over the mavros again. This would cause problem when I want to use the transmitter to take over the raspberry pi in emergency.
Improved the pan tilt control of pixy.
Time: 5 hours.

3.5.2016

Working Content: Calibrate the lens distortion (radial and tangental distortion) of the pixy camera. We used the camera_calibration sample code of opencv 2.4.9 to calculate the camera matrix and distortion coefficients. The focus length of pixy camera is adjustable, so every time I adjust the focus length I need to re-calibrate the camera. It’s not convinient.
We use the following equations to calibrate the distortion:
alt text
alt text
The calibrated result is acceptable but not accurate. Because we are not sure the meaning of x, y and r. I’m afraid there are some mistakes in not calculation.
Time: 5 hours.

2.5.2016

Working Content: Assembly and test fly the drone.
Time: 5 hours.

29.4.2016

Working Content: Assembly the drone.
Time: 5 hours.

28.4.2016

Working Content: Assembly the drone; Change the color marker recognition method from four different colors to two different colors.
Time : 5 houts.

8.4.2016

Working Content: update the CMakeList.txt of pixy_node. fix the compiling failure.
Time: 3 hours.

5.4.2016

Working Content: Checkout the mavros and mavlink submodule. fix the conflict of the submodules.
Time: 4 hours.

27.2.2016

Working Content: Improve the simulation environment. The apm sitl firmware is not realistic, and we would like to use PX4 autopilot stack. So I compiled the px4 sitl firmware on linux and upgrade gazebo to version 6.0.
Time :8 hours.

17.2.2016

Working Content: Set up the simulation environment in linux. The simulation environment includes the apm sitl firmware, the ros and gazebo simulation environment. I tested the simulation and it works.
Time: 8 hours.

ROS is a popular and useful software framework in robotics area. Gazebo is a powerful robotic simulator. Ardupilot provide a tutorial for sitl simulation in ROS/Gazebo environment. I tried to setup this environment in my mac. Here I share the record of my steps.

Set up ROS Gazebo APM SITL environment on Ubuntu

Install Ubuntu 14.04.3

  1. Download Ubuntu 14.04.3 64bit desktop edition image from ubuntu.com
  2. Install the system in virtual machine or as second operating system
  3. Set the username as developer and password as 12345678

Clone ardupilot source

  1. open terminal in ubuntu
  2. run sudo apt-get install git
  3. make a directory:mkdir workspace
  4. enter the workspace: cd workspace
  5. clone the source from github:git clone https://github.com/alexbuyval/ardupilot
  6. cd ardupilot directory and check out RangeFinderSITL2:cd ardupilot
  7. git checkout RangeFinderSITL2

Install ROS

  1. sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  2. sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116
  3. sudo apt-get update
  4. sudo apt-get install ros-indigo-desktop-full
  5. sudo rosdep init
  6. rosdep update
  7. echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
  8. source ~/.bashrc
  9. sudo apt-get install python-rosinstall

Create ROS Workspace

  1. mkdir -p ~/catkin_ws/src
  2. cd ~/catkin_ws/src
  3. catkin_init_workspace
  4. cd ~/catkin_ws/
  5. catkin_make
  6. echo "source $HOME/catkin_ws/devel/setup.bash" >> ~/.bashrc
  7. source ~/.bashrc
  8. echo $ROS_PACKAGE_PATH
  9. if you can see the following message, it’s successful:/home/developer/catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks

Clone/Install ROS package

  1. sudo apt-get install ros-indigo-octomap-msgs
    2.
     roscd
     cd ../src #Navigate in your ROS user source files directory
     git clone https://[email protected]/alexbuyval/arducopter_sitl_ros.git
     git clone https://github.com/PX4/mav_comm.git
     git clone https://github.com/alexbuyval/rotors_simulator.git
     git clone https://github.com/ros-drivers/joystick_drivers.git
     git clone https://github.com/ethz-asl/glog_catkin.git
     git clone https://github.com/catkin/catkin_simple.git
     git clone https://github.com/ethz-asl/gflags_catkin.git
     cd rotors_simulator
     git checkout sonar_plugin
     cd ../..
     wstool init src
     wstool set -t src mavros --git https://github.com/alexbuyval/mavros.git
     wstool update -t src
     rosdep install --from-paths src --ignore-src --rosdistro indigo -y
     
    
  2. compile the packages:roscd
  3. cd ..
  4. catkin_make
  5. if the catkin-make failed bacause the lack of gawk, run sudo apt-get install gawk
  6. setup PATH: echo 'PATH="$PATH:/home/developer/workspace/ardupilot/Tools/autotest"' >> ~/.profile

Install necessary python package

  1. sudo apt-get install python-pip
  2. sudo pip install pymavlink

Run the simulation

  1. cd ~/workspace/ardupilot/ArduCopter
  2. sim_vehicle.sh -f arducopter_sitl_ros --console

The simulation view

screen_shot

Reference

Using ROS/Gazebo Simulator with SITL