How to design a state machine for an autonomous driving system

Publisher:CaptivatingGazeLatest update time:2024-04-07 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The state machine module plays a key role in the autonomous driving system. It is responsible for managing and controlling the state transitions and behavior execution of each function. Today we will talk about how to design the state machine of the autonomous driving system.


0. Small talk

As an engineer of autonomous driving system, it is essential to deal with the state management module from the beginning of participating in the project, because the state machine plays a management role in the full functional cycle of the system operation. From the perspective of technical implementation, the state machine module is not difficult. There are many articles on the Internet introducing FSM (Finite-state machine). If you are interested, you can learn about it yourself. However, how to design it cleverly, thoughtfully and exquisitely is a test of the designer's background and understanding of the system.

Most ADAS functions require state machines for state management. I have more than a dozen state machine design documents, including FCW/LDW/AEB/ACC/LKA/NOP/APA/AVP, etc. The designs are very different, but the cores are similar. The state jump of the NOP function is relatively complex, involving lateral and longitudinal control and function degradation logic, which requires long-term carving and iteration to design an effect that meets the project requirements.

The author has recently been responsible for the state machine design of the APA function. Although it is relatively simple, I still want to take this opportunity to summarize the state machine module and review my previous work.

1. Module Overview

The main function of the state machine module is to track the current state of the system and perform state transitions based on specific events and conditions. It can determine the availability and execution conditions of the current function based on sensor data, vehicle status, and system input. The state machine module can also monitor the operation of the system, respond to driving decisions or user instructions in a timely manner, and trigger the execution of corresponding functions as needed.

The state machine module ensures that the system correctly performs corresponding functions in different scenarios and conditions by defining and maintaining a set of states, as well as the transition conditions and behaviors between states. For example, when the distance between the vehicle in front and the vehicle is too close, the FCW function will be triggered, and the state machine module will switch to the corresponding warning state according to the preset logical conditions and behaviors, and trigger warning measures such as sound or vibration.

The design of the state machine module needs to consider the priority, dependency and conflict between various functions. It needs to be flexible and scalable to cope with different road conditions and traffic scenarios. For example, cat-in, cat-out scenarios, lane change space judgment during automatic lane change, etc. At the same time, the state machine module also needs to have efficient algorithms and real-time performance to ensure the rapid response and reliability of the system.

In short, the state machine module plays a key role in decision-making and control in the autonomous driving system. By effectively managing and controlling the state transitions and behavior executions of each function, the state machine module can ensure the stability, safety and reliability of the system. It is one of the basic modules for realizing ADAS functions.

2. Design principles

The design principle of the state machine is based on the concepts of state, event, and transition. The state represents the specific state of the system or function at a certain moment, the event represents the condition that triggers the state transition, and the transition represents the switching process between states.

First, you need to define the states of the system or function. The state can be a specific behavior state or an abstract control state. Each state represents a specific aspect or function of the system, such as "Standby", "OFF", "Parking", etc.

Next, define the events that trigger the state transition. Events can be trigger signals from sensors, user input commands, or conditional judgments within the system. By detecting the occurrence of events, the state machine can determine whether a state transition is required.

Then, define the transition conditions and behaviors between states. Transition conditions are logical conditions that determine whether a state transition can be made, such as meeting a certain time limit, specific sensor data, or user instructions. Transition behaviors are actions performed when a state transition occurs, such as triggering an alarm, adjusting the vehicle speed, or switching to the next state.

In order to better design and manage state machines, state tables and state transition diagrams can be used. A state table is a table that lists the various states of the system and the corresponding transition conditions. A state transition diagram represents each state and transition through nodes and arrows, intuitively showing the relationship between states and transition rules. wKgaomS6KVqAdRG1AADFJLTcGOo442.jpg

EA Example State Transition Diagram

wKgZomS6KVqAEvOVAACcbp3rz38918.jpg

EA Example Status Table

When designing a state machine, you need to ensure its properties, including determinism, completeness, and reachability.

Determinism means that each state has clear transition rules, without ambiguity or conflict.

Completeness means that all possible states of the system have been considered and the corresponding transition rules have been defined.

Reachability means that the system can reach the target state from any initial state, ensuring the reliability and stability of the state machine.

By using the design principle of the state machine, the various states and transition rules of the system can be clearly defined to ensure that the system correctly executes the corresponding behaviors and functions under different conditions. At the same time, the design principle of the state machine also facilitates the expansion and maintenance of the system, allowing the system to adapt to changing needs and environments.

4. Define the state

State definition: Clearly define the states in the system, ensuring that each state is clear and mutually exclusive. Each state should have a clear meaning and behavior.

Different autonomous driving functions may have different state machines. The definition of the state is determined by the function, and the system needs to correctly execute the corresponding behavior and function under different conditions. At the same time, the design principle of the state machine should also facilitate the expansion and maintenance of the system, so that the system can adapt to changing needs and environments; for example, when designing the NOP function, it should be considered how to switch with functions such as LCC/ACC.

L0 ADAS functions, such as FCW/LDW/BSD, etc., basically do not involve vehicle control, but only serve as warnings. Their state definitions are also relatively simple and can be divided into the following states:

OFF: The system is off and not working.

Standby: The system meets the operating conditions and is on standby.

Warning: The warning trigger conditions are met and the alarm is being sounded.

Inhibit: The warning is suppressed by the user.

Error: System failure.

According to national standards and regulations, the Warning status may also include the Pre-Warning status.

L1's AEB/LCC and other functions only involve single lateral or longitudinal control. For example, AEB is mainly responsible for emergency braking, and will add the Brake state after FCW Warning. According to the functional definition, ACC will have Speed ​​Control, Distance Control, Override, Temp Stop and other states. LCC will have Lane Keeping and other states. It can be seen that the state machine mainly serves the function and is decomposed into different states around the core function.

wKgZomS6KgeAIbupAADAX_lj8zM133.jpg

State Flow logical system modeling textbook diagram from the author

Since the L2-level NOP function requires simultaneous lateral and longitudinal control of the vehicle, the lateral control and longitudinal control states in the main state will be running at the same time. Due to the limitations of the ODD range, there are also downgrade requirements, such as the Safe Stop state. The logic is relatively complex and has high compatibility requirements.

The parking function state machine will of course have states such as Searching (searching for a parking space), Parking (parking process), Suspend (parking interruption), and Completed (parking completion).

5. Event Definition

Event definition: Identify possible events that may occur in the system and define clear trigger conditions for each event. Events can be sensor inputs, user actions, or other changes inside or outside the system.

For example, in many systems, the trigger event of OFF->Standby is "the vehicle is in IGN ON state", that is, the vehicle is powered on. This event can be considered as vehicle state input. The trigger event of Stadnby->Active may be "the user clicks the function start button on the central control screen", which can be considered as a user operation, and so on.

If there are multiple events in the system and they can occur at the same time, then the event priority needs to be considered. Event priority determines which event will be processed first when multiple events are triggered at the same time. For example, an emergency braking event may have a higher priority than a forward obstacle detection warning event.

6. Conversion Rules

Transition rules: Determine the transition rules between states, that is, how to transition from one state to another when a specific event occurs. The transition rules should take into account the logic and constraints of the system.

[1] [2]
Reference address:How to design a state machine for an autonomous driving system

Previous article:5v2.4a power chip U65153 integrates multiple protection functions
Next article:Why do new energy vehicles use range extenders without diesel engines?

Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号