【问题标题】:Looking for an algorithm for robot navigation [closed]寻找机器人导航算法[关闭]
【发布时间】:2016-04-12 09:27:39
【问题描述】:

我有一个移动机器人,其距离传感器连接到平移伺服电机。电机连续旋转以将传感器从 0 度移动到 180 度并返回。

距离传感器每隔几毫秒发送一个信号,以扫描周围的障碍物。可以像这样可视化距离传感器生成的数据:

我希望创建一种算法,使机器人能够向可用空间最多(或障碍物最少)的方向移动。

更正式地说,我可以将输入和输出表示为:

  • 输入:每个电机旋转角度到最近物体的距离数组。

  • 输出:代表最佳角度的单个值。

对算法的要求是:

  • 不应受到数据异常值的影响(传感器有时会出现不可预测的峰值)
  • 不需要绝对最优,1-2% 的折扣是可以接受的
  • 高效(这将在小型微处理器上运行)
  • 业余爱好者可以理解(我不是 ML 专家;))

【问题讨论】:

  • 1-2% 的折扣是什么?不管它是什么,都很难实现。有任何想法吗?你试过什么吗? (这被认为是获得帮助的必要条件)

标签: python algorithm computer-vision robotics


【解决方案1】:

我不知道您使用的语言(我是 Java 和 C# 人),所以我将使用伪代码:

EPSILON : Float = .02f -> this is our margin of error

DIRECTION : Integer = 0 -> the best direction to go

DISTANCE : Float = 0 -> the furthest distance from the robot

DISTANCES : Float[181] -> the values you get from your sensor

DISTANCE = DISTANCES[DIRECTION] // set the first distance

     for(int index = 1; index < size_of(DISTANCES)-1; index++) {
        //we are checking if the value is within 2% of the previous and next values
        if((DISTANCES[index-1] * (1+EPSILON) >= DISTANCES[index] AND
            DISTANCES[index-1] * (1-EPSILON) <= DISTANCES[index]) OR 
           (DISTANCES[index+1] * (1+EPSILON) >= DISTANCES[index] AND
            DISTANCES[index+1] * (1-EPSILON) <= DISTANCES[index])) {
       //if the distance at index is greater than the current max distance,
       //we set that to be the new max distance
        if(DISTANCES[index] > DISTANCE) {
           DISTANCE = DISTANCES[index]
           DIRECTION = index
          }
        }
     }

您还可以使用传感器进行两次扫描并比较每个点的距离以查看是否有任何尖峰,但鉴于您列出的规格,这应该可以工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-22
    • 1970-01-01
    • 2014-09-28
    • 1970-01-01
    • 2011-04-12
    • 2013-11-01
    • 2023-03-15
    • 2021-10-04
    相关资源
    最近更新 更多