Project 3: Orientation Control and Distance Sensing
All components of the project are due by Thursday, April 10th
at 5:00pm (or close of the lab, whichever is later).
Project Goals
At the end of this project, you should be able to:
- implement an Application Programming Interface (API) for
commanding a robot, and
- implement and tune a proportional-derivative controller that connects
sensing to actuation.
Project Overview
For this project, you will be creating a control program to maintain
the orientation of helicopter at a specified compass direction (i.e.,
you will be doing yaw control).
In brief, your craft must:
- Bring the throttle to a level sufficient for hovering. This is
easy to do in "open-loop" (without sensing) because the
cables dangling from the bottom of the craft add weight as the
craft rises.
- Hover for one minute.
- During the hover, the craft must maintain the same heading that
it had at lift-off.
- After the minute of hovering, the throttle must be reduced
slowly so as to bring the craft to a soft landing.
Project Components
All components are required to receive full credit for the project.
Part 1: Application Programming Interface
Implement the following functions:
- void set_throttle(uint8_t) will send the necessary
command to set the current throttle level (due to the dangling
wire, this signal is a combination of acceleration and
position command).
- void set_yaw(uint8_t) will send the necessary
command to set the current yaw level (this is essentially an
acceleration command).
- void throttle_test(void) A test function that will
slowly ramp the throttle up to a given level and then slowly
bring it down. The craft should lift gently into the air and
(just as gently) return to the ground.
Part 2: Proportional-Derivative Controller
Create a proportional-derivative controller that will bring the
craft's heading to a specified goal orientation. In essence, you will
implement the following:
yaw_command = yaw_center +
Kp * heading_error - Kv * heading_derivative
where Kp and Kv are gain parameters that you
must select (start small!), and yaw_center is the yaw
command that corresponds to "no yaw acceleration" (this latter
parameter should be 128).
Notes:
- If you are using different data types (e.g., int and float), you
must take care to cast one in terms of the other before mixing them (see
the AVR programming book on type casting)
- If the robot responds too slowly in correcting the heading, then
you may have Kv may be too high or Kp may be too low.
- If the robot overshoots the desired heading (so that it
oscillates around this heading), then Kv may be too low or Kp too
high.
- Be sure to work carefully through your choice of sign for Kp and Kv.
Your main loop will look something like this:
void main_loop(void) {
#APPROPRIATE VARIABLE DECLARATIONS HERE#
heading_current = #HOW SHOULD THIS BE INITIALIZED?#
heading_goal = #HOW SHOULD THIS BE INITIALIZED?#
while(1) {
heading_last = heading_current;
heading_current = get_heading();
heading_error = compute_error(heading_current, heading_goal);
heading_derivative = compute_derivative(heading_current, heading_last);
if(#COMMAND INPUT LINE#) {
display_orient(heading_current);
}else{
display_orient(heading_error);
}
display_derivative(heading_derivative);
yaw_command = yaw_center +
Kp * heading_error - Kv * heading_derivative;
set_yaw(yaw_command);
delay_ms(100);
}
}
References
What to Hand In
All components of the project are due by Thursday, April 10th at
5:00pm (or close of lab, whichever is later).
- Demonstration/Presentation: All group members must be
present.
- Demonstrate your final product.
- Present your design and implementation (5 minutes).
The group is
responsible for assembling a short presentation
consisting of 3-4 slides (on computer or in printed
form). Describe the design including: your general
approach to solving the problem, the circuit, any
key software algorithms (how the general problems are solved
in code), and the
software organization (describe how the software problem
is split into different separable sub-problems, and how
the different components interact).
- Code: Turn in your documented code to the
project 3 digital dropbox on D2L (text format). Only hand in
one copy of the code per group.
- Personal report: One submission per person to the
project 3 digital dropbox. State the
relative contribution of you and your group members (in terms of
percentage of effort) (text format only!)
Grading
Group grade distribution:
- 40%: Project implementation
- 30%: Demonstration/presentation of working project (to either
of the TAs or the instructor). This demonstration is due at
the same time as the reports
- 30%: Code documentation and group report
Grades for individuals will be based on the group grade, but weighted
by the assessed contributions of the group members.
fagg [[at]] ou.edu
Last modified: Wed Mar 26 23:24:01 2008