Each drone is built a little differently. Due to differences in the weight distribution and other factors, the drone will tend to initially drift in a particular direction.
First tune throttle_low.init_i in pid_class.py. This is the initial value of the I term for the throttle, which controls altitude. The default value is 100. What happens when you set it to 50? What happens when you set it to 150? Describe the drone’s behavior in each case.
Next you will set the trim on roll and pitch. When flying the drone over a textured surface, observe what happens. Does the drone stay still or move? How much does it move, qualitatively?
Repeat this experiment five times. Each time make sure that you
Our controller is a dual I term PID controller. The high-rate I term changes quickly, allowing fast response to changes. The low-rate I term changes slowly, allowing the drone to adjust to systemic sources of error such as poor weight distribution or a damaged propeller. In the next part of the course we will go into more detail with this structure. For now we are just asking you to be responsible for the intuition.
First change pid_class.py
to print out roll_low._i, roll._i, pitch_low._i and pitch._i.
Note that you may need to repeat
this process periodically, for example after a crash or the like.
Always place the drone so that the camera is closer to you and the skyline is farther away. Then
roll controls sideways movement. Pitch controls forward and backward
movement.
Make sure the battery is secured with velcro and placed in the same position to control for weight distribution.
Next perform one flight. After the drone takes off, do not give it movement commands but allow it to drift. (Don’t allow it to hit anything though! You might have to kill or take over if it drifts a lot.)
Once you have achieved good trim, you can try position control. Try to fly your drone for an entire battery without touching the controls! Do not try this until your I term preloads have been tuned as described above.
This video demonstrates the drone doing a zero velocity hover and drifting in the scene. Then we turn on position hold (you can tell because it drops the throttle as it takes over, and holds its position for several minutes.
Then we turn off the positon hold so you can see it drift again, and then turn it on again at the end and land. You can tell when it is turned on because we move the drone back to the center of the flight area before each hold.
Engage position control in two steps. First you have to tell the drone to “remember” a frame. You can do this using the “r” key. This will save the frame at the drone’s current location. Next you have to engage or disengage position control. You can toggle this mode with the “p” key. So the procedure is to first save a frame (target location for the position hold) using “r” and then shortly after (before drifting too much) type “p”.
Position hold works best over a textured surface with lots of visual contrast. Even when doing position hold, always be ready to kill in case of a mishap. Especially be careful when looking at other windows