Live data from Hacker News

Have you ever hurt yourself from your own code?

blog.nikitas.link

271–280 of 432 posts

Re: Have you ever hurt yourself from your own code?

#271
post #53

About seven years ago I got a bright idea to build a quadcopter. I had experience with little $25-50 drones that bumped around the house with their fragile one-inch propellers, which obviously qualified me to build and pilot something significantly bigger. Off to Aliexpress and Banggood I went. I ordered a carbon-fiber chassis, big strong motors, ESCs, 3-inch propellers, a FrSky receiver, a Devention transmitter, an…

In a similar vein, I once stuck my finger in one of the fans on my desktop to stop it from knocking.

Sliced it pretty good! Honestly, if I had just touched it closer to the center it probably would have been okay...

Re: Have you ever hurt yourself from your own code?

#272

A few years ago, I ordered the cheapest six-axis robotic arm from ebay for about $100 that came with basically no software or motor-driver boards, so I did it all from scratch with a PCA9685 board, a basic kernel driver and some very hacky scripts from user space. One day I had some friends over for a glass of wine, and wanted to show off my creation. I invited them into my "lab" and placed my wine glass down on the…

I remember in college (mech ENG BTECH) I had a coursemate who's day job was a programmer on the CNC side.

She mentioned that this had happened to a v high end CNC machine the cutting tool after a power cut went straight to the home position very $$$$$$$

At my place we had a computer controlled wave tank and as the guy I shared an office with said you could program the ram to go full travel in zero time which would have flooded the lab.

Re: Have you ever hurt yourself from your own code?

#273
post #35

Earlier quoted context omitted.

I used to do robotics, I can tell you that the fact that it was the cheapest or the most hacky does not matter in the least. Everything can and will go wrong, even the priciest and well documented part. I used to have multiple clamps around the controller, message bus, the firmware and also a physical barrier, and yet would not feel safe with my fingers or person around moving parts.

Some small metal pressing machines for example have two buttons, one on each side of the machine. You have to push them both for the machine to operate. This means your hands can't be squished. Or a dental x-ray machine has the final "run" button in the hallway so the nurse taking x-rays must go there to do it, so they don't get repeated exposure.

If you want to manually operate an industrial robot via its controller, you usually have to squeeze a "deadman" switch or else the robot will engage its brakes. What's neat is that the deadman switch is a 3-position switch: They discovered that when people panic they either let go or squeeze harder, so both actions stop the robot.

Re: Have you ever hurt yourself from your own code?

#274
I run a home HVAC thermostat with custom code that has no other hardware fallback.

Once, due to a logic error on my part the heater was triggered in the middle of the summer while I was out of town. The internal temp got up to well over 100°F.

I was able to have a friend come over and disconnect things for me, but I could have killed a pet, at the least, if not some more sensitive hardware.

Re: Have you ever hurt yourself from your own code?

#275

Earlier quoted context omitted.

> why don't you head on home for the day and I'll call you there? As non-native English speaker this expression really puzzles me.

In other words: please go home and I'll call you. 'Head on home' is a real expression. Similar ones are 'head over there', 'head to ...', all of which just mean 'go to'.

is that a pars pro toto?

Re: Have you ever hurt yourself from your own code?

#276

Earlier quoted context omitted.

> it plays random noise at the maximum possible level, bypassing the system volume but why bypassing the system volume? It does not make sense to me.

If the system volume is a multiplier and the float values have large exponents... Small times huge ~= huge. I guess safe volume control should ideally limit the output energy. Energy is proportional to square (or so) of frequency, so ideally it would take that into account as well. That rules out simply hard-clamping sample values because that creates high frequency / energy distortions. Not trivial, especially if lo…

Exactly and it's not obvious at first. You can easily see that the system doesn't limit the FP audio in Logic Pro: you can in principle crank up the volume all you want. So if the system volume multiplier is, say, 0.1, you can have a buffer with values -10..10 and that will play at maximum volume fine. Everything beyond that will get clipped by the DAC.

So random FP noise clipped is still random FP noise at maximum level.

Re: Have you ever hurt yourself from your own code?

#277

Earlier quoted context omitted.

> it plays random noise at the maximum possible level, bypassing the system volume but why bypassing the system volume? It does not make sense to me.

I hit this bug just the other night, and I think what caused it was accidentally sending NaNs to the audio API. That bypassed whatever clamping functions were in place, and just produced an ear-piercing shriek. Very unpleasant.

No, it's not just NaN's, see my reply above.

Re: Have you ever hurt yourself from your own code?

#278
post #53

About seven years ago I got a bright idea to build a quadcopter. I had experience with little $25-50 drones that bumped around the house with their fragile one-inch propellers, which obviously qualified me to build and pilot something significantly bigger. Off to Aliexpress and Banggood I went. I ordered a carbon-fiber chassis, big strong motors, ESCs, 3-inch propellers, a FrSky receiver, a Devention transmitter, an…

People are sometimes kind of down on that approach in software, considering it sloppy. Especially in comparison to other engineering disciplines it just looks kinda bad sure. But really I'm pretty sure if for example civil engineers could build a bridge in an hour and load it up consequence-free they'd do it too. The fact that we do it isn't bad at all, but yeah it's easy to not realize when you've exited the realm o…

Well hundreds of years of bridge disasters, fatalities and some times bad poetry [https://www.scottishpoetrylibrary.org.uk/poem/tay-bridge-dis...] is a harsh teacher.

Re: Have you ever hurt yourself from your own code?

#279

Earlier quoted context omitted.

In other words: please go home and I'll call you. 'Head on home' is a real expression. Similar ones are 'head over there', 'head to ...', all of which just mean 'go to'.

is that a pars pro toto?

no that's latin
Post reply on HN