Live data from Hacker News

Finding the Air Cannon

twobraids.com

1–10 of 47 posts

Re: Finding the Air Cannon

#2
Nice work. I feel like there must be some way to triangulate the sound source through direct calculation, but that trigonometry is too advanced for me.

Re: Finding the Air Cannon

#3
This is an unexpected programming application. It's nice that the farmer actually changed behavior after receiving the phone call.

At first, I thought there was a clear improvement. This problem essentially boils down to finding the intersection point of three circles. But it's also likely that with the small fuzz from imprecise time measurement that the three measured circles wouldn't actually intersect. I would guess that a small boost could be achieved by sampling points near the two intersection points of any two circles, but this is moot when it's just possible to brute force the whole grid.

Re: Finding the Air Cannon

#4
post #2

Nice work. I feel like there must be some way to triangulate the sound source through direct calculation, but that trigonometry is too advanced for me.

ChatGPT tipped me off that it's called multilateration and provided the formulas. I Google search turned up this Python code: https://github.com/glucee/Multilateration

Re: Finding the Air Cannon

#5
I was thinking that you’d need a pretty accurate clock reference to do this, automatically triggering based on a microphone to log the time.

But I guess not. Sound is slow on a distance scale of miles, so timing it to the nearest second is good enough.

Re: Finding the Air Cannon

#6
post #2

Nice work. I feel like there must be some way to triangulate the sound source through direct calculation, but that trigonometry is too advanced for me.

Definitely what I would have tried to do. Likely would have taken me longer than the approach the OP took.

Re: Finding the Air Cannon

#7

This is an unexpected programming application. It's nice that the farmer actually changed behavior after receiving the phone call. At first, I thought there was a clear improvement. This problem essentially boils down to finding the intersection point of three circles. But it's also likely that with the small fuzz from imprecise time measurement that the three measured circles wouldn't actually intersect. I would gue…

Since the time of the cannon shot is unknown, only the time when it can be heard at a known location, you can't even pinpoint its unknown origin in space to a circle. Instead, the range of possibilities forms a cone in spacetime (exactly like the lightcone of electromagnetic waves, except with sound and also treating space as two-dimensional for simplicity).

The intersection of two such cones is a parabola. The intersection of the third cone with the plane containing said parabola gives another parabola that can intersect the first one in zero, one, two or an infinite number of points. In the zero-point case, you could still find the location where the two parabolas are closest.

(Or you could forget about geometry, define an objective function and do gradient descent to it.)

Re: Finding the Air Cannon

#8
post #2

Nice work. I feel like there must be some way to triangulate the sound source through direct calculation, but that trigonometry is too advanced for me.

If you want to avoid doing the maths I think you can draw the problem out (assuming the world is a flat piece of paper and the source is located on the same piece of paper with you)

From the timings given you can work out the distance from location B and C to the wavefront when it hits point A (4 x 330 and 6 x 330). If you then draw a circle centered at point B with radius 1320m, and a circle centered C with radius 1980m, then there is only one circle you can draw that intersects point A, and is tangent with the circles drawn at B and C. The center of that circle is the source (with an appropriate radius of error for timing measurement and distance measurement between A, B, and C)

https://imgur.com/a/tqV0ToU

Re: Finding the Air Cannon

#10
I really dislike Python.

This is a clean install of Python straight from the Python developers in a clean container. And it doesn't work. I figured I must need "points" so I pip-installed that.

Feels like every time I try to use Python, stupid, incomprehensible errors such as this occur:

```

  root@1623eb794014:/# ./tri.py
  Traceback (most recent call last):
    File "//./tri.py", line 6, in 
      from points import Point, Block
  ImportError: cannot import name 'Point' from 'points' 
  (/usr/local/lib/python3.12/site-packages/points/__init__.py)
```
Post reply on HN