Mysterious GPS plot-patterns

Sorry for leaving you hanging on what we’ve been doing lately! In the mean time we’ve actually successfully tested the plane and watched it move about in the air (Insert wild cheers here). It was supposed to fly straight, but since the Trim did not reset during the manual flight up, we had it flying in tight circles. This problem has since been fixed, and we’re going to plan another test flight in the near future.

Here’s what we’ve been working on lately. The GPS is connected and transferring data, but there is a weird pattern showing up when the GPS is stationary. Perhaps this could provide a clue as to how to get even more accurate position data from the GPS alone.

Sorry about the audio quality by the way. It seems like the wifi was messing with the microphone–weird!

Getting it all packed up

Wow, it’s hard to believe we’ve made it this far. All the boards are packed up in a tight-fit, plastic box which protects all the components and also makes it super easy to upload the program via a small hole cut for the mini-USB on the Arduino Nano.

Containment Box

Containment Box

Containment Box

The small switch allows us to turn the link to the IMU off since uploading to the nano does not work when the serial link is connected.

The small switch allows us to turn the link to the IMU off since uploading to the nano does not work when the serial link is connected.

Stay tuned for our first test of the autopilot in action!

~ the RADAR Team

Test Board Demonstration Video

Here I demonstrate our current setup with a test board. I’m demonstrating the closed loop operation with periodic trimming. I only showed the ailerons working, but the pitch control surface works as well.

The first part of the program “demos” the control surfaces, then checks to see if the IMU is connected. If it is not connected, it will not move on to the main part of the program. (This will be useful when we program the plane to take-off, as we do not want it to take-off without receiving positional data!)

The main part of the program uses a single line of code to control the roll, pitch, yaw, speed, and duration; like this:

myPlane.fly(roll, pitch, yaw, motor, time);

Inputting any particular values into the function will cause the plane to “hold” the given angles and speeds for the duration specified.

By creating this handy function, it will be now easy to chain these functions together dynamically to create complex maneuvers based on mathematical functions.


Using contstrain() to limit servo values

After fiddling around with my dysfunctional, bloated Servo limit function, I decided to scrap it entirely and go with something else that was more intuitive. I knew that there must be something that would serve my purposes without using a bunch of if statements and switch statements. As it turns out—that function was constrain(). It’s really easy to use if you have specific functions to adjust their respective servos. Here’s how I did it:

void Plane::Aileron(byte desiredDir, int increase) {
  int deg;
  switch(desiredDir) {     
  case RIGHT:  
      deg = aileronServo.read()-increase;
      deg = constrain(deg, minAileronServoLimit, maxAileronServoLimit);
      aileronServo.write(deg);
    break;

  case LEFT:
...

In this case, I calculate the original servo command, constrain it to my 2 global variables, minAileronServoLimit and maxAileronServoLimit, and then Servo.write() the resulting integer.

Test Board Almost Completed

Over the last week we built a flight system test board. The board will be used to test and debug the UAV (Unmanned Aerial Vehicle) programs. There is still one PCB that needs to be mounted in the middle of the test board (The Mongoose).

IMG_3806

The over view shows the board with most of the main components.

IMG_3809

Since this is a four channel airplane we have four readouts one for each channel.

IMG_3810

The roll indicator is mounted on the end of the test board so that when the board is tilted to simulate plane roll, the aileron gauge will be relevant to the position of the board and therefore more easily read.

The Airplane

We are using a Banana Hobby foam airplane for the UAV airframe. The airplane flies very nice and should work well as a UAV for the time being.

IMG_3799

The airplane’s wingspan is about 55″ wingtip to wingtip.

IMG_3800

We upgraded to a six channel radio so that we could use channel five as the switch between autonomous and manual flight modes. The Hobby King radio set has worked quite well.