# HumBird Challenge

Here’s an interesting control problem. This time your spuCraft is not constrained to move along a straight line. Now it can move up, down, left, and right. And it can rotate. If you control it precisely, your HumBird spuCraft can hover and get the flowers.

In this problem, we will learn about integral action, and get to use Evans’ root locus to think about control design.

#### Table of Links

- Video: Introduction to Humbird
- Mathematical Model of the HumBird SpuCraft
- One Degree of Freedom Altitude Dynamics
- Altitude Control: First Attempt
- Making Sense of Steady State Error
- Using Feed Forward to Reduce or Eliminate Steady State Error
- Thinking About How an Integrator Works
- Getting Rid of Steady State Error Manually
- Practical Considerations of Altitude Controller
- Finishing the Altitude Controller
- Designing the Lateral Controller
- First Steps at Implementing Lateral Control
- Focus on Roll Control
- Finishing the Lateral Control

#### Video: Introduction to HumBird

Here we outline the goals of HumBird and show you how to get your SpuPilot started. The attached document provides a copy of the code and parameter values.

#### Mathematical Model of the HumBird SpuCraft

##### One Degree of Freedom Altitude Dynamics

We’re going to start with just the vertical dynamics. We’ll try to hold the spuCraft at a fixed altitude. Start by deriving equations that describe the dynamics.

#### Altitude Control: First Attempt

Here is a first attempt at controlling the altitude of the spuCraft. We implement a straightforward PD controller. It kinda works. The spuCraft’s altitude stabilizes… eventually. Also, there is a steady state error.

#### Making Sense of the Steady State Error

The following are some questions you should consider

#### Using Feed Forward to Reduce or Eliminate Steady State Error

When you know the weight of the spuCraft precisely, it is possible to eliminate the steady state error precisely with feed forward action. However, if there is uncertainty, the feed-forward will generally not eliminate all error.

#### Thinking About How an Integrator Works

To eliminate steady state error in the presence of uncertainty we are going to use an integrator. But before we put the integrator to use, let’s recall how it works.

#### Getting Rid of Steady State Error Manually

Now I want you to get rid of the steady state error, but do it manually with your gamepad. By pushing the thumbstick up and down, you can add or subtract a little from the thrust signal so that you can properly balance the weight and eliminate the error. We investigate two ways of doing this. One is with direct thumbstick input. The other sends the thumbstick input to an integrator and then uses the integrator output to augment the thruster signal.

By observing how one can get rid of steady state error manually, we can figure out how to write a mathematical algorithm that does the same.

#### Practical Considerations for Altitude Controller

In order to get your controller to work better, I offer some advice.

#### Finishing the Altitude Controller

Now it’s time to finish the altitude controller. You need the dynamics to decay fast enough to get that first flower. Then you need the controller to maintain proper elevation as your spuCraft is sweeping side to side, hunting flowers.

An example of using Matlab’s SISO Design Tool (sisotool/rltool) to find PID controller gains is provided here.

#### Equations of Motion (including lateral dynamics)

Here is a video solution:

#### Designing the Lateral Controller

How do you control the spuCraft to go side to side? This video will get you started on designing your lateral controller.

#### First Steps at Implementing Lateral Control

Let’s implement the lateral controller you derived. It should work for smaller excursions, but the big ones will likely be problematic. To successfully get the flowers, though, you’ll have to fly across the screen in a controlled way.

#### Focus on Roll Control

In the previous problem, we found that we run into problems when the spuCraft roll angle gets too large. Here we focus on the dynamics and control of roll and take action to prevent crashing.

#### Finishing the Lateral Control

The last step is to embed the roll controller into the lateral position controller. This video should take you to the finish line.