- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I'm sorry, did I read that right?
"Turbo Pascal code that controlled the missile ..."
Are you INSANE?
Admin
I was going to snark about being able to visualise a "perfect parabola" for a missile launch, and then I realised ... with only just enough thrust to make five meters horizontally, yes, you probably could.
More of a mouse squeak than a roar, though, I would imagine. It was probably hilariously funny to watch.
Admin
Apparently not-so-serious procedures about code checkin, such as pull requests/change approval.
Admin
This is an old article ?
Admin
Well, it is not Ada as I initially suspected (walrus assignment && military).
Ada uses -- as start of comment, spanning to EOL (apparently borrowed by Lua).
Admin
No indeed, definitely not Ada, I'd have recognised it.
Ada was fun. I miss it.
Admin
That's why I normally use line comment and not block comments.
Admin
The real thud should have been Simon, landing on his butt when he and whomever who did not review this change, got fired ... right before a TEST launch of a MISSILE.
This is a scary WTF.
Admin
Never mind that World War 3 being might be about to start, the real apocalypse will be launched by some WTF code that's involved with launching nukes.
Admin
How many safe-guards were missing for this to happen ? Were there no unit tests ? Linting ? Syntax highlighting ? Code review ? Cloud-based machine learning evaluating the algorithm against Kerbal Space Program ? Is this story from past millennium ?
Admin
What's wrong with Turbo Pascal? It's old, but it was pretty good for the time
Admin
3 things. 1, thank God nobody was harmed in the test. 2, I don't know what editor they use, but I doubt it has live highlighting; it would have helped him spot unfinished comment. 3, this is a good reminder that readonly variables are an important tool which prevent exactly these types of bugs.
Admin
Once upon a time I heard stories about legacy systems and ancient hardware, so I believe there is grain of truth to this. Clearly, the things the military uses are specialty items. And once they have something that works, they do stick with it. That can be for decades and generations. Obsolescence doesn't come to them because of market conditions.
Admin
What I'm curious about is how they arrived at 2 as the divisor there. Did the engineers say yeah this yaw control is exactly twice as good divide by 2? Was this supposed to be a let's just try 2 and see how it goes?
Admin
Live highlighters have been around for Pascal for 30 years or more. They're pretty easy to do simple versions of for many languages, with Pascal being definitely one of them; it's only determining the meaning of an identifier that requires anything sophisticated. (Things get harder once you introduce something like LINQ, but then it isn't Pascal any more.)
Admin
This is dynamic control, there's a feedback loop. If the change is a bit too small or too large - no problem, it will be corrected in the next iterations. So, this only matters so that the first few changes to this variable aren't as dramatic as the initial model suggested, because they probably were big enough that the missile became unstable (each consecutive correction getting bigger).
That's the simple explanation, a bit naive maybe. For a better one, background in dynamic systems and control theory would be needed. Or far more time to think about how to phrase it than I'm willing to invest in a comment.
Admin
Turbo pascal suggests that this is 30+ years.
Later, it became common to detect nested comments, which would have prevented this
Ada "--" comments specifically avoid this.
Admin
and source code control was pretty primitive in those days
Admin
At that point the thrusters controlled by the code wouldn’t even be working yet, only the booster that serves to push it far enough out of the launch tube that the sustainer motor can be ignited at a safe distance from the launcher and the people operating it. This booster burns out before the missile leaves the launch tube, so yes, at that point it would just follow a parabola to the ground.
Admin
If they were using TurboPascal, then they should have been using the TurboPascal IDE. Version 6.0, released in 1990, introduced syntax highlighting which would have shown exactly what the error was the moment it was made. Previous versions did not.
That puts this story somewhere in the 1980s, but considering it involves a military contractor they could have had a hard requirement for TurboPascal 3.0 well into the 21st Century, along with requiring specialized keyboards and not being allowed to wear shoes while on site.
Admin
It's been a long time but I didn't remember Turbo Pascal ever having comment highlighting. All I can picture is keyword highlighting.
And it's quite obvious this isn't a nuclear missile. This is some sort of infantry-launched weapon, either anti-air or anti-tank. Stage 1 burns out in the launch tube so while there's a big blast of fire behind the guy launching it (shooting out a window is pretty close to suicide, although there are now some rounds that are merely unpleasant to fire indoors) the missile is simply coasting for a bit after launch, the main motor doesn't ignite until it's far enough away from the launcher that it won't fry him.
However, I think the main engine did ignite in this case. It's just with gravity turned off the flat trajectory it should have followed became ballistic instead. This makes me think it was more likely an anti-tank missile than an anti-aircraft missile as the latter would have perceived it's target as moving and steered towards it anyway. Based on the apparent timing I would guess the system is the FGM-148 Javelin missile.
Admin
Ada was born in the 1970s, Lua in the 1990s.
Admin
What are "demands for pitch, yaw and roll" ?? Also, what is "gravity over predicted velocity" ?? And how are the roll thrusters twice as efficient as "expected" (engineered??) ?? Efficiency should be irrelevant in this step, since you are just calculating roll "demand" and whatever that is, it presumably would be a value that gets fed to specific thruster logic that would map that rotational request into precise thruster control, taking into account efficiency at that point.
I'm not quite sure this was written or overseen by physicists... I call Shenanigans!
Admin
Its the re-assignment of a variable value that's the real problem. The unterminated comment just illustrates that the problem exists.
Admin
Ballistic trajectories are only parabolas if the planet you're firing the projectile on is flat; otherwise, it's an ellipsoid that is almost the same shape over small distances. If you fire it hard enough, the projectile and the planet orbit each other (though the planet doesn't move very much, unless it's a really huge projectile).
I'm using "projectile" here because I agree with the above comments that the "missile" was probably not making any attempt to adjust its trajectory. Constant feedback terms in Z while applying thrust from behind would produce a spiral shape while accelerating and a circle at constant velocity (possibly distorted by the effects of gravity and air resistance and any course-corrections in X and Y the guidance system tries to do). If it's not tracing a spiral or asymmetric shape in the sky, then probably some logic elsewhere in the code kicked in and concluded that some part of the control loop is busted, and did the safest thing a missile could do during a test--turn off the engine, become a projectile, and wait for the ground to make it stop moving.
With a parabolic trajectory (and a flat finite planet) the projectile falls back through the plane of the planet. If it's fired hard enough, it goes past the outside edge of the disc, and with no planet to interrupt it, it accelerates infinitely forever due to whatever strange force makes objects fall onto the surfaces of flat planets in those universes that have them. That's obviously nonsense, but it's nonsense they'd be familiar with if they had developed and debugged a simulator's physics engine to test the code before firing a real missile with it...
Admin
I used Pascal for first time in 10th grade then had a class using Turbo Pascal in college. TP7 has syntax highlighting. At that time I loved PASCAL. My JR year of high school I had Fortran :)
Admin
When I worked for a company writing software for missile guidance systems, we developers (using Ada!) faced at least three rounds of testing before a code change got into a live firing: desktop, local test rig, parent company’s test rig, ..
Admin
Yes, I've definitely read something similar to this before. As I recall, the original claimed that the brace could in some circumstances demarcate a block of code in addition to comments, and the good folks in the comment section did not believe that any version of Pascal behaved this way.
Admin
Never leave old computer languages on you resume, or you will get called in to maintain old military code from the 1970s. For example, they wanted me to relocate to Southern California to maintain JOVIAL code for radar.
Admin
Ah yes. One of my debacles. Only this one was less explosive, it was in an architectural design app. The Macintosh had just gotten color API's, which were somewhat clumsily layered onto the original graphic API's. So we had to go through the code adding the new color calls. Somewhat unfortunately, while the IDE was in many ways glorious, it did not have comment highlighting. So this code would not work as expected:
Funny, but the CGrafPort never worked quite right.
I spent several hours on this and got nowhere. Eventually I blamed it on maybe due to us having version 1.0 of the new graphics code. I gave up on this. My boss took a whack at it and within 10 minutes he had spotted the error. Funny, I was never called back for another debug session. One of my more ignominious fails.