Serious Autonomous Vehicles


  • Home

  • Archives

  • Tags

  • Search

未来5年在哪里11

Posted on 2019-10-29 |

真实一直有隐藏的一面,而那些窥视过隐藏面的人,注定于大多数人不同,光鲜或者孤独。想想不甘心做韭菜又上升无望的漫漫岁月,简直注定了人生悲剧。

脆弱的感情

自以为是个单纯的人,所以喜欢工程师氛围、高校科研氛围、美国的社区文化。回到国内,这些氛围都找不到了。扑面而来的气息,显得很黑暗森林。我怀疑一个单纯的人,在这样的环境下,如何能生存。所以,花尽心思去思考怎么顺应社会。话语中,充满了数字和术语,像一个机器在聊天,而不是一个有感情的人,女生都没办法接近我这样的人。

谈女生总会到一个话题,你稳定了吗。这个”未来5年“系列已经过了一年了,换环境、换公司、换小方向,到底有什么本质的变化,确定了一个方向,确定了一些问题吗?实际上都没有,甚至还没清楚自己要在哪里(国家、城市),做什么行业(汽车、咨询),都是一些自定义的限制。

小城市的行业

回来的火车上,遇见了小城的公务员一家去武汉旅游。他们在当地的审计局工作,每年有一些培训在全国各地,比如,南京、武汉。然后一年还有5~10天年薪假。所以一年会有一两次国内的旅行,长一个月,短半个月的。他们的工资在5千 ~ 6千,小城市买了房子,买了10几万的德国/日本车;单位同事,家底好的可以开30-40万的abb。

  • 体系内

学校、医院、法务机关、警察、税务、工商、建设、银行、电力、通信、交通、烟草、农林牧渔等等,庞大的网络可以解决三四线城市大量优质年轻人就业,因为是政府机关,在这些组织里面的年轻人,自然是党国的忠实跟随者。他们拿着高于当地平均值的工资,足够在小城市活的衣食无忧,甚至如上面的小夫妻,有车有房,有一年两次的度假。相比,大城市里租房、加班、年假等于零的奋斗青年,简直是苦逼。

  • 体系外

三四线城市,(政府)体系以外的行业典型: 美容养生、学生教育、餐饮、休闲娱乐(电影、健身、文化项目)、汽修、服装、家具,是属于可以创业的行当。江浙以外,很少有三四线城市有自己的传统支柱产业,比如,农产品加工、能源石化、机械加工、小商品生产等等;更鲜有高附加值支柱产业,诸如,电子器件产业群、芯片产业群、汽车产业群、生物制药产业群、it产业群、精密制造产业群、金融服务业等等。

小城就一家国有钢铁厂,因为北方的能源、钢铁产能过剩,也气数不多。在这些小城市发展高附加值的产业,相当于空中楼阁。所以,体系外的年轻人生存状态其实很空心化。

  • 空心化

“空心化”不是对服务业的贬低,但是相比发达欧美国家的小城市,它们会有一些其貌不扬,但历史百年的世界级的公司和产品。比如,德国狼堡,世界汽车产业中心;美国密西根奥本山小镇,世界级汽车应用软件商聚集地。生活在这些地方的年轻人,当然可以选择进入当地的服务业,诸如快餐连锁、超市服装、甚至房租装修、水电工等等。但是对于做研究、懂技术的年轻人,他们也能找到很容易进入一个创造绝对价值的公司。国内三四线小城市的“空心化”,就是除了传统的服务行业以及政府体系可以吸纳年轻人之外,缺乏生产绝对价值的支柱公司。

倒逼年轻人只能进入传统服务业或者政府机构,能够发挥年轻人创作力的机会太少了。服务业是景上添花,没有高附加值制造业的世界地位,服务业只会被局限在传统的衣食住行。这样一个显著的问题,就是影响了年轻人的价值体系。研究生毕业以后,收入水平、价值实现竟然不如隔壁小学毕业开早点的王老二。那国家投入这么多教育,是为了让这些年轻人去自卑吗。

  • 结局

愚民之策,老百姓根本看不到问题,实际上在短期内,服务业是滞后价值创造产业的。开早点的王老二,还可以一个月赚5万,而且不需要为一个大学毕业生买单。长远点,低端/传统服务业,比如餐厅、修车店、服装店会慢慢饱和,甚至开展恶性竞争。每家新开的餐厅,头两个月可以吸引顾客,之后就被隔壁新开的餐厅带流量了。

一旦大部分传统服务行业进入这个阶段,除了政府直接控制的体系内,老百姓可能就受不了。要么政府强行维稳,全国陷入“中等收入陷阱”。要么社会就会开始乱。

中国有大量的三四线城市,可能都面对“空心化”的问题。大概率进入“中等收入陷阱”。看到问题而又无奈的人,会选择在这场演化之前逃离。国家层面的软实力,不是一天能建立起来的。这恐怕也是中国虽然有着表面的gdp数据,但实际上社会系统相比成熟的发达国家还差很远的地方。如果在演进之前,能慢慢发展出好的系统话。

自动驾驶失业潮

有预测,到2030年,l3+自动驾驶的行业渗透可能只在10%。相比普遍的乐观预测,到2020年以后,l3+前装量产。国内近来发了一些很政策导向的产业牌照:全球第一张5G商用牌照, 全球第一张自动驾驶商用牌照。相比,苹果在2020年都不会上5G,美国撤销自动驾驶交通委员会。到底是国内领先,还是国家在画大饼?要保障这么多新生劳动力进入市场,国家也很南啊。

政策可以画行业大饼,但市场比政策更理性。waymo已经被资本市场降低估值,应该就是市场对这个行业的真实回应。按照资本的延后性,大概这个行业的裁员潮会尾随而来。

如果失业了,新职业选择在哪里?变化是永恒的。越是高级的打工仔,受裁员影响越高。在互联网级的快速迭代市场,专业的深度也许不如专业的可移植性对打工仔更合适。

进军服务业

看《中国机长》又一次加深的这样的体会。飞机设计、航空发动机、自动驾驶飞控系统是远在普通人的关心之外的;相比,机长、空姐、机场运营人员、服务人员容纳着大量就业,也最直接产生价值。而且他们服务产生的价值,也是经济活力的主要贡献和决定者。相比,虽然国家没有自主的民航发动机、没有自主的cae软件,谁又觉得有什么问题呢。不过是一小群人为此担忧,大部分百姓甚至政策决策者只需要看到中国的航运数据又上升了,航运公司对各地gdp的贡献又大了,就可以士气高涨。

离客户越近,价值越大。在核心技术没有先发优势的市场,做技术只是backup的需求。相比,服务业更靠近广大终端客户人群,价值传递最短、损耗最小、获利最大。所以,空心化后的精英都会去高附加值服务业,比如,金融、互联网。

我们确实不该操政策精英的心,相比,做一个短视的普通人,识时务,进挣钱的行业,就是普通人该干的。

所以,还是要好好准备mba。

未来5年在哪里 12

Posted on 2019-10-29 |

国内工作半年了,先后对开源的仿真软件做了定制化实现,对高精地图、ros、场景定义等有了大量快速的接触。同时也搭建了团队的gitlab, jenkins服务, rosbag管理服务、webviz服务,pg地图服务等等,并且也投入了一些时间去搭建数据基础框架,但并没有实际业务需求。在传统oem,用DevOps去规范开发流程,以及探索数据业务、云服务等相对较新颖。相对,新兴的造车企业,会比较好的融合DevOps流程,开发上云。

本质上是开发ADS支撑工具及数据基础设施,但由于OEM内部的ads开发团队比较弱,这些支撑工具以及数据工具并不发挥价值。作为工具开发者,存在感会变弱。因为离核心业务较远,虽然技术很通用。

OEM’s role in emerging tech

OEM itself mostly doesn’t build tools itself, even like Ford, who hired a great team to develop CAE tools in early days and build them tremendous, still retired most of them or sell them as packages to pure software vendors later.

on the other side, the pioneers or leaders of the industry, usually build and apply new methodlogy before the market is there. and after the market is there, they can have the professional team to take in charge. the leaders take the role as incubators, as many Internet startups got the ideas from giants e.g. Google, Facebook e.t.c

ADS at this moment is the emerging tech, there is no mature solution or tool chain for ADS, so the leaders of automobile makers and suppliers are the guys who should take the lead to set up standards and tools till ADS market goes to mature. and the giants in automobile should catch this great opportunity to take control in long term.

the problems of Chinese OEMs (sadly there is no strong Chinese suppliers yet), they are customed to be followers, when US or German auto makers do the research and make the new bussiness stratagey, Chinese OEMs will follow. as the blog said, Chinese has no friend, neither Chinese goverment. be the followers or imitators is minimal loss strategy for most Chinese companies as well. and this is also why west coutry companies are afriad of the competition from Chinese. Chinese take copy others ideas as a strategy to success, rather than a shame.

a tool developer

机缘巧合,职业最初,就属于工具支撑组,开发和维护工具。随着,ads的爆发,more and more software skills are required by tradititional automobile makers and suppliers; and they prefer transfer themselves to modern digital driven. but a special tool is never the core product of auto makers.

there comes a time, the OEM engineers asked, why you guys build tools, rather than buy from suppliers. The right thing for OEMs is to integrate components, rather than building tools.

the cost of building tools by OEM itself is really too much after a while we realized. But at first, OEMs thought it was too costy to buy commecial tools, which gives survival space of a small team to grow inside OEM teams.

actually at the early time, small team dreams big, especially in these days, many open source projects can be used freely. the small team almost support every aspect related to software tools, and as well to add features to simulation platform, which is also based on an open source project lg-sim, software manager looks like a good role in the team. but the reality is, to customize any tool, will cost a huge energy for a small team, as we are not involved in these open source projects. more, the manager team doesn’t consider an independent tool team. and even like this, we are moving slowly.

infrasturcture for ABC

for ADS startups, they emphasize their infrasturcture features with :

  • cloud platform
  • remote monitor/control system (for vehicle team management)
  • OTA
  • data infrastructure(storage, management, analysis)

and in single vehicle features with powerful computing ability, from GTC 2018 speak, most startup use the powerful Xdriver GPU;

  • WeRide
  • Momenta
  • Tusimple
  • AutoX
  • Roadstar.AI (dead)
  • plusAI
  • ponyAI

all these looks very Internet, but too far from massive vehicle product. the other mind is these teches are actually common for average engineers, but the chanllenge is to build a team, to realy make it work.

survive in OEM

it’s maybe more interested to take myself as an ABC(AI, big data, cloud computing) guy to find application scenarios in automobile industry product development. while ABC application scenarios are not matured yet of course, usually it is driven by leader teams, when it comes to drive by market, may be too late.

beyond automotive, industry IoT maybe an even general domain to quickly apply ABCs. there should be three steps:

  • familiar with the tech methods

  • understand the hurting points of the industry

  • product and management update -> value return

the life leap happens to a few lucky guys. most guys are common and grow in a linear speed. there is a burden the more you know, the harder your life. sadly …

digitalize

OEMs are involved more and more in transfering digital, smart. previously most invovled in market, ads strategy, supply chain management; and as connected vehicles, self driving, future mobility service bursting in recent years, digitalization is sinking in vehicle product R&D. AI, big data, cloud, blockchain e.t.c. new techs will be transfering the traditional industry. hopefully we can define the new bussniess together.

lg-sim source code review (2019.09)

Posted on 2019-10-22 |

the recent version of lg-sim 2019.09 has additionally support for webUI, cloud, which is a big enhencement. the following code review is focusing on new components to support WebUI, cluster management.

database

database used sqlite project, which is an embedded in-memory db; the ORM used PetaPoco project; there are a few db related serices, e.g. vehicleService, simulationService, which will be used in RESTful web request.

  • DatabaseManager:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
static IDatabaseBuildConfiguration DbConfig ;
Init(){
DbConfig = GetConfig(connectionString)
using db = new SqliteConnection(connectionString){
db.Open()
}
CreateDefaultDbAssets(){
using db = Open()
if (info.DownloadEnvs != null){
map = new MapModel(){url = url LocalPath=localPath;}
id = db.Insert(map)
}
if (info.DownloadVehicles != null){}
if(defaultMap.HasValue)
{
sim1 = new SimulationModel(){ Cluster=0, Map=defaultMap.Value, ApiOnly=false};
AddSimulation(db, sim1, noBridgeVehicle);
AddSimulation(db, sim, apolloVehicle);
db.Insert(simx)
}
}
AddSimulation(IDatabase db, sim,vehicle){
conn = new ConnectionModel(){
simulation = id,
vehicle = vehicle.Value,
}
db.Insert(conn)
}
AddVehicle(db, sim,vehicle){
conn = new VehicleModel(){
Url = url ,
}
db.Insert(vehicle)
return vehicle.Id;
}
PendingVehicleDownloads(){
using db=Open(){
var sql = Sql.Builder.From("vehicles").Where("status=00", "Downloading");
return db.Query<VehicleModel>(sql);
}
}

database ORMs

using PetaPoco to define ORM models, such as
users, sessions, maps, vehicles, clusters, simulations

PetaPoco

a few operators in PetaPoco, such as Page, used to query a page; Single, used to query a single item; Insert; Delete; Update

database provider

1
2
3
SQLiteDatabaseProvider =>
GetFactory("Mono.Data.Sqlite.SqliteFactory, Mono.Data.Sqlit")

called inside DatabaseManager::Init().

database services

  • VehicleService : IVehicleService

  • MapService

  • NotificationService => NotificationManager.SendNotification()

  • DownloadService => DownloadManager.AddDownloadToQueue()

  • ClusterService

  • SessionService

  • SimulationService

Web model

web model is where WebUI server located, which is served by Nancy project, in which a new design metholody is applied: Inversin of Control Contaner(IoC), namely 控制反转 in chinese. IoC is used to inject implementation of class, and manage lifecycle, dependencies.

web model is the server where talk to webUI through routes, which is defined in the React project.

Nancy

used to build HTTP based web service,

  • FileStream
  • StreamResponse
  • TinyIoC
  • UnityBootstrapper : DefaultNancyBootstrapper, used to automatic discovery of modules, custm model binders, dependencies.
  • /Assets/Scripts/Web/Nancy/NancyUnityUtils
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
ConfigureApplicatinContainer(TinyIoCContainer container)
{
container.Register<UserMapper>();
container.Register<IMapService>();
container.Register<IClusterService>();
container.Register<IVehicleService>();
container.Register<ISimulationService>();
}
```
### route modules
```c#
SimulationModule : NancyModule()
{
class SimulationRequest{}
class SimulationResponse{}
Get("/", x={})
Post("/", x={})
Put("/{id:long}", x={})
Post("/{id:long}/start", x={})
Post("/{id:long}/stop", x={})
}

inside some of the route modules will do query or update the sqlite database for special objects. till here is the complete web back-end server, with a http server and an in-memory database.

the webUI frontend is based on React, about React check a previous blog. in the React WebUI project will have http requests corresponding to each of routes defined here.

React front end is very independent framework, which should be handled by an independent team in standard pipeline.

Config & Loader

  • /Assets/Scripts/Web/Config.cs:

used to define WebHost, WebPort, ApiHost, ClourUrl, Headless, Sensors, Bridges e.t.c

  • Loader.cs :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Loader Instance ; //Loader object is never destroyed, even between scene reloads
Loader.Start(){
DatabaseManager.Init();
var config = new HostConfguration{} ; // ?
Server = new NancyHost(Config.WebHost);
Server.Start();
DownloadManager.Init();
}
Loader.StartAsync(simulation){
Instance.Actions.Enqueue() =>
var db = DatabaseManager.Open()
AssetBundle mapBundle = null;
simulation.Status "Starting"
NotificationManager.SendNotification();
Instance.LoaderUI.SetLoaderUIState();
Instance.SimConfig = new SimlationConfig(){
Clusters, ApiOnly, Headless, Interative, TimeOfDay, UseTraffic...
}
}
Loader.SetupScene(simulation){
var db = DatabaseManager.Open()
foreach var agentConfig in Instance.SimConfig.Agents:
var bundlePath = agentConfig.AssetBundle
var vehicleBundle = AssetBundle.LoadfromFile(bundlePath)
var vehicleAssets = vehicleBundle.GetAllAssetNames();
agentConfig.Prefab = vehicleBundle.LoadAsset<GO>(vehicleAssets[0])
var sim = CreateSimulationManager();
Instance.CurrentSimulation = simulation
}
  • DownloadManager

class Download();
Init(){ client = new WebClient();  ManageDownloads(); }

network module

network module is used for communication among master and clients(workers) in the cluster network for cloud support. the P2P network is built on LiteNetLib which is a reliable UDP lib.

LiteNetLib

LiteNetLibis Udp package, used to P2P communication among master node and slave nodes here, where are defined as MasterManager, ClientManager.

usage of LiteNetLib can be found in the wiki-usage)

IoC in C#

Posted on 2019-10-22 |

Inversion of Control(IoC) is a design mechanism to decouple components dependencies, a light-weight implementation is: TinyIoC, which is also part of Nancy.

IoC idea uses commonly in webUI(and backend server) apps, which is an user friendly solution to cloud deployment management as well as apps in mobile, which should be the right direction in future ADS software tool development.

the idea of IoC can be explained by the following example from register and resolve in unity container

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
public interface ICar
{
int Run();
}
public class BMW : ICar
{
private int _miles = 0;
public int Run()
{
return ++_miles;
}
}
public class Ford : ICar
{
private int _miles = 0;
public int Run()
{
return ++_miles;
}
}
public class Driver
{
private ICar _car = null;
public Driver(ICar car)
{
_car = car;
}
public void RunCar()
{
Console.WriteLine("Running {0} - {1} mile ", _car.GetType().Name, _car.Run());
}
}

the Driver class depends on ICar interface. so when instantiate the Driver class object, need to pass an instance of ICar, e.g. BMW, Ford as following:

1
2
3
4
5
6
7
8
9
10
11
12
Driver driver = new Driver(new Ford());
driver.RunCar()
```
**to use IoC**, taking UnityContainer framework as example, a few other choices: TinyIoC e.t.c.
```c#
var container = new UnityContainer();
  • Register

create an object of the BMW class and inject it through a constructor whenever you need to inject an ojbect of ICar.

1
2
container.Register<ICar, BMW>();
  • Resolve

Resolve will create an object of the Driver class by automatically creating and njecting a BMW object in it, since previously register BMW type with ICar.


Driver  drv =  container.Resolve<Driver>();
drv.RunCar()

summary

there are two obvious advantages with IoC.

  • the instantiate of dependent class can be done in run time, rather during compile. e.g. ICar class doesn’t instantiate in Driver definition

  • automatic new class management in back.

the power of IoC will be scaled, once the main app is depends on many little services.

rosbag tools in ADS

Posted on 2019-10-21 |

background

in ADS, data fusion, sensor performance, L3+ perception, localization algorithms development relys a lot on physicall data collection, commonly in rosbag format with information/data about gps, rtk, camera, Lidar, radar e.t.c.

to build up the development process systemly is a critial thing, but also ignored by most ADS teams. for large OEMs, each section may have their own test vehicles, e.g. data fusion team, sensor team e.t.c, but few of them take care data systematically, or build a solution to manage data. one reason is the engineers are lack of ability to give software tool feedbacks/requirements, so they still stay and survive with folders or Excel management, which is definitely not acceptable and scalable for massive product team.

thanks for ROS open source community conributing a great rosbag database manage tool: bag_database. with docker installation, this tool is really easy to configure. a few tips:

  • web server IP port in Docker can be accessed from LAN by parameter -p during docker run.

mount sbm drive

as mentioned, most already collected rosbag is stored in a share drive, one way is to mount these data.

1
2
3
4
sudo mount -t cifs //share_ip_address/ROS_data /home/david/repo/rosbag_manager/data -o uid=david -o gid=david -o credentials=/home/david/repo/rosbag_manager/data/.pwd
sudo umount -t cifs /home/david/repo/rosbag_manager/data

Tomcat server configure

bag_database is hosted by Tomcat, the default port is 8080. For our services, which already host pgAdmin4 for map group; gitlab for team work; xml server for system engineering; for webviz. check the port is occupied or not:

1
netstat -an | grep 8088

so configure /usr/loca/tomcat/conf/server.xml:

1
2
3
4
5
<Service name="Catalina">
<Connector port="your_special_port"
...
</Service>

a few other tools

ros_hadoop

ros_hadoop is a rosbag analysis tool based on hdfs data management. which is a more scalable platform for massive ADS data requirements. if there is massive ros bag process in need, ros_hadoop should be a great tool. there is a discussion in ros wiki

image

image

install hadoop

apache hadoop download

single alone install

concept in hdfs

  • namenode

daemon process, used to manage file system

  • datanode

used to data block store and query

  • secondary namenode

used to backup

  • hdfs shell command

  • hdfs path URL

hdfs-site.xml

/usr/local/hadoop/etc/hadoop/hdfs-site.xml

configure file

  • dfs.datanode.data.dir -> local file system where to store data blocks on DataNodes
  • dfs.replicaiton -> num of replicated datablocks for protecting data
  • dfs.namenode.https-address -> location for NameNode URL
  • dfs.https.port ->

copy local data into hdfs


hdfs dfs -put /your/local/file/or/folder   [hdfs default data dir]

hdfs dfs -ls

mongodb_store

mongodb_store is a tool to store and analysis ROS systems. also in ros wiki

mongo_ros

mongo_ros used to store ROS message n MongoDB, with C++ and Python clients.

mongo-hadoop

mongo-hadoop allows MongoDB to be used as an input source or output destination for Hadoop taskes.

ros_pandas

rosbag_pandas

tabbles

tabbles used to tag any rosbags or folders.

hdfs_fdw

hdfs for postSQL

at the end

talked with a friend from DiDi software team, most big Internet companies have their own software tool teams in house, which as I know so far, doesn’t exist in any traditional OEMs. is there a need for tool team in OEMs? the common sense is at the early stage, there is no need to develop and maintain in-house tools, the commericial ones should be more efficient; as the department grows bigger and requires more user special development and commericial tools doesn’t meet the needs any more, tool teams may come out. still most decided by the industry culture, OEM’s needs is often pre-defined by big suppliers, so before OEMs are clear their software tool requirements/need, the suppliers already have the solutions there – this situation is epecially true for Chinese OEMs, as their steps is behind Europen suppliers maybe 50 years.\

I am interested at the bussiness model of autovia.ai, which focus on distributed machine learning and sensor data analytics in cloud with petabyte of data, with the following skills:

  • large scale sensor data(rosbag) processing with Apache Spark

  • large scale sensro data(rosbag) training with TensorFlow

  • parallel processing with fast serialization between nodes and clusters

  • hdmap generation tool in cloud

  • metrics and visulization in web

  • loading data directly from hdfs, Amazon S3

all these functions will be a neccessary for a full-stack ADS team in future to development safety products, which I called “ data infrastructure for ADS”.

refer

MooreMike: ros analysis in Jupter

mount smb share drive to ubuntu

autovia.ai

safety guy in AV

Posted on 2019-10-16 |

background

why Waymo still can’t release fully driveless cars on road; why vehicle startups, NIO is going to brankruptcy? one of the hidden reasons vehicle as a consumer product can’t go to fast iteration as social media, mobility apps in Internet companies, is safety.

vehicle development(VD) needs to satisfy safety requiements at first priority. so in VD, the cutting edge tech/ new solutions usually doesn’t make a difference, but the processes, how to handle safety requirements, system requirements, e.t.c are really the first thing in vehicle engineers’ mind.

so now, deep learning AI in object detection is fairly matured, but it’s not used common in vehicle camera products. and for these start ups, who say themselves as tech-driven doesn’t survive well, because VD should be process driven.

the best managment/survive way for original equipment manufacture(OEM) companies is build up their process system. e.g. GM managemnet is about process, and Toyota agile management is about a more flexible process, too. no OEMs said their team is tech-driven.

what is SOTIF ?

safety of the intended functionality(SOTIF): the absence of unreasonable risk due to hazards resulting from functional insufficiencies of the intended functionaliyt or by reasonably foreseeable misuse by persons.

SOTIF is a way to define safey by design, while still there are unsafe post design, which is beyond the standards can handle.

safety chanllenges in ADS

is conserative behaivor of AI unsafe ? YES. as Waymo cars driving in San Fransisco, it’s more conservative than human drivers, which makes itself unsafe and surrounding vehicles unsafe. and the definiation of conservative or aggressive of driving behavior is further area depends, e.g. how human drivers drive in San Fransisco is different than drivers from Michigan, how AI handle this?

how does AI satisfy VD requirements, and how to verify the AI really satisfy? there is no standard solution yet. since AI is black box, it may satisfy VD requirements in 99.9% situations, but failed in 0.1% case.

an ADS solution works well in 99% scenarios is not an acceptable solution at all, which is really big chanllenge for most self driving full-stack solution start-ups. so Waymo and a few giants are working on test driven verification, which requires build up a very strong simulation team to power up safety test by simulation, which’s even chanllenging for most traditional OEMs.

and definitely, there is no way to handle unstructured stochastic traffic environments,

classification of safety hazards

  • IS26262

  • internal cyber security (ISO21434)

  • functional insufficient & human misuse (IS02148)

  • external infrastructura cyber security (traffic light system, jamming sensors signals)

malfunction behaviors of EE

Harzard Analysis & Risk Assignment

    |
    |
    V

ASIL B/C/D         <--   sys requires 

* func redundency 

* system safety mechanism 

* predictive safety mechanism 

this is a close-loop analysis, to satisfy sys requirement will get new situations, which lead to new system requirements

system requirements 

  ^ 
  |
  |
  V

SOTIF Analysis 

this is a double direction design, with any new requiremenst, there is a need to do SOTIF analysis, which may find out some potential bugs/problems in the design, then back to new system requirements.

in summary, the input to SOTIF analysis is system requirements, and output is new system requirements.

functional insufficients

  • unsafe by design

e.g. full pressure brake design, is not sufficient in scenarios, when there is rear following vehicle in full speed

Tech limitations

  • safe known

  • unsafe known

  • safe unknown

  • unsafe unknown

SOTIF is to identify all unsafe cases and requies to make them safe, but not know how, but SOTIF can’t predict unknown.

back to why Waymo doesn’t release their driveless vehicle yet, cause they don’t have a way to prove their ADS system has zero unsafe unknown situations, and most possiblely the current ADS solution may be reached 80% functions of the final completed fully ADS solution, but that’s even not the turning point for ADS system.

where to go?

  • rule based vs AI based

as neither purely rule based nor purely AI based can achieve safety goals, so there are combined ways, but then there need a manager module to decide which should be weighted more in a special situation.

  • a new undeterministic/unpredicted system explaination

reinforcement learning is actually a good way to train agents in unpredicted simulation environemnt, but even in simulation, it can’t travel every case in the state space; then to use R.L to train vehicles in real traffic environment with random pedestrains, npcs, situations, which’s impossible so far.

  • a new AI system

current AI is still correlation analysis, while human does causal reasoning.

refer

safety first for automated driving handover to PR

ISO 26262 standard

how to reach complete safety requirement refinement for autonomous vehicle

cruise webriz configure

Posted on 2019-10-16 |

background

during ADS development, ros bag is used a lot to record the sensor, CAN and scenario info, which helps in vehicle test, data fusion, perception.
cruise webviz is an open source tool to visualize rosbag and allow user defined layout in web environment, without the pain to run roscore and other ros nodes.

while js is not a common tool in my visibility, the way how an js project is organized is really confused at the first time. there are a punch of new things:

  • react
  • [regl]https://www.giacomodebidda.com/how-to-get-started-with-regl-and-webpack/)

and js functions/modules are really patches, they can be pached anywhere in the project, so usually it requires a patch manager(e.g. lerna) to deal with versions, dependencies etc; and bigger there are packages, which is independent function component.

webviz has a few packages, e.g. regl-worldview, webviz-core, which has more than 40 patches(modules) used.

  • cruise:worldview

  • cruise:webviz core

  • rosbag.js

lerna

lerna is an open source tool to manage js project with multi packages.

  • lerna init will generate lerna.json, which defines the required modules

  • package.json defines useful infomation about the module depencies, CLI(which give a detail about how things work behind) and project description

  • lerna bootstrap --hoist react will install all required modules in the root folder /node_modules, if doesn’t work well, leading to Can't Resovle module errors, may need manually install some.

webpack

webpack is an open source tool for js module bundler.

webpack.config.js, defines entry, where the compiler start; output , where the compiler end; module, how to deal with each module; plugin, additionaly content post compiliation; resovle.alias define alias for modules.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
var path=require("path")
module.exports ={
entry: { app:["./app/main.js"] }
output: {path: path.resolve(__dirname, "build")}
}
npm install webpack-dev-server
npm list | head -n 1
webpack-dev-server --inline --hot

the JS bundle could be loaded from a static HTML page, served with any simple web server. That’s exactly what this /packages/webviz-core/public/index.html file is, which is used for https://webviz.io/try. The webpack dev server is configured to serve it at /webpack.config.js

npm commands

1
2
3
4
5
6
npm config list
npm install packages@version.minor [-g] [--save]
npm uninstall packages
npm search packages
npm cache clean --force

webpack-server

webpack-server is a little nodejs Express server. to install it as a CLI tool first, then run it under the webviz project root folder, with optional parameters, e.g. –host, –port e.t.c

webviz configure

  • npm config set registry https://r.npm.taobao.org
  • npm install puppeteer –unsafe-perm=true
  • npm run bootstrap

if failed:

  • sudo npm cache clean –force
  • npm install -g lerna
  • npm run bootstrap
  • sudo npm install/rebuild node-sass
  • npm run build

if failed, manually installed unresovled modules

  • npm test

if failed based on a few test modules, install then

  • npm install webpack-dev-server –save

webpack-dev-server.js –host IP –port 8085 #under project root

a little hack, by default npm install inter-ui phli’s inter-ui), where inside
webviz/packages/webvix-core/src/styles/fonts.module.scess, it uses: url("~inter-ui/Inter UI (web)/Inter-UI.var.woff2") format("woff2-variations"), modified this line to: url("~inter-ui/Inter (web)/Inter.var.woff2") format("woff2-variations")

refer

tabbles

webviz in ros community

access web-server in LAN

issue: how to run cruise webviz

Ternaris Marv

minio: high performance object storage for AI

webviz on remote bag

visuaize data from a live server

npm package install in China

taobao.npm

reinforcement learning in nutshell-2

Posted on 2019-10-13 |

function approximation

write the mapping from \ pair to value as $ S X A -> Q $.

usually S, Q can be continuous high-dimensional space, and even in discrete state problem. e.g. in GO game, the state space is about 10^170, to store each \ pair in a table is almost impossible. a good and approximated way is using a hash map, where input a state, and through this hash map to get its value, which is one step, rather than many steps even with a tree strucutre of the whole state-action/value space.

in math, this is called function approximation, it’s very intuitive idea, to fit a function from the sample points; then any point in the space, it can be represented by the function’s paramters, rather than search in all the sample points, which may be huge; and further as only the function’s parameters is required to store, rather than the whole sample points information, which is really a pleasure.

Deep Q-Learning

previously in Q-Learning, to update Q(S,A):

$ Q(S,A) <- \delta ( Q(S, A) + R + \gamma ( Q(S', A') - Q(S, A))

to approximate q(s,a) can use a neural network(NN), the benefit of NN is to approximate any function to any precise, similar to any complete orthonormal sequence, e.g. Fourier Series.

CNN approximator

the input to Q neural network is the eigenvector of state S, assuming the action set is finite. the output is action value in state-action-hyperparameter: q(s, a, \theta),

Q(S, A, \theta) ~= Q(S, A)

image

as the right most section, here assuming the action set is finite, so for each action, there is an output.

experience replay

instead of discarding experiences after one stochastic gradient descent, the agent remembers past expereicnes and learns from them repeatdely, as if the experience has happened again. this allows for greater data efficiency. another reason, as DNN is easily overfitting current episodes, once DNN is overfitted, it’s difficult to produce various experinces. so exprience replay can store experiences including state transitions, rewards, and actions, which are necessary to perform Q learning.

at time t, the agent’s experience e_t is defined as:

all of agent’s experiences at each time step over all episodes played by the agent are stored in the replay memory. actually, usually the replay memory/buffer set to some finite size limit, namely only store the recent N experiences. and then choose random samples from the replay buffer to train the network.

the key reason here is to break the correction between consecutive samples. if the CNN learned from consecutive samples of experience as they occurred sequentially in the environment, the samples are highly correlated, taking random samples from replay buffer.

target network

use a separate network to estimate the target, this target network has the same architecture as the CNN approximator but with frozen parameters. every T steps(a hyperparameter) the parameters from the Q network are copied to this target network, which leads to more stable training because it keeps the target function fixed(for a while)

go futher in DQN

Double DQN

here use two networks, the DQN network is for action selection and the target network is for target Q value generation.

the problem comes: how to be sure the best action for the next state is the action with the highest Q-value ?

Prioritized Replay DQN

Dueling DQN

yet a summary

at the begining of this series, I was thinking to make a simple summary about DQN, which looks promising in self-driving. After almost one month, there are more and more topics and great blogs jumping out, the simple idea to make a summary is not easy any more. I will stop here, and once back.

refer

math equation editor

Petsc Krylov

zhihu: function approximate

dqnbook: experience replay

Toward Data Science

explained replay memory

going deeper into RL: understanding DQN

improvements in DQN

configure pgAdmin4 in server mode

Posted on 2019-10-13 |

background

pgSQL is common used to store hd map in ADS stack, and the client is usually pgAdmin4. in big tech companies, e.g. Tencent, Alibaba, Uber e.t.c, their data infrastructure for ADS stack development is usually based on pgSQL. for our team work, we also store most map info in pgSQL, and for better development toolchain, there is a need to configure the client pgAdmin4 as a web server, rather than request every developer to install a copy of pgAdmin4 at their local side.

in LAN web server, apache2 is used to serve a few services, so there is a need to configure multi virutal host in Aapche2, with differnt port and same IP.

pgSQLServer

  • official install postgresql

  • start pgSQLserver

  • jump into pgSQL server:

1
2
3
4
/etc/init.d/postgresql start
sudo su - postgres

pgAdmin4

installed by apt-get install pgadmin4, will put pgAdmin4 under local user or root permission, which will be rejected if accessed by remote clients, whose permission is www-data

so it’s better to install from src and in a different Python virtual env.

  • setup Python virtual Env

  • install pgAdmin4 from src

there maybe a few errors as following:

*  No package 'libffi' found  

*  error: invalid command 'bdist_wheel' [sol](https://stackoverflow.com/questions/34819221/why-is-python-setup-py-saying-invalid-command-bdist-wheel-on-travis-ci)

* error: command 'x86_64-linux-gnu-gcc' failed with exit status 1, [sol](https://stackoverflow.com/questions/21530577/fatal-error-python-h-no-such-file-or-directory)

configure pgAdmin4

follow this configure pgadmin4 in Server mode

configure Apache2

follow previous blog to set Apache2 for pgadmin4:

<VirtualHost *:8084>
    ServerName 10.20.181.119:8084
    ErrorLog  "/var/www/pgadmin4/logs/error.log"
    WSGIDaemonProcess pgadmin  python-home=/home/david/py_venv/pgenv
    WSGIScriptAlias /pgadmin4 /home/david/py_venv/pgenv/lib/python3.5/site-packages/pgadmin4/pgAdmin4.wsgi

    <Directory "/home/david/py_venv/pgenv/lib/python3.5/site-packages/pgadmin4/">
        WSGIProcessGroup pgadmin
        WSGIApplicationGroup %{GLOBAL}
        Require all granted
    </Directory>
</VirtualHost>

restart Apache2 server will make this works.

refer

why sudo - su

godaddy about sudo - su

configure pgadmin4 in Server mode

host mod_wsgi in Apache2

Posted on 2019-10-13 |

Apache2 Background

Apache2 virutal host

  • site-available

all virtual hosts are configured in individual files with /etc/apache2/sites-available

  • site-enabled

until the *.config in site-available are enabled, Apache2 won’t know know.

sudo sevice apache2 reload 
  • IP based virtual host

use IP address of the connection to determine the correct virtual host to serve, so each host needs a separate IP

we had name-based vhost in LAN, a few web servers sharing the same IP in the same physical machine, but with different Ports, and even we don’t use DNS server to tell the domains.

apache mode cores

refer

  • VirtualHost

the title to define this virutal host, and tell which port to listen. by default is port80

  • ServerName

sets the request scheme, hostname, and port that the server uses to identify itself

  • ServerAlias

sets the alternate name for a host

  • WSGIDaemonProcess

for wsgi app, which usually define in a seperate Python virtual environment, rather than the default localhost user or root. so WSGIDaemonProcess point to the python virtual env.

  • WSGIScriptAlias

point to the wsgi_app.wsgi

  • DocumentRoot

set the directory from which httpd/apache2 will serve files /var/www/html

mod_wsgi

  • install apt-get install apache2 libapache2-mode-wsgi-py3

config in Apache2

config with configure file

  • create example.conf under /etc/apache2/conf-available/
1
2
3
4
5
6
7
8
<VirtualHost *:8084>
ServerName 10.20.181.119:8084
ServerAlias example.com
DocumentRoot "/var/www/html"
ErrorLog "/var/www/example/logs/error.log"
</VirtualHost>

the served web content is stored at /var/www/html, which can simple include a index.html or a few js.

  • enable configure, which will create corresponding conf under conf-enable folder

    sudo a2enconf example 
    
  • check configure

    sudo apachectl -S 
    sudo apachectl configtest 
    

config with virtual host

  • create example.conf under /etc/apache2/site-available/
    1
    2
    3
    4
    5
    6
    7
    8
    <VirtualHost *:8085>
    ServerName 10.20.181.119:8085
    ServerAlias application.com
    DocumentRoot "/var/www/wsgy_example"
    ErrorLog "/var/www/wsgy_example/logs/error.log"
    WSGIScriptAlias /application /var/www/wsgy_app/application.wsgi
    </VirtualHost>

here used the additional WSGI script, link

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
import sys
sys.path.append('/var/www/wsgy_app/')
os.environ['PYTHON_EGG_CACHE'] = '/var/www/wsgy_app/.python-egg'
def application(environ, start_response):
status = '200 OK'
output = b'Helo World'
response_headers = [('Content-type', 'text/plain'),
('Content-length', str(len(output)))]
start_response(status, response_headers)
return [output]
  • enable configure, which will create corresponding conf under site-enable folder

    sudo a2ensite wsgy_example 
    
  • check configure

    sudo apachectl -S 
    sudo apachectl configtest 
    

add multi ports:

in /etc/apache2/ports.conf:

Listen 8083
Listen 8084

since this Apache server host system_engineering web and pgadmin4 web, and share the same IP.

restart apache

sudo systemctl restart apache2 

test apache

in browser:

10.20.181.119:8085/application

should view “hello world”

refer

name based virtual host

Apache2 virutal host

vhost with different ports

1…789…20
David Z.J. Lee

David Z.J. Lee

what I don't know

193 posts
51 tags
GitHub LinkedIn
© 2020 David Z.J. Lee
Powered by Hexo
Theme - NexT.Muse