Name:

Password:

or

New GPS & Automated Flight Code Testing

by Octapoo

Friday, October 23, 2020 at 00:43:00 UTC

Return to the Summary in Ecstatic Lyrics Blog

I tested the new GPS yesterday. It seems to be incredibly accurate and doesn't drop satellites as soon as the plane is in motion. I'm really impressed with it.

I spent the last week playing with algorithms to fly the plane, testing them with the RC flight simulator. Flying a plane with code is kind of stupidly easy. I employed the simplest algorithms I could think of and they worked fine. It seems to just be a matter of not having any bugs in the code.


The first thing I did was write a little code that kept the plane level using ailerons and elevator, but let me control rudder and throttle. With that, flying the plane around and landing it was stupidly easy, like driving an RC car. I just pointed it where I wanted it to go and when I wanted it to come down I reduced the throttle.

I then wrote some code to steer it using the rudder towards waypoints, and again that was quite easy. The only complication that came up was that steering towards the waypoints themselves allows wind to blow the plane off track quite a bit when the next waypoint is far away. So I instead made it steer towards a point that's about 10 meters away on the track between the previous waypoint and the next, so that it sticks a lot closer to the track.

Then I made the code able to steer with ailerons rather than rudder which again wasn't very hard. I even made it smart enough to use elevator or rudder in proportion to the roll of the plane, and thus it can fly up-side-down and even sideways in as much as the plane can stay in the air while flying sideways. I think flying up-side-down may actually be quite useful, since in trying to mount a camera, I don't want to put things on the bottom of the plane since they hit the ground when it lands, but if I can just fly up-side-down at a location where I want it to take a photo, then the camera can be mounted on top of the plane and the plane can just flip over when it needs to take a photo, or perhaps I could just put the camera on the side and it can fly at a 45° roll in order to point it downwards.

I then tried having it fly up 200 meters, then dive straight down, but turn up when it was 10 meters from the ground. I truly expected it to just hit the ground due to how primitive my algorithms are in not taking into account the velocity of the plane, but it turned up and flew away before hitting the ground just like it was programmed to do. I was also impressed with how well it could fly straight up because I know from flying it manually in the simulator that it's really difficult to keep the plane pointed straight up, but it's not much of a problem for computer code. You can see it constantly has to make corrections but it does keep the plane pointed straight up.

I also tested it out by turning up the wind speed in the simulator, which has a nice side effect of creating more turbulence for the plane as the simulator actually tries to model realistic wind based on the terrain, including thermal updrafts. The code keeps the plane stable and only runs into trouble at 30 MPH because the planes can only fly about that fast and so at that point they're not able to fly against the wind.

Overall I think it's time to move on to making some hardware. In particular, I've spent hours watching this code fly autonomously and I found one bug that only became apparent after the plane flew in one direction for 15 minutes. There's no point in totally debugging code I won't even be using, so I think it's time to build the hardware it will run on and then start testing the actual code that will be flying the plane.

Comments


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