惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threatpost
The Hacker News
The Hacker News
AWS News Blog
AWS News Blog
Spread Privacy
Spread Privacy
T
Tenable Blog
C
CERT Recently Published Vulnerability Notes
Cisco Talos Blog
Cisco Talos Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Securelist
P
Privacy & Cybersecurity Law Blog
Know Your Adversary
Know Your Adversary
T
The Exploit Database - CXSecurity.com
Latest news
Latest news
D
Darknet – Hacking Tools, Hacker News & Cyber Security
I
Intezer
F
Fortinet All Blogs
Engineering at Meta
Engineering at Meta
Simon Willison's Weblog
Simon Willison's Weblog
The Register - Security
The Register - Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
Lohrmann on Cybersecurity
C
Cyber Attacks, Cyber Crime and Cyber Security
Microsoft Azure Blog
Microsoft Azure Blog
P
Proofpoint News Feed
H
Help Net Security
T
Threat Research - Cisco Blogs
D
DataBreaches.Net
S
Schneier on Security
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
P
Privacy International News Feed
S
Secure Thoughts
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Recorded Future
Recorded Future
C
Cybersecurity and Infrastructure Security Agency CISA
MyScale Blog
MyScale Blog
M
MIT News - Artificial intelligence
Stack Overflow Blog
Stack Overflow Blog
IT之家
IT之家
人人都是产品经理
人人都是产品经理
NISL@THU
NISL@THU
博客园 - Franky
T
Tor Project blog
G
GRAHAM CLULEY
博客园 - 【当耐特】
Jina AI
Jina AI
Security Archives - TechRepublic
Security Archives - TechRepublic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
A
About on SuperTechFans
Hacker News - Newest:
Hacker News - Newest: "LLM"

Nemo

再见,2025 Complete ORB-SLAM3 Setup Guide for Jetson Xavier NX with RealSense D455 20250723 再见,2024 Using CertBot for Automatic Secure EMQX Broker Create Your Own GPS Data Publisher Support SSL AGV Dispatching System Technical Documentation Finding Nemo No title 香港賽馬會呈獻系列:黑白——攝影敘事 再见,2023 团团是只猫 State Machines – Basics of Computer Science Data-driven robot lifespan: Collection 数据驱动的机器人寿命:收集、诊断、预测 Exploring the design space of binary search trees 特首来了 Large language models, explained with a minimum of math and jargon 设计有缓存异步逻辑的监控脚本并测试其资源占用 使用loguru记录串口数据并使用Docker搭建ARM开发环境 在vscode的Dev Container中构建.NET开发环境及使用doxygen和graphviz绘制函数调用图 State or Status? A*算法两种时间复杂度 /A* Algorithm: Two Types of Time Complexity 使用KD-Tree快速收敛到最近坐标点/Fast convergence to the nearest coordinate point using KD-Tree 翻译 || 总结 - Go语言中的空结构体(The empty struct) 再见,2022 从PE工作报告中能读出什么 Give me miles, give me truth AMR调度系统性能优化/AMR Dispatch System Performance Optimization 条件触发AMR避让流程/Conditionally triggered AMR avoidance process Docker实现调度系统整体部署/Docker implementation of dispatching system overall deployment 调度系统中加密算法的使用/增加SM4补0方法/Use of encryption algorithms in scheduling systems/add SM4 complementary 0 method 一篇关于北京四天三夜的攻略 2022 藏疆自驾 策划/招募书 AMR仿真模型/AMR Simulation Model 东东有鱼2022年会分享 使用perf-FlameGraph监控系统性能 Beyond Compare 4删除试用 你的灵魂有香气 Pyinstaller打包Python项目 [转载]Python中的单例模式的几种实现方式的及优化 - Nemo 再见! 2020 1024 UML软件建模 入职优必选一个月 写论文时 那些让你开心的软件 - Nemo 分享一个记录刷题次数的模版 LeetCode-查找表类算法题精析 PyCharm 调用vs 2010 C++库导致提示报错R6034解决方法 MySQL基础教程 多种数据结构的Python实现形式 字节跳动-挑战字符串 选择排序 二分查找和大O表示法 算法中的动态规划问题 高高手课程-青山裕企人像摄影 笔记(内含福利)
Design an FSM for Robot
Nemo · 2023-12-15 · via Nemo

Exploring the Turing Machine

The Turing Machine is a cornerstone of computational theory, representing the foundation upon which modern computing is built. This abstract concept was revolutionary, laying the groundwork for the advanced systems we see today, especially in the field of robotics.

Named after the visionary mathematician Alan Turing, my introduction to his work came through the cinematic portrayal in "The Imitation Game." The film dramatizes Turing’s efforts to decrypt German communications during World War II, encapsulating the idea that "Only a machine could beat another machine."

The Imitation Game (2014)

At its core, the Turing Machine simulates the process of human calculation by recording inputs and transitioning through states. This pivotal concept highlights why the Turing Machine is often heralded as the precursor to the modern computer.

Delving into specifics, as outlined on the Turing Machine Wikipedia page, we define a Turing Machine using a 7-tuple: M = (Q, Σ, Γ, δ, q0, qaccept, qreject), where each element represents:

  • Q: a finite set of states

  • Σ: the input alphabet (excluding the blank symbol ‘B’)

  • Γ : the tape alphabet, satisfying:

    • Σ ⊆ Γ (the input alphabet is a subset of the tape alphabet)
    • B ∈ Γ (the blank symbol is included in the tape alphabet)
  • q0: the starting state, an element of Q

  • qaccept: the accepting state, within Q

  • qreject: the rejecting state, also within Q

  • δ: the transition function, defined as δ : Q × Γ → Q × Γ × {L, R}

This structure is admittedly intricate. But what if our ambitions are more modest, aiming for a model that simply retains the current state and transitions based on the input?

Enter the Finite State Machine (FSM). It can be expressed more succinctly with a 5-tuple: M = (Q, Σ, δ, q0, F), which includes:

  • Q: a finite set of states
  • Σ: a finite set of input symbols, the alphabet
  • δ: the transition function, δ : Q × Σ → Q
  • q0: the initial state, from the set Q
  • F: the set of final or accepting states

Compared to the Turing Machine, the FSM lacks the infinite tape for recording input. It operates solely on the present input and state, making it an ideal model for robotic systems that need to swiftly react to environmental cues.

Comparison Diagram of Turing Machine and Finite State Machine

Below is a diagram illustrating the relationship and differences between the Turing Machine and the Finite State Machine:

Comparison of Turing Machine and Finite State Machine

This diagram clearly depicts the distinct roles and functionalities of the Turing Machine and Finite State Machine in computational theory and robotics.

Why Robots Need a Finite State Machine (FSM)

Robots are engineered to navigate and respond to the tangible realm around them, frequently tasked with executing complex sequences or reacting to diverse stimuli. A Finite State Machine (FSM) is an exemplary paradigm for orchestrating these activities and responses. It furnishes a transparent and organized framework that directs the robot through various operational states, culminating in consistent and controlled conduct.

Beyond the FSM, one might consider using a global variable to represent the current state of a robot. Upon receiving an input, this variable could be updated accordingly. However, this approach has its drawbacks, primarily in scalability and maintainability. As the complexity of tasks increases, relying on a single variable for state management becomes unwieldy and prone to error.

FSMs streamline this process by encapsulating the state information within a well-defined system. When an FSM processes an input, it evaluates the current state and the input itself to decide upon an output and the subsequent state. This decision-making is governed by the transition function, a core component of the FSM that acts as a set of rules or logic dictating how state transitions occur.

This mechanism allows for a modular approach where each state is isolated, and its behavior can be understood without needing to consider the entire system. The FSM can be designed to handle specific inputs differently depending on the current state, which is critical for robots that must adapt to a changing environment.

For instance, consider a robot vacuum cleaner that has states such as ‘Idle’, ‘Cleaning’, and ‘Charging’. If the battery level is low, regardless of whether it’s currently idle or cleaning, the FSM can dictate that the robot transition to the ‘Charging’ state. Similarly, if the robot finishes charging or the user presses the start button, the FSM can direct the robot to transition back to ‘Cleaning’ from the ‘Idle’ or ‘Charging’ states.

State Diagram of Robot Vacuum Cleaner FSM

Hence, the FSM’s ability to judge and act based on both its current state and input not only provides precise control over the robot’s behavior but also isolates the conditions for transitions, making the system more robust and less prone to cascading failures. It’s the distinction between a robot that merely reacts and one that responds with discernment to its environment.

Designing the Protocol First

Before delving into the implementation of the Finite State Machine (FSM), it’s imperative to meticulously design the protocol. This process is akin to an architect meticulously drafting blueprints prior to the commencement of construction. We must delineate all conceivable states and their respective transitions. This preliminary step is vital to ensure a comprehensive and well-thought-out plan that encapsulates the robot’s intended functionalities and its responses to various events.

The Case of the AGV in the System

Let’s revisit our familiar subject – the Automated Guided Vehicle (AGV). In the system under consideration, it’s essential for the AGV to accurately gather information such as its position, state, status, power level, etc. The model for this data collection can be represented as follows:

template_agv_state = {
    "state": 0, 
    "stateDuration": 123,  
    "curCoord": {...}, 
    "locConfidence": 100,  
    "curSiteID": 0,
    "curBatteryPct": 0, 
    "speed": {...}, 
    "map": {...}, 
    "task": {...}, 
    "laden": {...}, 
    "action": {...}, 
    ...
}

As illustrated, the system retrieves this information from different layers within the robot by dispatching a variety of MQTT topics at varying frequencies. Each data piece has its unique trigger; for instance, the state information might be updated at about 2Hz, which is slightly lower than the 5Hz frequency of the sensor data. The action status is transmitted every time an action is completed or fails.

Consequently, the FSM disseminates these data using topics such as:

agv/heartbeat/{ID}
agv/state/{ID}
agv/status/{ID}
...
agv/motion/{ID}
...

The format adopted is:

{Sender}/{Topic}/{ID}

The reason for placing the {ID} at the end is a matter of personal preference – I’m not fond of splitting the topic with a + symbol.

The content of the topic agv/heartbeat/{ID} is structured as follows:

{
    "agvid": "XXX", 
    "timestamp": 1692861317.338879, 
    "msg_type": "heartbeat",
    "data": {...}
}

This format allows the Dispatching system to verify the data source and determine the specific subtopic it belongs to.

Similarly, the Dispatching system sends commands using topics like dispatch/command/{ID}. There’s not much more to discuss in this regard.

System Structure and Workflow

The structure of this system is depicted in the following diagram:

System Structure

The workflow of the system is illustrated here:

System Workflow

This refined approach to protocol design ensures that the AGV operates efficiently within the system, responding accurately to the commands and data it receives.

Enhancing State Transitions in FSM

In the realm of Finite State Machines (FSM), dynamism is key. Transitions between states aren’t just spontaneous; they’re driven by specific events or conditions. When crafting an FSM for a robot, it’s crucial to meticulously define the triggers for these state transitions. This precision is vital for averting unforeseen behaviors and ensuring robust control over the robot’s operational dynamics.

Designing AGV’s State Series

In alignment with the product requirements, I have conceptualized a series of states for the Automated Guided Vehicle (AGV), as depicted in the following state diagram:

AGV State Diagram

This visual representation is instrumental in understanding the various states the AGV can assume and the transitions between them, ensuring a clear roadmap for its behavior under different scenarios.

Choosing Python for Development

For the development of this FSM, I have opted for Python. The rationale behind this choice is detailed in my recent presentation, which can be accessed here:

Read My Speech on Python Usage

Program Structure

The structure of the program, which underpins the FSM and its operations, is outlined in the following diagram:

Program Structure

This structural blueprint provides a comprehensive view of how the various components of the program interact, ensuring a cohesive and well-organized implementation of the FSM in the AGV system.

Navigating Through Fatal States in FSM

In the journey of a Finite State Machine (FSM), not every state leads towards the desired goal. Some states can be dead ends or ‘fatal’ states, where the system encounters errors or situations that disrupt normal operations. It’s crucial for an FSM, especially in complex systems like Automated Guided Vehicles (AGV), to have a mechanism to recover from these states. This capability is pivotal in ensuring the robot’s resilience and reliability.

The Concept of Backtracking

Backtracking from fatal states involves designing the FSM such that the robot can revert to a safe or neutral state. This process is akin to a reset, allowing the robot to recalibrate and resume normal operations. The design must include clear pathways from these fatal states to recovery states.

Implementing Recovery in AGV’s FSM

In the context of an AGV, consider a scenario where the robot encounters an unexpected obstacle or system error. The FSM should be able to recognize this as a ‘fatal state’ and initiate a series of actions to move the AGV back to a stable state. This could involve retracting steps, recalculating paths, or even shutting down certain functions temporarily.

State Diagram for Recovery

The following state diagram illustrates the process of navigating through and recovering from fatal states:

State Diagram for Recovery

In this diagram, the AGV transitions from normal operation to a fatal state upon encountering an error. It then moves to a recovery state, where attempts are made to rectify the issue. If successful, the AGV returns to normal operation. However, if recovery fails, the system may need to shut down to prevent further complications.

Conclusion

The ability to backtrack from fatal states is not just a safety feature; it’s a testament to the robustness of the FSM design. It ensures that the AGV can handle uncertainties and continue to operate effectively, thereby enhancing its reliability in dynamic environments.

Through careful planning and strategic implementation, FSMs in robotic systems like AGVs can be equipped to handle challenges, ensuring smooth and uninterrupted operations.