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

文章目录

  • 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.xdnf.cn/news/1539923.html

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

相关文章

关于安卓App自动化测试的一些想法

安卓App自动化一般使用PythonAppium。页面元素通常是使用AndroidStudio中的UI Automator Viewer工具来进行页面元素的追踪。但是这里涉及到一个问题就是&#xff0c;安卓apk在每次打包的时候&#xff0c;会进行页面的混淆以及加固&#xff0c;所以导致每次apk打包之后会出现页面…

强弱电的基本知识和区别

什么是弱电&#xff1a; 弱电一般是指直流电路或音频、视频线路、网络线路、电话线路&#xff0c;直流电压一般在36V以内。家用电器中的电话、电脑、电视机的信号输入&#xff08;有线电视线路&#xff09;、音响设备&#xff08;输出端线路&#xff09;等用电器均为弱电电气设…

2024年软考——系统集成项目管理工程师30天冲刺学习指南!!!

距离2024下半年软考已经只剩一个多月了&#xff0c;还没有开始备考的小伙伴赶紧行动起来。为了帮助大家更好的冲刺学习&#xff0c;特此提供一份考前30天学习指南。本指南包括考情分析、学习规划、冲刺攻略三个部分&#xff0c;可以参考此指南进行最后的复习要领&#xff0c;相…

如何配置 谷歌Gmail邮箱 开启SMTP/IMAP服务流程

本篇专门定向讲解谷歌Gmail邮箱&#xff0c;如何开通SMTP协议的流程&#xff0c;在讲篇幅前&#xff0c;我需要你确定3件事&#xff1a; 1.你已经有谷歌账号了 2.你很清楚自己为什么想要开通SMTP服务 3.你已经掌握一定的基础知识&#xff0c;能够达到翻出了 谷歌Gmail邮箱开启S…

什么是HTTP DDOS,如何防护

在当今高度互联的网络世界中&#xff0c;网络安全威胁日益严峻&#xff0c;其中HTTP DDoS&#xff08;Distributed Denial of Service&#xff0c;分布式拒绝服务&#xff09;攻击作为一种常见的网络攻击手段&#xff0c;给企业和个人用户带来了巨大的挑战。今天我们就来详细介…

react hooks--useCallback

概述 useCallback缓存的是一个函数&#xff0c;主要用于性能优化!!! 基本用法 如何进行性能的优化呢&#xff1f; useCallback会返回一个函数的 memoized&#xff08;记忆的&#xff09; 值&#xff1b;在依赖不变的情况下&#xff0c;多次定义的时候&#xff0c;返回的值是…

基于PHP的新闻管理系统

作者&#xff1a;计算机学姐 开发技术&#xff1a;SpringBoot、SSM、Vue、MySQL、JSP、ElementUI、Python、小程序等&#xff0c;“文末源码”。 专栏推荐&#xff1a;前后端分离项目源码、SpringBoot项目源码、SSM项目源码 系统展示 【2025最新】基于phpMySQL的新闻管理系统。…

谈勒索攻击 — 趋势、手法、应对

就在近日&#xff0c;鸿海集团旗下半导体设备大厂——京鼎精密科技股份有限公司&#xff08;以下简称“京鼎”&#xff09;遭到了黑客的入侵。黑客在京鼎官网公布信息直接威胁京鼎客户与员工&#xff0c;如果京鼎不支付赎金&#xff0c;客户资料将会被公开&#xff0c;员工也将…

list(一)

list是可以在常数范围内在任意位置进行插入和删除的序列式容器&#xff0c;并且该容器可以前后双向迭代。list的底层是双向链表结构&#xff0c;双向链表中每个元素存储在互不相关的独立节点中&#xff0c;在节点中通过指针指向 其前一个元素和后一个元素。 支持 -- 但是不支持…

3 种自然语言处理(NLP)技术:RNN、Transformers、BERT

自然语言处理 (NLP) 是人工智能的一个领域&#xff0c;旨在使机器能够理解文本数据。NLP 研究由来已久&#xff0c;但直到最近&#xff0c;随着大数据和更高计算处理能力的引入&#xff0c;它才变得更加突出。 随着 NLP 领域的规模越来越大&#xff0c;许多研究人员都试图提高…

大数据-141 - ClickHouse 集群 副本和分片 Zk 的配置 Replicated MergeTree原理详解

点一下关注吧&#xff01;&#xff01;&#xff01;非常感谢&#xff01;&#xff01;持续更新&#xff01;&#xff01;&#xff01; 目前已经更新到了&#xff1a; Hadoop&#xff08;已更完&#xff09;HDFS&#xff08;已更完&#xff09;MapReduce&#xff08;已更完&am…

python | x-y 网格切片

写在前面 通常&#xff0c; 我们处理的毕竟完善的nc产品&#xff0c;一般呈现未timexlatxlon的维度&#xff0c;且lon和lat都是规则的网格&#xff0c;我们可以方便的使用xarray.sel()选择合适的区域进行切片。但是&#xff0c;部分nc产品比如卫星轨道或者模式输出的数据&…

二、编译原理-词法分析

一、词法分析器的作用 1、词法分析器的作用 读入字符流&#xff0c;组成词素&#xff0c;输出词法单元序列 过滤空白、换行、制表符、注释等 将词素添加到符号表中&#xff0c;以便编译的各个阶段取用 2、词法单元、模式、词素 &#xff08;1&#xff09;词法单元 (token…

NLP开端:Tokenizer-文本向量化

Tokenizer 问题背景 An was a algorithm engineer 如上所示&#xff0c;在自然语言处理任务中&#xff0c;通常输入处理的数据是原始文本。但是算法模型自能处理数值类型&#xff0c;因此需要找到一种方法&#xff0c;将原始的文本数据转换为数值类型的数据。这就是分词器所…

Java 方法重写(难)

目录 1&#xff0e;A类和B类都写一个相同的方法&#xff0c;先用static&#xff0c;两边都是一样的&#xff1a; 2&#xff0e;A类和B类都去掉static&#xff0c;出现了两个圆圈的符号&#xff0c;代表重写&#xff1a; 3&#xff0e;总结 4&#xff0e;为什么需要重写&…

thinkPHP 8.0.4 安装

windows 上安装最新版 thinkPHP8.0.4 下载phpStudy V8.1&#xff1a;小皮面板安装Composer2.x&#xff0c;Composer是PHP的一个依赖管理工具&#xff0c;主要功能包括依赖管理、版本控制、自动加载、扩展开发以及集成其他工具。安装 php8.0.2 4. 网站-管理-compose&#xff0c…

204页PPT金税四期监管要求与最新政策及风险防范-培训课件

读者朋友大家好&#xff0c;最近有会员朋友咨询晓雯&#xff0c;需要《204页PPT金税四期监管要求与最新政策及风险防范-培训课件&#xff08;经典》资料&#xff0c;欢迎大家下载学习。 金税四期稽查的重点包括以下方面&#xff1a; 企业发票&#xff1a;关注资金流、发票流、…

前后端独立部署的企业级私有化文档管理系统丨无忧·企业文档

大家好&#xff0c;我是软件部长&#xff0c;今天给大家介绍一款企业级在线知识库项目-JVS的无忧企业文档。 JVS提供低代码、物联网、规则引擎、智能BI、逻辑引擎、无忧企业文档&#xff08;在线协同&#xff09;、无忧企业计划、无忧企业邮筒等平台&#xff0c;欢迎关注微信公…

vscode连接不上远程服务器

删除缓存.vscode 然后再删除.ssh

Vue3快熟

Vue3快速上手 1. Vue3简介1.1. 【性能的提升】1.2.【 源码的升级】1.3. 【拥抱TypeScript】1.4. 【新的特性】 2. 创建Vue3工程2.1. 【基于 vue-cli 创建】2.2. 【基于 vite 创建】(推荐)2.3. 【一个简单的效果】 3. Vue3核心语法3.1. 【OptionsAPI 与 CompositionAPI】Options…