运动规划第二节【深蓝学院,高飞】笔记

news2024/9/21 2:43:05

文章目录

  • Graph Search Basis
    • Configuration Space
      • Configuration Space Obstacle
      • Workspace and Configuration Space Obstacle
    • Graph and Search Method
    • Graph Search Overview
    • Graph Traversal
      • Breadth First Search (BFS)
      • Depth First Search (DFS)
      • versus
    • Heuristic Search
      • Greedy Best First Search
      • Costs on Actions
  • Dijkstra and A*
    • Algorithm Workflow
      • Dijkstra's Algorithm
        • 伪代码
      • Pros and Cons of Dijkstra's Algorithm
      • Search Heuristics
    • A*: Dijkstra with a Heuristic
        • 伪代码
      • A* Optimality
      • Admissible Heuristics
      • Heuristic Design
      • Sub-optimal Solution
    • Greedy Best First Search vs. Weighted A* vs. A*
    • Engineering Considerations
      • Grid-based Path Search
        • Implementation
      • The Best Heuristic
      • Tie Breaker
  • Jump Point Search
    • Look Ahead Rule
    • Jumping Rules
    • pesudo-code
    • Example
    • Extension
      • 3D JPS
      • Is JPS always better?
  • Homework
    • Assignment: Basic
    • Assignment: Advance

Graph Search Basis

Configuration Space

Robot degree of freedom (DOF): The minimum number n of real-valued coordinates need to represent the robot configuration.

Robot configuration space: a n-dim space containing all possible robot configurations, denoted as C-space

Each robot pose is a point in the C-space

Configuration Space Obstacle

Workspace - Configuration Space

  • Obstacles need to be represented in configuration space (one-time work prior to motion planning), called configuration space obstacle, or C-obstacle.
  • C-space = (C-obstacle) ∪ \cup (C-free)
  • The path planning is finding a path between start point q s t a r t q_{start} qstart and goal point q g o a l q_{goal} qgoal with C-free.

Workspace and Configuration Space Obstacle

  • In workspace
    Robot has shape and size
  • In configuration space: C-space
    Robot is a point
    Obstacle are represented in C-space prior to motion planning.

Graph and Search Method

Graphs: Graphs have nodes and edges
State space graph: a mathematical representation of a search algorithm.

Graph Search Overview

  • Maintain a container to store all the nodes to be visited
  • The container is initialized with the start state X S X_S XS
  • Loop
    Remove a node from the container according to some pre-defined score function.
    Expansion: Obtain all neighbors of the node
    Push them (neighbors) into the container.
  • End Loop

Question 1: When to end the loop?
Possible option: End the loop when the container is empty.

Question 2: What if the graph is cyclic?
When a node is removed from the container (expand / visited), it should never be added back to the container again.

Question 3: In what way to remove the right node such that the goal state can be reached as soon as possible, which results in less expansion of the graph node.

Graph Traversal

Breadth First Search (BFS)

BFS uses “first in first out” = queue
在这里插入图片描述

  • Strategy: remove / expand the shallowest node in the container

Depth First Search (DFS)

DFS uses “last in first out” = stack
在这里插入图片描述

  • Strategy: remove / expand the deepest node in the container
  • Implementation: maintain a last in first out (LIFO) container (i.e. stack)

versus

在这里插入图片描述
Breadth First Search(BFS,FIFO)能找出最短路径

Heuristic Search

Greedy Best First Search

  • BFS and DFS pick the next node off the frontiers based on which was “first in” or “last in”.

  • Greedy Best First picks the “best” node according to some rule, called a heuristic.

  • Definition: A heuristic is a guess of how close you are to the target.
    在这里插入图片描述

  • A heuristic guides you in the right direction.

  • A heuristic should be easy to compute.
    在这里插入图片描述

Costs on Actions

  • A practical search problem has a cost "C" from a node to its neighbor
    • Length, time, energy, etc.
  • When all weight are 1, BFS finds the optimal solution
  • For general cases, how to find the least-cost path as soon as possible?

Dijkstra and A*

Algorithm Workflow

Dijkstra’s Algorithm

  • Strategy: expand/visit the node with cheapest accumulated cost g(n)
    • g(n): The current best estimates of the accumulated cost from the start state to node “n”
    • Update the accumulated costs g(m) for all unexpected neighbors “m” of node “n”
    • A node that has been expanded/visited is guaranteed to have the smallest cost from the start state.
伪代码
  • Maintain a priority queue to store all the nodes to be expanded
  • The priority queue is initialized with the start state X s X_s Xs
  • Assign g ( X s ) = 0 g(X_s)=0 g(Xs)=0, and g(n)=infinite for all other nodes in the graph
  • Loop
    • If the queue is empty, return FALSE; break;
    • Remove the node “n” with the lowest g(n) from the priority queue
    • Mark node “n” as expanded
    • If the node “n” is the goal state, return True; break;
    • For all unexpanded neighbors “m” of node “n”
      • If g(m) = infinite
        • g(m) = g(n) + C n m C_{nm} Cnm
        • Push node “m” into the queue
      • If g(m) > g(n) + C n m C_{nm} Cnm
        • g(m) = g(n) + C n m C_{nm} Cnm
    • End
  • End Loop

priority queue = container = open list
已经扩展过的节点放到 close list

Pros and Cons of Dijkstra’s Algorithm

  • The good:
    • Complete and optimal
  • The bad:
    • Can only see the accumulated so far (i.e. the uniform cost), thus exploring next state in every “direction”
    • No information about goal location

Search Heuristics

  • Recall the heuristic introduced in Greedy Best First Search
  • Overcome the shortcomings of uniform cost search by inferring the least cost to goal (i.e. goal cost)
  • Designed for particular search problem
  • Examples: Manhattan distance VS. Euclidean distance

A*: Dijkstra with a Heuristic

  • Accumulated cost
    • g(n): The current best estimates of the accumulated cost from the start state to node “n”
  • Heuristic
    • h(n): The estimated least cost from node n to goal state (i.e. goal cost)
  • The least estimated cost from start node to goal state passing through node “n” is f(n)=g(n) + h(n)
  • Strategy: expand the node with cheapest f(n) = g(n )+ h(n)
    • Update the accumulated costs g(m) for all unexpanded neighbors “m” of node “n”
    • A node that has been expanded is guaranteed to have the smallest cost from the start node
伪代码
  • Maintain a priority queue to store all the nodes to be expanded
  • The heuristic function h(n) for all nodes are pre-defined
  • The priority queue is initialized with the start state X s X_s Xs
  • Assign g ( X s ) = 0 g(X_s)=0 g(Xs)=0, and g(n)=infinite for all other nodes in the graph
  • Loop
    • If the queue is empty, return FALSE; break;
    • Remove the node “n” with the lowest f(n) = g(n)+h(n) from the priority queue
    • Mark node “n” as expanded
    • If the node “n” is the goal state, return True; break;
    • For all unexpanded neighbors “m” of node “n”
      • If g(m) = infinite
        • g(m) = g(n) + C n m C_{nm} Cnm
        • Push node “m” into the queue
      • If g(m) > g(n) + C n m C_{nm} Cnm
        • g(m) = g(n) + C n m C_{nm} Cnm
    • End
  • End Loop

A* Optimality

在这里插入图片描述

  • What went wrong?
  • For node A: actual least cost to goal (i.e. goal cost) < estimated least cost to goal (i.e. heuristic)
  • We need the estimate to be less than actual least cost to goal (i.e. goal cost) for all nodes!

Admissible Heuristics

  • A Heuristic h is admissible(optimistic) if:
    • h(n) <= h*(n) for all node “n”, where h*(n) is the true least cost to goal from node “n”
  • If the heuristic is admissible, the A* search is optimal
  • Coming up with admissible heuristics is most of what’s involved in using A* in practice.

Heuristic Design

An admissible heuristic function has to be designed case by case.

  • Euclidean Distance
    Is Euclidean distance (L2 norm) admissible? Always

  • Manhattan Distance
    Is Manhattan distance (L1 norm) admissible? Depends

Is L ∞ \infty norm distance admissible? Always
Is 0 distance admissible? Always

A* expands mainly towards the goal, but does not hedge its bets to ensure optimality.

Sub-optimal Solution

What if we intend to use an over-estimate heuristic?
Suboptimal path and Faster
Weighted A*: Expands states based on f = g + ε h f = g + \varepsilon h f=g+εh, ε > 1 \varepsilon>1 ε>1=bias towards states that are closer to goal.

  • Weighted A* Search
    • Optimality vs. speed
    • ε \varepsilon ε-suboptimal: cost(solution) <= ε c o s t ( o p t i m a l s o l u t i o n ) \varepsilon cost(optimal solution) εcost(optimalsolution)
    • It can be orders of magnitude faster than A*

Weighted A* -> Anytime A* -> ARA* -> D*

Greedy Best First Search vs. Weighted A* vs. A*

在这里插入图片描述

Engineering Considerations

Grid-based Path Search

  • How to represent grids as graphs?
    Each cell is a node. Edges connect adjacent cells.
Implementation
  • Create a dense graph.
  • Link the occupancy status stored in the grid map.
  • Neighbors discovered by grid index.
  • Perform A* search.

   \;

  • Priority queue in C++
  • std::priority_queue
  • std::make_heap
  • std::multimap

The Best Heuristic

They are useful, but none of them is the best choice, why?
Because none of them is tight
Tight means who close they measure the true shortest distance.

Why so many nodes expanded?
Because Euclidean distance is far from the truly theoretical optimal solution.

   \;

How to get the truly theoretical optimal solution
Fortunately, the grid map is highly structural.
在这里插入图片描述

  • You don’t need to search the path.
  • It has the closed-form solution!
    d x = a b s ( n o d e . x − g o a l . x ) d y = a b s ( n o d e . y − g o a l . y ) h = ( d x + d y ) + ( 2 − 2 ) ∗ m i n ( d x , d y ) dx = abs(node.x - goal.x)\\ dy = abs(node.y - goal.y)\\ h = (dx+dy) + (\sqrt2 - 2)*min(dx, dy) dx=abs(node.xgoal.x)dy=abs(node.ygoal.y)h=(dx+dy)+(2 2)min(dx,dy)

diagonal Heuristic h(n) = h*(n)

Tie Breaker

  • Many paths have the same f value.

  • No differences among them making them explored by A* equally.
    在这里插入图片描述

  • Manipulate the f f f value breaks tie

  • Make same f f f values differ.

  • Interfere h h h slightly.

    • h = h × ( 1.0 + p ) h = h \times (1.0 + p) h=h×(1.0+p)
    • p < m i n i m u m    c o s t    o f    o n e    s t e p e x p e c t e d    m a x i m u m    p a t h    c o s t p < \frac{minimum \; cost \; of \; one \; step}{expected \; maximum \; path \; cost} p<expectedmaximumpathcostminimumcostofonestep

Core idea of tie breaker:
Find a preference among same cost paths

  • When nodes having same f f f, compare their h h h

  • Add deterministic random numbers to the heuristic or edge costs (A hash of the coordinates).

  • Prefer paths that are along the straight line from the starting point to the goal.
    d x 1 = a b s ( n o d e . x − g o a l . x ) d y 1 = a b s ( n o d e . y − g o a l . y ) d x 2 = a b s ( s t a r t . x − g o a l . x ) d y 2 = a b s ( s t a r t . y − g o a l . y ) c r o s s = a b s ( d x 1 × d y 2 − d x 2 × d y 1 ) h = h + c r o s s × 0.001 dx1=abs(node.x - goal.x)\\ dy1 = abs(node.y - goal.y)\\ dx2 = abs(start.x - goal.x)\\ dy2 = abs(start.y - goal.y)\\ cross = abs(dx1\times dy2 - dx2\times dy1)\\ h = h+cross\times 0.001 dx1=abs(node.xgoal.x)dy1=abs(node.ygoal.y)dx2=abs(start.xgoal.x)dy2=abs(start.ygoal.y)cross=abs(dx1×dy2dx2×dy1)h=h+cross×0.001

  • … Many customized ways

   \;

  • Prefer paths that are along the straight line from the starting point to the goal.
    在这里插入图片描述

Jump Point Search

Core idea of JPS
Find symmetry and break them.

在这里插入图片描述

JPS explores intelligently, because it always looks ahead based on a rule.

Look Ahead Rule

Consider

  • current node x x x
  • x x x’s expanded direction
    在这里插入图片描述

Neighbor Pruning

  • Gray nodes: inferior neighbors, when going to them, the path without x x x is cheaper. Discard.
  • White nodes: natural neighbors
  • We only need to consider natural neighbors when expand the search.

在这里插入图片描述

Forced Neighbors

  • There is obstacle adjacent to x x x
  • Red nodes are forced neighbors.
  • A cheaper path from x x x’s parent to them is blocked by obstacle.

Jumping Rules

在这里插入图片描述

  • Recursively apply straight pruning rule and identify y as a jump point successor of x x x. This node is interesting because it has a neighbor z that cannot be reached optimally except by a path that visit x x x then y y y.
  • Recursively apply the diagnol pruning rule and identify y as a jump point successor of x x x
  • Before each diagonal step we first recurse straight. Only if both straight recursions fail to identify a jump point do we step diagnally again.
  • Node w, a forced neighbor of x x x, is expanded as normal. (also push into the open list, the priority queue)

pruning rule = look ahead rule

pesudo-code

Recall A* 's pseudo-code, JPS’s is all the same!

  • Maintain a priority queue to store all the nodes to be expanded
  • The heuristic function h(n) for all nodes are pre-defined
  • The priority queue is initialized with the start state X s X_s Xs
  • Assign g ( X s ) = 0 g(X_s)=0 g(Xs)=0, and g(n)=infinite for all other nodes in the graph
  • Loop
    • If the queue is empty, return FALSE; break;
    • Remove the node “n” with the lowest f(n) = g(n) + h(n) from the priority queue
    • Mark node “n” as expanded
    • If the node “n” is the goal state, return TRUE, break;
    • For all unexpanded neighbors “m” of node “n”
      • If g(m) = infinite
        • g(m) = g(n) + C n m C_{nm} Cnm
        • Push node “m” into the queue
      • If g(m) > g(n) + C n m C_{nm} Cnm
        • g(m) = g(n) + C n m C_{nm} Cnm
    • end
  • End Loop

在这里插入图片描述

Example

在这里插入图片描述

Extension

3D JPS

Planning Dynamically Feasible Trajectories for Quadrotors using Safe Flight Corridors in 3-D Complex Environments, Sikang Liu, RAL 2017
KumarRobotics/jps3d

Is JPS always better?

  • This is a simple example saying “No.”
  • This case may commonly occur in robot navigation.
  • Robot with limited FOV, but a global map/large local map.
    在这里插入图片描述
    Conclusion:
  • Most time, especially in complex environment, JPS is better, but far away from “always”. Why?
  • JPs reduces the number of nodes in Open List, but increase the number of status query.
  • You can try JPS in Homework2.
  • JPS's limitation: only applicable to uniform grid map.

Homework

Assignment: Basic

  • This project work will focus on path finding and obstacle avoidance in a 2D grid map.
  • A 2D grid map is generated randomly every time the Project is run, which contains the obstacles, start point and target point locations will be provided. You can also change the probability of obstacles in the map in obstacle_map.m
  • You need to implement a 2D A* path search method to plan an optimal path with safety guarantee.

Assignment: Advance

  • I highly suggest you implement Dijkstra/A* with C++/ROS
  • Complex 3d map can be generated randomly. The sparsity of obstacles in this map is tunable.
  • An implementation of JPS is also provided. Comparisons can be made between A* and JPS in different map set-up.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2146997.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

武汉大学:如何做好高校电子邮件账号安全防护

上个世纪七十年代&#xff0c;电子邮件占据了互联网的前身ARPANET上流量的75%&#xff0c;是最主要的应用。随着互联网的发展&#xff0c;电子邮件在全面普及后&#xff0c;被各种各样的即时通讯软件抢走了不少风头。然而&#xff0c;其始终还是被社会所认可的主流网络通讯渠道…

网络高级day01(Modbus 通信协议)

目录 1》modbus分类 1> Modbus RTU 2> Modbus ASCLL 3> Modbus TCP 2》Modbus TCP的特点 3》Modbus TCP协议 1> 报文头&#xff08;一共7个字节&#xff09; 2> 寄存器 3> 功能码 4> 数据 01H 功能码分析 05H 功能码分析 0FH 功能码分析 1》modbus…

git reflog 和 git log 的详解和区别

文章目录 1. git log 介绍基本用法&#xff1a;输出内容&#xff1a;常见选项&#xff1a;git log 的局限性&#xff1a; 2. git reflog 介绍基本用法&#xff1a;输出内容&#xff1a;git reflog 输出字段&#xff1a;常见选项&#xff1a;主要用途&#xff1a;示例&#xff1…

Rasa对话模型——做一个语言助手

1、Rasa模型 1.1 模型介绍 Rasa是一个用于构建对话 AI 的开源框架&#xff0c;主要用于开发聊天机器人和语音助手。Rasa 提供了自然语言理解&#xff08;NLU&#xff09;和对话管理&#xff08;DM&#xff09;功能&#xff0c;使开发者能够创建智能、交互式的对话系统。 1.2…

JavaScript 基础 - 第20天_Node.js模块化

文章目录 Day02_Node.js模块化目录学习目标01.模块化简介目标讲解小结 02.ECMAScript标准-默认导出和导入目标讲解小结 03.ECMAScript标准-命名导出和导入目标讲解小结 04.包的概念目标讲解小结 05.npm软件包管理器目标讲解小结 06.npm安装所有依赖目标讲解小结 07.npm全局软件…

计算机领域CCF推荐期刊A/B/C类全目录

计算机领域CCF推荐期刊 最新在检的【自动化与控制系统】的64本SCI期刊最新影响因子、期刊分区、自引率 CCF-A类 CCF-B类 CCF-C类 更多期刊解析干货&#xff0c;移步公众号【Unionpub学术】 计算机领域CCF推荐期刊A/B/C类全目录&#xff08;附excel下载&#xff09;

3.使用 VSCode 过程中的英语积累 - Selection 菜单(每一次重点积累 5 个单词)

前言 学习可以不局限于传统的书籍和课堂&#xff0c;各种生活的元素也都可以做为我们的学习对象&#xff0c;本文将利用 VSCode 页面上的各种英文元素来做英语的积累&#xff0c;如此做有 3 大利 这些软件在我们工作中是时时刻刻接触的&#xff0c;借此做英语积累再合适不过&a…

多线程篇六

多线程篇六 如笔者理解有误欢迎交流指正~⭐ 什么是单例模式&#xff1f; 单例模式是最常见的 设计模式. 顾名思义&#xff0c;单例模式指的就是单个实例的模式.&#xff08;针对某些类只能使用一个对象的场景【如MySQL、JDBC、DataSource】&#xff09; 设计模式 设计模式是…

CentOS7.9环境上NFS搭建及使用

Linux环境NFS搭建及使用 1. 服务器规划2. NFS服务器配置2.1 主机名设置2.2 nfs安装2.2.1 repo文件替换2.2.2 NFS服务安装 2.3 nfs配置2.4 服务查看2.5 资源发布2.6 配置nfs服务开机自启2.7 端口开放 3.应用服务器配置3.1 主机名设置3.2 nfs安装3.2.1 repo文件替换3.2.2 NFS服务…

Vue学习记录之五(组件/生命周期)

一、组件 在每一个.vue文件可以看作是一个组件&#xff0c;组件是可以复用的&#xff0c;每个应用可以看作是一棵嵌套的组件树。 在Vue3中&#xff0c;组件导入以后即可直接使用。 二、组件的生命周期 生命周期就是从诞生(创建)到死亡(销毁) 的过程。 Vue3 组合式API中(se…

Java中的事务管理

1.1 事务管理 1.1 事务回顾 事务是一组操作的集合&#xff0c;它是一个不可分割的工作单位。事务会把所有的操作作为一个整体&#xff0c;一起向数据库提交或者是撤销操作请求。所以这组操作要么同时成功&#xff0c;要么同时失败。 怎么样来控制这组操作&#xff0c;让这组操…

力扣最热一百题——合并两个有序链表

目录 题目链接&#xff1a;21. 合并两个有序链表 - 力扣&#xff08;LeetCode&#xff09; 题目描述 示例 提示&#xff1a; 解法一&#xff1a;比大小放入 Java写法&#xff1a; 运行时间以及复杂度 C写法&#xff1a; 运行时间以及复杂度 总结 题目链接&#xff1a…

Qt/C++事件过滤器与控件响应重写的使用、场景的不同

在Qt/C中&#xff0c;事件过滤器和控件响应重写是两种用于捕获和处理鼠标、键盘等事件的机制&#xff0c;它们的用途和使用场景不同&#xff0c;各有优劣。下面详细介绍它们的区别、各自适用的场景、以及混合使用的场景和注意事项。 1. 事件过滤器&#xff08;Event Filter&…

JavaScript 可选链操作符:深度解读与实战应用( JS 可选链操作符)

前言 在JavaScript开发中&#xff0c;我们经常会遇到访问嵌套对象属性的需求。然而&#xff0c;处理深层嵌套对象时&#xff0c;属性可能为 undefined 或 null&#xff0c;直接访问这些属性时会抛出错误。为了解决这种问题&#xff0c;JavaScript在ES2020中引入了一项新特性—…

104.游戏安全项目-基址的技术原理-基址的本质

免责声明&#xff1a;内容仅供学习参考&#xff0c;请合法利用知识&#xff0c;禁止进行违法犯罪活动&#xff01; 内容参考于&#xff1a;易道云信息技术研究院 本人写的内容纯属胡编乱造&#xff0c;全都是合成造假&#xff0c;仅仅只是为了娱乐&#xff0c;请不要盲目相信…

【初阶数据结构】一文讲清楚 “堆” 和 “堆排序” -- 树和二叉树(二)(内含TOP-K问题)

文章目录 前言1. 堆1.1 堆的概念1.2 堆的分类 2. 堆的实现2.1 堆的结构体设置2.2 堆的初始化2.3 堆的销毁2.4 添加数据到堆2.4.1 "向上调整"算法 2.5 从堆中删除数据2.5.1 “向下调整”算法 2.6 堆的其它各种方法接口函数 3. 堆排序3.1 堆排序的代码实现 4. TOP-K问题…

主机和Docker容器之间的文件互传方法汇总

Docker渐渐成为前端的一个工具&#xff0c;它像一个通用包装&#xff0c;可以把各种环境包裹其中&#xff0c;从而实现跨设备的兼容。使用的过程中&#xff0c;往往会需要将本地的文件和docker容器内部的文件互传&#xff1a;将主机的文件传递给容器内&#xff0c;让里面的工具…

【LLM大模型】如何让大模型更好地进行场景落地?

自ChatGPT模型问世后&#xff0c;在全球范围内掀起了AI新浪潮。 有很多企业和高校也随之开源了一些效果优异的大模型&#xff0c;例如&#xff1a;Qwen系列模型、MiniCPM序列模型、Yi系列模型、ChatGLM系列模型、Llama系列模型、Baichuan系列模型、Deepseek系列模型、Moss模型…

sqli-lab靶场学习(二)——Less8-10(盲注、时间盲注)

Less8 第八关依然是先看一般状态 http://localhost/sqli-labs/Less-8/?id1 然后用单引号闭合&#xff1a; http://localhost/sqli-labs/Less-8/?id1 这关的问题在于报错是不显示&#xff0c;那没办法通过上篇文章的updatexml大法处理。对于这种情况&#xff0c;需要用“盲…

从 InnoDB 到 Memory:MySQL 存储引擎的多样性

&#x1f4c3;个人主页&#xff1a;island1314 &#x1f525;个人专栏&#xff1a;MySQL学习 ⛺️ 欢迎关注&#xff1a;&#x1f44d;点赞 &#x1f442;&#x1f3fd;留言 &#x1f60d;收藏 &#x1f49e; &#x1f49e; &#x1f49e; &#x1f680;前言 &#x1f525…