[HN Gopher] Finding the Air Cannon
       ___________________________________________________________________
        
       Finding the Air Cannon
        
       Author : mikecarlton
       Score  : 112 points
       Date   : 2024-01-30 09:30 UTC (13 hours ago)
        
 (HTM) web link (www.twobraids.com)
 (TXT) w3m dump (www.twobraids.com)
        
       | xnx wrote:
       | 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.
        
         | xnx wrote:
         | 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
        
           | avidiax wrote:
           | This is not the same problem. We don't have the distance to
           | the source, only the difference in arrival times.
        
             | xnx wrote:
             | "multilateration (MLAT) ... is a technique for determining
             | the position of an unknown point, such as a vehicle, based
             | on measurement of the times of arrival (TOAs) of energy
             | waves traveling between the unknown point and multiple
             | stations at known locations."
             | 
             | https://en.wikipedia.org/wiki/Pseudo-range_multilateration
        
         | bryanlarsen wrote:
         | Definitely what I would have tried to do. Likely would have
         | taken me longer than the approach the OP took.
        
         | votingprawn wrote:
         | 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
        
           | te wrote:
           | Epic comment and diagram, thanks. From this, how can we
           | calculate bearing and distance from one of our locations to
           | the source? Edit: I see that we can use multilateration
           | suggested by parent-sibling comment if we just had distance
           | to source (ie radius of unique tangent circle).
        
       | mixedmath wrote:
       | 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.
        
         | yorwba wrote:
         | 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.)
        
           | mixedmath wrote:
           | Ah yes, you're right! Thank you.
        
       | NotYourLawyer wrote:
       | 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.
        
         | elteto wrote:
         | A person's auditory reaction time is probably below 1s and that
         | would throw off your calculation by ~340m. Most farms are
         | larger than 340m in any direction so you still end up within
         | the same property area.
        
         | throwup238 wrote:
         | GPS sync allows phones to have accurate time to within
         | microseconds if not hundreds of nanoseconds. Since sound
         | travels ~300 m/s even 100ms only adds about 30 meters error.
         | That's more than accurate enough to pin point a plot of land.
        
       | gwern wrote:
       | Fun historical trivia: shortly after winning the Nobel Prize,
       | Bragg
       | https://en.wikipedia.org/wiki/Lawrence_Bragg#Work_on_sound_r...
       | spent WWI working on exactly this problem
       | https://en.wikipedia.org/wiki/Artillery_sound_ranging
        
       | mmh0000 wrote:
       | 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
       | <module>           from points import Point, Block
       | ImportError: cannot import name 'Point' from 'points'
       | (/usr/local/lib/python3.12/site-packages/points/__init__.py)
       | 
       | ```
        
         | advisedwang wrote:
         | That's because the points package [1] (which is a dead project)
         | doesn't have a Point class. The code in the article is probably
         | referring to their own custom module that they never shared. No
         | programming language lets you import code that only exists on
         | somebody else's hard drive.
         | 
         | [1] https://pypi.org/project/points
        
         | paavope wrote:
         | In this case it's the fault of the author in either not
         | including all the source code, or having undocumented
         | dependencies
        
           | echelon wrote:
           | This is a valid criticism of the Python community and
           | something the core language maintainers should look to
           | address.
           | 
           | Working in Python in the 2000s, I was extremely happy.
           | Working in Python (especially ML and data science
           | applications) in the 2020s is a nightmare. The world has come
           | a long way, and Python has actually taken a backslide.
           | 
           | Python would do well to learn from the Rust project and their
           | Cargo package manager and tooling.
        
             | pokey00 wrote:
             | > This is a valid criticism of the Python community and
             | something the core language maintainers should look to
             | address.
             | 
             | The author didn't include one of his custom source
             | libraries that's not needed to understand the code, so that
             | makes this a valid criticism of the Python community? lol
        
           | dendrite9 wrote:
           | Was this note at the bottom not there earlier? It seems to me
           | like a clear enough disclaimer.
           | 
           | Please note: this code is shared to show the algorithm, not
           | as a drop-in application that just runs. It depends on two
           | private modules configmanners and Points. Both of these are
           | on git hub, but to put them upload them to pip would be to
           | commit to supporting them in perpetuity. I'm not willing to
           | do that.
        
         | quasse wrote:
         | From the article:
         | 
         | > this code is shared to show the algorithm, not as a drop-in
         | application that just runs. It depends on two private modules
         | configmanners and Points. Both of these are on github
         | 
         | I don't know why you would find this so confusing, or blame
         | Python. The author literally explains that the points module is
         | not on pip. You installed some random pip package and expected
         | it to replace a different dependency.
        
       | sandworm101 wrote:
       | >>> Farmers with field crops are often beset with Canadian Geese
       | overwintering in the Willamette Valley.
       | 
       | No. I strongly suspect they are dealing with Canada Geese. They
       | are dominant in the photos. _Canadian_ geese would be some random
       | species of geese carrying a Canadian passport. _Canada_ geese are
       | the distinct grey-black species aka cobra chickens.
       | 
       | https://midwesternnewspapers.com/dont-cross-the-dreaded-cana...
        
         | pnemonic wrote:
         | Pedantic snark aside, "cobra chicken" is god damned hilarious.
        
         | beAbU wrote:
         | Not sure why you are being downvoted, this is the best kind of
         | pedanticism.
        
           | sandworm101 wrote:
           | A large number of people believe it impolite to correct
           | someone's language. I've seen it even called "colonial" to
           | correct written grammar, that we should just let language
           | evolve naturally and not try to enforce rules on others. I am
           | not of that mindset.
        
             | burkaman wrote:
             | I don't think it's obvious that Canadian Goose is any less
             | correct. It's in most dictionaries, and the scientific name
             | "canadensis" is supposed to mean "from Canada", which is
             | what Canadian means. Canada Goose is more common, but that
             | doesn't mean it's better.
             | 
             | It's also pretty likely that the geese in question in this
             | story are literally from Canada.
        
       | andrewla wrote:
       | More than the code, I'd be very interested in having the dataset
       | be made public.
        
       | mdip wrote:
       | This is a clever approach and it got me wondering a few things.
       | 
       | An hour or so from where I live there have been complaints about
       | an infrequent low rumbling sound for _years_ [0]. I'd wondered --
       | at the time -- why you couldn't just do something like they do
       | with the gunshot detectors to find the source of the sound[1]. I
       | suspect there must be a technical/physics reason that I am not
       | familiar with. This article re-enforced that thinking for me -- I
       | think I've heard one of these air cannons, before (I have not
       | heard the Windsor Hum), and its characteristics seem more like a
       | gunshot kind of sound than what's described here but ... if you
       | can record the time it starts from three different points (and
       | all you're looking for is "an area roughly the size of a large
       | factory" because it had always been suspected to be one of the
       | plants along the river), wouldn't this approach have been
       | simple/cheap enough to do to figure it out[2]?
       | 
       | [0] https://www.npr.org/2020/08/04/898853311/it-took-a-
       | pandemic-... -- it was solved because a steel plant shut down and
       | the problem went away.
       | 
       | [1] Part of the problem was that a subset of the population could
       | hear it and a subset of that population noticed it enough to be
       | bothered about it so it kind of led to a large number of people
       | dismissing complaints as "people who complain about WiFi signals
       | harming their health"
       | 
       | [2] And if I answer my own question: I suspect it probably was
       | and I suspect the reason it wasn't done is that nobody cared
       | enough to do it, really. :)
        
       | efitz wrote:
       | I really like the usage here. I would love to generalize the app
       | to find people hunting and setting off fireworks at impolite
       | times.
       | 
       | Why did you use pixels on a map image for location, instead of
       | GPS? Phones have GPS these days. You could have a simple app
       | where you push the button when you hear the noise, it reports to
       | a cloud function, and instantly triangulates and throws a point
       | on your favorite map program.
        
         | fwip wrote:
         | Writing an app and deploying it to three different devices
         | seems like a lot of complexity, compared to a clock, a pen, and
         | a piece of paper.
        
       | Log_out_ wrote:
       | Artillery triangulation app.
       | 
       | Imagine using such a farmers setup as vortex cannon, you could
       | down non turbulence resistant air vehicles such as drones and
       | glide bombs, with good timing.
        
       | VMG wrote:
       | My neighborhood had a similar issue a while ago (suspected
       | fireworks). I imagined a mobile phone app solution based with
       | high precision timing from GPS signal. Maybe there is a market
       | for it...
        
       | ok_dad wrote:
       | I can't imagine having to hear explosions every 2 minutes for 20
       | days!
       | 
       | The Army is doing some artillery training during the day and
       | night for the past week or so in my area, but luckily they aren't
       | doing it every 2 minutes all day and night, just for a few hours
       | up until about 11 or 12 at night and maybe every 5 or 10 minutes
       | they will fire a few rounds. It doesn't bother me anymore after
       | hearing it constantly, but I also live directly next to a very
       | busy street, so I am pretty used to loud noises. Maybe next year
       | when they do the training again I'll try to pinpoint the
       | explosions using this method (just for fun, because I am pretty
       | sure there's only one firing range around here).
        
       | PaulHoule wrote:
       | I cannot understand why the Canada Goose is protected under
       | federal law. There are so many in Stewart Park that I think about
       | taking one down with a net or a bolo but (1) I could get in
       | trouble and (2) I find commercial goose meat to be disgusting
       | (when they talk about eating a goose in a Dickens novel I gag)
       | and can't imagine a wild goose is palatable at all.
       | 
       | (I do have reports though that the eggs are great, I think
       | commercial goose eggs make the best Pirogi, and that someone was
       | able to take two eggs from a nest year after year and even though
       | they hissed bitterly the same pair would come back again year
       | after year.)
        
         | opwieurposiu wrote:
         | The Canada Goose is protected under federal law in the United
         | States primarily due to the Migratory Bird Treaty Act of 1918.
         | 
         | This was a treaty between Canada and USA, enacted to prevent
         | more extinctions due to hunting, as happened to the passenger
         | pigeon.
         | 
         | You can hunt them in the fall in most states, but you can't
         | hunt the most annoying ones that live inside city limits year
         | round. They do not taste great, good for dog food though.
        
       ___________________________________________________________________
       (page generated 2024-01-30 23:01 UTC)