I am trying to detect an open door using LIDAR. I have 270 degrees LIDAR read and I’m trying to detect the door from the graph:
The door is the peak between 100 and 150.
The door is between ~30 and ~40.
Here there is a “noise” spike.
I can see that there is a huge spike in the graph where the door “starts” and “ends”. I wondered if the is a scipy/numpy or other library function that can detect this.
Thanks
Advertisement
Answer
I don’t think there is a function for this, your problem is kind of specific. But, I think it wouldn’t be hard to detect this manually, since other parts of the detection don’t have such high derivatives.
You can do something like this:
JavaScript
x
21
21
1
dx = 2
2
dy = 4
3
4
spike_start = None
5
spike_end = None
6
7
for i in range(len(points)):
8
# Detect high derivative when spike starts
9
if spike_start is None and points[i] - points[i-dx] >= dy:
10
spike_start = i
11
12
# Detect high negative derivative when spike ends
13
if spike_start is not None and points[i-dx] - points[i] >= dy:
14
spike_end = i
15
break
16
17
if spike_start is not None and spike_end is not None:
18
print(f"Door is between {spike_start} and {spike_end}")
19
else:
20
print("Door not found")
21
Play with dx
and dy
to properly detect the spike.