I Crashed My Plane

by Octapoo

Tuesday, March 23, 2021 at 15:51:00 UTC

Return to the Summary in Ecstatic Lyrics Blog

So I took my plane to the RC field to test out my flight controller, and I kind of broke it.

This is only the front end. The rest is still in fairly good shape, but I'll have to remake this piece, and wash the dirt out of that motor.

I did have to throw away the battery as it was ever so slightly dented in the crash, which it seems like a waste to throw it away for so little damage but everyone on the internet insists that lipo batteries are a fire hazard and shouldn't be used with any damage, and I'd rather throw out a $20 battery than throw out my whole house. So the battery is presently discharging in the back yard encased in cinder blocks.

Everything else, even the rest of the plane which is just made out of foam board and tape, seems to be fine. If the battery hadn't been mounted at the front of the plane, it would probably be fine too. Crumple zones FTW I guess.

Other than the crash, the test was successful.

I went into it not wanting to test any GPS features because presently the servo motors are connected to the same 5 volt supply as all of the electronics, and when all of the servo motors make a large movement at once, they pull that down to 3 volts and it doesn't recover until about 50 ms later. I can actually show a picture as I was forced to buy a new oscilloscope since my old one has turned into a complete turd and I can't figure out why.

The new scope is a Rigol DS1054Z, which is also a complete turd BTW. However, it's a turd that at least kind of works, and it is nice to be able to capture one-time events like this one.

Anyway, the gyroscope seems to be unaffected (I guess because it's a 3.3 volt device), so I went to the field to test the features that use it, which are basically just the ability of the plane to automatically level itself in flight. In that regard, it did just fine, though I found that I had to increase the degree to which it moves the control surfaces to achieve that. I'm not surprised since when I turned the plane on and just moved it around, they weren't moving very much at all. (They were calibrated to what works well in the simulator.) So initially, with the auto-leveling turned on, I was only able to make wide turns and barely able to get the plane to climb to higher altitudes, but after increasing how far it is willing to move the control surfaces for a given amount of error, it was very easy to fly.

The auto-leveling feature is so much better than the flight stabilizer (which I bought on eBay) I was using before. The flight stabilizer just tries to keep the plane oriented how you last oriented it, but doesn't care if that is level or not. I guess the intent here is to make using it as similar to flying without one as possible, so that it's just correcting for turbulence. My auto-leveling however makes the plane stupid easy to fly. So easy in fact that after using it in the flight simulator for a while, I kind of lost what skill I had in flying without it. I turn it off and the plane starts rolling one way or the other and I have to constantly keep it upright and it's such a PITA.

However, the tendency of the plane to roll isn't nearly as bad in real life as it is in the simulator. I thought that might be because I had made my wings with dihedral (they're kind of a slight V shape) which is supposed to have some auto-leveling properties, but I cut that out and made the wings flat because its easier to transport a totally flat wing, and while at the park I flew for a minute without the auto-leveling and the plane still tends to keep itself upright. I don't know why that is. It seems like what the simulator behaves is correct, particularly since my battery (the bulk of the plane's weight) is mounted on top and so if anything I would think it would want to fly up-side-down, but it tends to stay up-right even without the auto-leveling. However, that auto-leveling is still awesome because I can turn the plane sideways, then just let go of the stick, and it fixes itself immediately. Normally if the plane is sideways you need to figure out how to fix it in the next 3 seconds or it's going to be on the ground.

Anyway, what eventually led to my crash was that I decided to move on and play with one of the GPS features: In addition to auto-leveling, it can also automatically stay at a certain altitude. This actually worked fairly well too. Where I had a problem was that I got bored with it and stopped using it, and flew up to about 100 meters (which I can actually know now because I made my flight controller send the altitude to my transmitter so it's on its display) and then decided I wanted to come back down. Since the auto-altitude is programmed to fly at 30 meters, I decided to just turn it on and let it do it automatically. The plane immediately dove straight down. I wasn't expecting that, but quickly realized it was how it was programmed there's a limit for its climb angle, but when wondering what the limit should be for descent, I decided to see what happened in the simulator first and in the simulator the plane just dove straight down, then pitched up to fly level at the correct altitude. So I never actually implemented a limit for downward pitch. So I thought "well, whatever, I'll just let it do its thing." However, it never pitched up. It flew straight down into the ground. It was actually kind of impressive because I don't think flying straight down into the ground is an easy maneuver. The plane kind of wants to turn to any angle other than straight down.

I can think of two reasons that might have happened. The first was that, in keeping that straight-down angle, it makes a lot of control surface adjustments, which mean a lot of voltage drops and so the GPS may have just never told it that it had gone down to the correct altitude due to positioning errors or perhaps a complete failure. The other possibility is that, simply because the GPS was now sideways instead of pointing up to the sky, the signal strenght of previously-strong sattelites may have been greatly reduced and so it wasn't giving the correct position because of that. ...or it could have been both. Either way, GPS errors aren't something that the simulator simulates, so I'm not surprised it failed.

It does have an on-board SD card that records all of the position and control data, as a sort of black box. I guess I'll take a look at it but I don't expect the problem was anything other than the GPS altitude position turning to shit during that maneuver, and that was probably because the electronics need to be on their own voltage regulator.

...three hours later...

So looking at the "black box" data, it's hard to tell exactly where it crashed since it doesn't log the raw accelerometer data, but instead just the orientation it calculates from it. However, it has a battery voltage sensor which drops to zero, and I assume that's where it crashed. (I guess it just disconnected the cable that the sensor uses.) Maybe 0.05 seconds before that it had just received a GPS fix which told it that it was 24 meters above the ground, and so it reversed the elevator, but even if that was its actual altitude, that was probably too late to get out of that dive. It should have been easing out of the dive from much further above, but it hadn't received a GPS fix since it was at 52 meters and so it didn't know it was time to do so.

There are a lot of problems with the logged data that I'll have to look into, but it looks like there should have been at least 8 GPS fixes between 52 meters and 24 meters, but it failed to parse the data for all of them. It's possible that's also related to the low voltage, but I suspect it's not since it happens over the entire log file, so I'll have to figure out what causes that.

...eighteen hours later...

So it turns out that my serial input buffer was too small. Since my serial routine replaces the last character in the buffer with an exclamation point when the buffer is full, and I throw out all of the GPS strings with invalid characters or invalid checksums, all of the corrupted data was thrown out and so all I ever saw were the 1 out of 10 GPS position fixes that weren't corrupted, which are enough to make it look like everything is working fine when you're testing the GPS while sitting still in a house.


If you were logged in, there would be a comment submission form here.
Creating an account is easy. You literally just type in a name and a password.
I don't want your email address, so there won't be any links in any emails to click.

Return to the Summary in Ecstatic Lyrics Blog