/pnc-algo-vtd

Simple PnC algorithm samples for octopus simulation service users to get started with vtd adapter.

Primary LanguageC++MIT LicenseMIT

PnC Algorithm with VTD Adapter

Simple PnC algorithm samples for octopus simulation service users to get started with vtd adapter.

Introduction

Cancel changes This project could be added as an algorithm to the Huawei Octopus Autopilot Platform for real-time simulation using VTD.

If you want to control the car in another way, you only need to modify the function sendDriverCtrl(), or you can create your own function from scratch after mastering the program framework.

All the other functions are necessary tool functions including main(), which is used for serial communication. If you are not a master of the framework, just leave them as default.

What needs to be emphasized is that I am not a master of the project framework. In fact, my job is just optimizing the adaptive cruise algorithm slightly.

Algorithm Explanation

Baseline and our work

The baseline algorithm in ExampleACC.cpp is a sample ACC algorithm, which enables the car to detect the car in front of itself and follow the front car in the same speed. However, such an algorithm could no handle cases when another car in the left lane changes the lane to the lane of main car on the right. As a result, we improve the baseline ACC algorithm to tackle the problem.

The main improvement is acceleration optimization, which is of importance to passengers' comfort.

The constraint of deceleration is:

and that of acceleration is:

Moreover, we set the upper bound of acceleration rate to be $0.8 m/s^2 $ when the speed of the car is quite small for a gentle start.

Concrete algorithm

We avoid sudden accelerations or decelerations, which can be very uncomfortable for passengers, so we assume that $a=\alpha t^2$ and solve the coefficient $\alpha$.

In order to avoid the danger caused by other cars changing lanes, let our car slow down when the difference between the y-coordinates of the two cars is significantly reduced. When the lane change of the vehicle is completed, we enable our car to accelerate and maintain a safe distance.

How to use it

To get started with these PnC algorithm samples, you should first of all have them compiled.

The compile execution must be in the environment of Linux, g++ in Windows may not contain some necessary libraries.

If you want to compile the baseline "Adaptive Cruise Control", compile it using:

g++ -o acc ./Common/RDBHandler.cc ExampleACC.cpp -I./Common

If you want to compile the PnC algorithm designed by myself, compile it using:

g++ -o acc ./Common/RDBHandler.cc AutoCtrlAlg.cpp -I./Common

More