我有一辆玩具车,它有一个arduino和4个超声波测距仪传感器,在前面、后面和两边,它们给我一个距离,如果在传感器覆盖的范围内有墙的话,感应器给我这些数据在很短的时间内,汽车必须在房间里移动并绘制轮廓,房间可以有列和不规则,我不知道这个绘图所涉及的算法,任何的洞察力都会很感激。
发布于 2014-02-01 08:40:56
heh曾经做过一个几乎相同的机器人:)
它可以在一个地方掉头(没有转弯半径)。
所以很容易驾驶和映射环境。
在你的情况下很难说,因为我们看不到汽车的运动学。
总之,有一些提示:
1.进行超声波听力时,电机应保持安静。
2.超声波发射器
3.movement
4.绘制房间地图
- place the car perpendicular to some wall
- clear map with unknown
- set position in the middle of map (x,y)2.回声-定位各方
- if wall is found mark it in the map on (x,y)+(distance \* side vector)
- and mark all space between x,y and the wall mark as space
- if no wall found then mark as space all cells in the map from x,y to (x,y)+(safe range\*side vector)
- side vectors can be: front(0,+1), back(0,-1), left(-1,0), right(+1,0)
- safe range is distance from your car where wall is always detected in [cells]
- distance is measured distance of wall in [cells]
- do not forget to add the emitter/receiver offsets from the car position into account
- also mark current position (x,y) as space3.寻找任何或最近或最快的移动标记为未知但邻近空间细胞的细胞
- if none such found then the mapping is finished (blink by LED or do some crazy move to signal it)
- if found then plan path and move car to it
- set position x,y to it4.后藤2
现在只需将数据从MCU挖掘到PC并查看。
备注
玩得开心:)
https://stackoverflow.com/questions/21489288
复制相似问题