[路径规划] VFF和VFH
VFF虚拟力场法
#ifndef VFF_HEADER
#define VFF_HEADER
#include <vector>
#include "utils\point.h"
#include <stdlib.h>
#include <math.h>
#include <algorithm>
//////////////////////////////////////////////////////////////////////////
//target全局坐标系下的目标点
//obstacles围绕激光为中心-180度到180度逆时针激光扫描点
//theta里程计中的theta角
//desiredDirection机器人应该运动的方向(全局坐标)
inline void navigate(const GMapping::Point &target,const std::vector<float> &obstacles,double theta,
double maxRobotSpeed,
double TARGET_ATTRACTIVE_FORCE,double TARGET_SLOW_APPROACHING_DISTANCE,
double &desiredDirection,
double &desiredSpeed)
{
//MRPT_UNUSED_PARAM(maxRobotSpeed);
// Forces vector:
GMapping::Point resultantForce(,),instantaneousForce(,); // Obstacles:
{
const size_t n = obstacles.size();
const double inc_ang = *M_PI/n;
double ang = -M_PI + 0.5*inc_ang+theta;//注意此处,从-180度开始逆时针存储数据
for (size_t i=;i<n;i++, ang+=inc_ang )
{
// Compute force strength:
//const double mod = exp(- obstacles[i] );
const double mod = min(1e6, 1.0/ obstacles[i] ); // Add repulsive force:
instantaneousForce.x = -cos(ang) * mod;
instantaneousForce.y = -sin(ang) * mod;
resultantForce =resultantForce+ instantaneousForce;
}
} const double obstcl_weight = 20.0/obstacles.size();
resultantForce =resultantForce* obstcl_weight;
double resultantForcenorm = sqrt(resultantForce.x *resultantForce.x+ resultantForce.y+resultantForce.y);
const double obstacleNearnessFactor = min( 1.0, 6.0/resultantForcenorm); // Target:
const double ang = atan2( target.y, target.x );
const double mod = TARGET_ATTRACTIVE_FORCE;
resultantForce =resultantForce+ GMapping::Point(cos(ang) * mod, sin(ang) * mod ); // Result:
desiredDirection = (resultantForce.y== && resultantForce.x==) ?
: atan2( resultantForce.y, resultantForce.x ); // Speed control: Reduction factors
// ---------------------------------------------
double targetnorm=sqrt(target.x *target.x + target.y*target.y);
const double targetNearnessFactor = min( 1.0, targetnorm/(TARGET_SLOW_APPROACHING_DISTANCE));
//desiredSpeed = maxRobotSpeed * std::min(obstacleNearnessFactor, targetNearnessFactor);
desiredSpeed = min(obstacleNearnessFactor, targetNearnessFactor);
}
#endif
参考mrpt中的代码,因为其中针对的是全向机器人,所以做了部分修改适用有Heading的机器人。
VFH矢量场直方图
该方法取机器人周围一定距离范围的窗口,将空间离散为$w_{s}*w_{s}$栅格。
扩展阅读
https://github.com/agarie/vector-field-histogram
https://github.com/ecmnet/MAVSlam/tree/c55e63eca4111e01245e0e3389f1e568782096fc/MAVSlam/src/com/comino/slam/vfh/vfh2D
http://www-personal.umich.edu/~johannb/vff&vfh.htm
[路径规划] VFF和VFH的更多相关文章
- 【BZOJ-3627】路径规划 分层图 + Dijkstra + spfa
3627: [JLOI2014]路径规划 Time Limit: 30 Sec Memory Limit: 128 MBSubmit: 186 Solved: 70[Submit][Status] ...
- 基于谷歌地图的Dijkstra算法水路路径规划
最终效果图如下: 还是图.邻接表,可以模拟出几个对象=>节点.边.路径.三个类分别如下: Node 节点: using System; using System.Collections.Gene ...
- Unity路径规划
Unity路径规划 转自:http://www.cnblogs.com/zsb517/p/4090629.html 背景 酷跑游戏中涉及到弯道.不规则道路. 找来一些酷跑游戏的案例来看,很多都是只有 ...
- iOS百度地图路径规划和POI检索详细总结-b
路径规划.png 百度地图的使用 百度地图API的导入网上说了许多坑,不过我遇到的比较少,这里就放两个比较常见的吧.坑一: 奥联WIFI_xcodeproj.png 如上图所示,在infoplist里 ...
- COJ 0500 杨老师的路径规划(MST)最小生成树
杨老师的路径规划(MST) 难度级别:B: 运行时间限制:1000ms: 运行空间限制:51200KB: 代码长度限制:2000000B 试题描述 为满足同学们需求,杨老师在实验楼4层新建了好多个计算 ...
- octomap中3d-rrt路径规划
路径规划 碰撞冲突检测 在octomap中制定起止点,目标点,使用rrt规划一条路径出来,没有运动学,动力学的限制,只要能避开障碍物. 效果如下: #include "ros/ros.h&q ...
- ROS(indigo)RRT路径规划
源码地址:https://github.com/nalin1096/path_planning 路径规划 使用ROS实现了基于RRT路径规划算法. 发行版 - indigo 算法在有一个障碍的环境找到 ...
- ROS探索总结(十四)——move_base(路径规划)
在上一篇的博客中,我们一起学习了ROS定位于导航的总体框架,这一篇我们主要研究其中最重要的move_base包. 在总体框架图中可以看到,move_base提供了ROS导航的配置.运行.交互接口,它主 ...
- 游戏AI之路径规划(3)
目录 使用路径点(Way Point)作为节点 洪水填充算法创建路径点 使用导航网(Navigation Mesh)作为节点 区域分割 预计算 路径查询表 路径成本查询表 寻路的改进 平均帧运算 路径 ...
随机推荐
- sqlzoo需要知道的那些事
1.“Bahamas 巴哈馬”中有三個 a,還有嗎?找出所有國家,其名字包括三個或以上的a. SELECT name FROM world WHERE name LIKE '%a%a%a%' 2.“I ...
- 官方文档:Office VBA 参考
https://docs.microsoft.com/zh-CN/office/vba/api/overview/ Office VBA 参考 https://docs.microsoft.co ...
- Oracle数据库入门——目录结构
一.Oracle_Home目录 Oracle_Home主目录位于D:\dev\oracle\product\10.2.0(oracle安装路径)下,它包含Oracle软件运行有关的子目录和网络文件以及 ...
- centos下nginx的启动
今天下载了个nginx,编译安装之后,无法启动,以前的启动方法无法实现(services nginx start), 在网上找了半天,才找到一个方法,与大家分享: 命令如下: 启动:/usr/loca ...
- Nodejs----单点登录
---------------------------------------------------------------------------------------------单点登陆原理- ...
- html学习_认识html
1.HTML骨架 <html>----根标签 <head>---头标签 </head> <body>---主体标签 </body> < ...
- HDU 3183 - A Magic Lamp - [RMQ][ST算法]
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3183 Problem DescriptionKiki likes traveling. One day ...
- 406 UDP协议是面向非连接的协议
HTTP The Definitive Guide Table 3-1. Common HTTP methods Method Description Message body? GET ...
- Linux7安装Oracle 11g 86%报错:Error in invoking target 'agent nmhs' of makefile
解决方案在makefile中添加链接libnnz11库的参数修改$ORACLE_HOME/sysman/lib/ins_emagent.mk,将$(MK_EMAGENT_NMECTL)修改为:$(MK ...
- LeetCode 1012 Complement of Base 10 Integer 解题报告
题目要求 Every non-negative integer N has a binary representation. For example, 5 can be represented as ...