当前位置: 首页 > news >正文

[路径规划] VFF和VFH

VFF虚拟力场法

 1 #ifndef VFF_HEADER
 2 #define VFF_HEADER
 3 #include <vector>
 4 #include "utils\point.h"
 5 #include <stdlib.h>
 6 #include <math.h>
 7 #include <algorithm>
 8 //
 9 //target全局坐标系下的目标点
10 //obstacles围绕激光为中心-180度到180度逆时针激光扫描点
11 //theta里程计中的theta角
12 //desiredDirection机器人应该运动的方向(全局坐标)
13 inline void navigate(const GMapping::Point &target,const std::vector<float>    &obstacles,double theta,
14     double maxRobotSpeed,
15     double TARGET_ATTRACTIVE_FORCE,double TARGET_SLOW_APPROACHING_DISTANCE,
16     double &desiredDirection,
17     double &desiredSpeed)
18 {
19     //MRPT_UNUSED_PARAM(maxRobotSpeed);
20     // Forces vector:
21     GMapping::Point resultantForce(0,0),instantaneousForce(0,0);
22 
23     // Obstacles:
24     {
25         const size_t n = obstacles.size();
26         const double inc_ang = 2*M_PI/n;
27         double ang = -M_PI + 0.5*inc_ang+theta;//注意此处,从-180度开始逆时针存储数据
28         for (size_t i=0;i<n;i++, ang+=inc_ang )
29         {
30             // Compute force strength:
31             //const double mod = exp(- obstacles[i] );
32             const double mod = min(1e6, 1.0/ obstacles[i] );
33 
34             // Add repulsive force:
35             instantaneousForce.x = -cos(ang) * mod;
36             instantaneousForce.y = -sin(ang) * mod;
37             resultantForce =resultantForce+ instantaneousForce;
38         }
39     }
40 
41     const double obstcl_weight = 20.0/obstacles.size();
42     resultantForce =resultantForce* obstcl_weight;
43     double resultantForcenorm = sqrt(resultantForce.x    *resultantForce.x+ resultantForce.y+resultantForce.y);
44     const double obstacleNearnessFactor = min( 1.0, 6.0/resultantForcenorm);
45 
46     // Target:
47     const double ang = atan2( target.y, target.x );
48     const double mod = TARGET_ATTRACTIVE_FORCE;
49     resultantForce =resultantForce+ GMapping::Point(cos(ang) * mod, sin(ang) * mod );
50 
51     // Result:
52     desiredDirection = (resultantForce.y==0 && resultantForce.x==0) ?
53         0 : atan2( resultantForce.y, resultantForce.x );
54 
55     // Speed control: Reduction factors
56     // ---------------------------------------------
57     double targetnorm=sqrt(target.x    *target.x + target.y*target.y);
58     const double targetNearnessFactor = min( 1.0, targetnorm/(TARGET_SLOW_APPROACHING_DISTANCE));
59     //desiredSpeed = maxRobotSpeed * std::min(obstacleNearnessFactor, targetNearnessFactor);
60     desiredSpeed = min(obstacleNearnessFactor, targetNearnessFactor);
61 }
62 #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

相关文章:

  • 三招破局 轻松搞定大型直播晚会
  • 一次性代码(单例)
  • 前端面试之闭包
  • linux磁盘管理以及linux文件系统管理
  • 普通用户自动挂载光盘
  • SpringAOP拦截Controller,Service实现日志管理(自定义注解的方式)
  • eclipse自动为变量生成Get/Set函数
  • 【Unity】Update()和FixedUpdate()
  • python标识符
  • Ubuntu 12.04 怎样安装 Google Chrome
  • Xampps 1.9.1 系列版本正式发布
  • SSM框架——详细整合教程(Spring+SpringMVC+MyBatis)
  • Jfreechart绘制漂亮的图表
  • Linux TC基于HTB队列的流量管理范例
  • android 引导页设置(只让activity运行一次)
  • Angular Elements 及其运作原理
  • Django 博客开发教程 8 - 博客文章详情页
  • Java程序员幽默爆笑锦集
  • Java反射-动态类加载和重新加载
  • jquery cookie
  • mysql中InnoDB引擎中页的概念
  • unity如何实现一个固定宽度的orthagraphic相机
  • vue中实现单选
  • 分布式任务队列Celery
  • 让你的分享飞起来——极光推出社会化分享组件
  • 我建了一个叫Hello World的项目
  • 一个普通的 5 年iOS开发者的自我总结,以及5年开发经历和感想!
  • 用element的upload组件实现多图片上传和压缩
  • 宾利慕尚创始人典藏版国内首秀,2025年前实现全系车型电动化 | 2019上海车展 ...
  • 基于django的视频点播网站开发-step3-注册登录功能 ...
  • ​Python 3 新特性:类型注解
  • ​TypeScript都不会用,也敢说会前端?
  • # 飞书APP集成平台-数字化落地
  • (每日持续更新)jdk api之FileReader基础、应用、实战
  • (免费领源码)python+django+mysql线上兼职平台系统83320-计算机毕业设计项目选题推荐
  • (七)微服务分布式云架构spring cloud - common-service 项目构建过程
  • (求助)用傲游上csdn博客时标签栏和网址栏一直显示袁萌 的头像
  • (已解决)vue+element-ui实现个人中心,仿照原神
  • (译)2019年前端性能优化清单 — 下篇
  • .net core webapi 部署iis_一键部署VS插件:让.NET开发者更幸福
  • .NET Micro Framework初体验
  • .NET 材料检测系统崩溃分析
  • .NET 命令行参数包含应用程序路径吗?
  • .NET/C# 的字符串暂存池
  • .NET多线程执行函数
  • .NET使用存储过程实现对数据库的增删改查
  • .NET运行机制
  • /bin/bash^M: bad interpreter: No such file ordirectory
  • /etc/skel 目录作用
  • @data注解_一枚 架构师 也不会用的Lombok注解,相见恨晚
  • @Resource和@Autowired的区别
  • [ 代码审计篇 ] 代码审计案例详解(一) SQL注入代码审计案例
  • [20180129]bash显示path环境变量.txt
  • [asp.net core]project.json(2)
  • [hive] sql中distinct的用法和注意事项