Mapping · University · about 30 min
One reading is two statements: free all the way along the ray, occupied at the end of it.
[1 mark]A mapper marks only the cell at the end of each beam as occupied. What is wrong with the map it builds?
[1 mark]Which of these is the inverse sensor model?
[1 mark]The sensor finds nothing within range and returns its maximum. How should the mapper treat that beam?
[1 mark]Why does the free marking stop one cell short of the hit?
[1 mark]What does this program print?
import math CELL = 5.0 x, y, h = 100.0, 50.0, 90.0 a, r = 0.0, 40.0 th = math.radians(h + a) hit_x = x + r * math.sin(th) hit_y = y + r * math.cos(th) print(round(hit_x, 1), round(hit_y, 1)) print(int(hit_x / CELL), int(hit_y / CELL))
[1 mark]What does this program print?
CELL = 5.0
X0, Y0 = 100.0, 50.0
d = 100.0
free = set()
r = 0.0
while r < d - CELL:
free.add((int(X0 / CELL), int((Y0 + r) / CELL)))
r += CELL / 2
print(len(free), (int(X0 / CELL), int((Y0 + d) / CELL)))
[1 mark]A mapper's walls come out mirrored about the diagonal of the mat, and otherwise look plausible. What is the most likely bug?
Take a reading, run the inverse sensor model along it, and print free:, the number of different cells the ray passes through, and wall y:, the mat y of the cell it ended in.
from bugbot import * connect() CELL = 5.0 X0, Y0 = 100.0, 50.0
Plan your program here, then type it in and press Run.
d instead of stopping short. What happens to the hit cell?scan() are at 50 cm and at 150 cm.