AME 3623: Project 5: Rate Gyroscopes and Damping Control

Key to successful control in embedded systems is the ability to integrate information about the external state of your system into the control decisions that are being made. In this project, we will finally close a loop between sensing and actuation. We will add one more component to your circuit: an inertial measurement unit (IMU). The IMU contains three distinct sensors (with three degrees of freedom each): an accelerometer, a rate gyroscope and a magnetometer. The gyroscope will be used in this project to dampen rotational disturbances. In project 6, we will use all nine degrees-of-freedom to estimate the orientation of the hovercraft.

At the end of this project, you should be able to:

Component 0: Library Installation

The new library provides the following functions:

Component 1: Hardware and Circuit

In order for your hovercraft to lift off the floor, it must be balanced. Move your circuit board into a position such that your craft is balanced front-to-back and left-to-right. We will be providing battery mounts for this purpose.

The IMU is a MPU-9250. Mount the Inertial Measurement (IMU) on the mast that we provide. The advantage of the mast is that your sensor will be less subject to magnetic interference from the hovercraft motors and wires, as well as sources buried in the floor.

Connect the IMU to your circuit. The pins are:

Component 2: Software

  1. Copy the following function from project 1:
  2. Copy the functions that you developed in project 4 into your current project.

  3. Implement a new PeriodicAction (called sensor_task) that executes once per 5 ms The associated sensor_step() function should:

  4. Implement the following function:

  5. Implement a new finite state machine in fsm_step(). This state machine will:
    1. Ramp up the central fan to a ~70% duty cycle in 5 seconds.
    2. Wait in this state for 30 seconds.
    3. Ramp down the central fan to zero.

  6. Implement a new PeriodicAction (called control_task that executes once per 10 ms. The associated control_step() function will implement a damping rotation controller. Specifically:
    float ddx = 0.0;
    float ddy = 0.0;
    float ddtheta = -Kv * IMU.gz;   // gz = gyro about the Z axis
    set_hovercraft_acceleration(ddx, ddy, ddtheta);
           

Project Template

Below is your starting point for your project.

#include "PeriodicAction.h"
#include "ImuUtils.h"

// Promise that we will implement this function later
void control_step();

// Create a task that will be executed once per 10 ms
PeriodicAction control_task(10, control_step);

// Promise that we will implement this function later
void sensor_step();

// Create a task that will be executed once per 5 ms
PeriodicAction sensor_task(5, sensor_step);

void setup() {
  // Initialize the USB serial connection
  Serial.begin(115200);

  // Initialize the IMU
  imu_setup();

  // Add your project-specific setup code here

}

/* 
 * Take one step in querying the sensors
 */
void sensor_step()
{
  imu_update();
}



/**
 * No changes necessary to the loop (except to add new tasks)
 */
void loop() {
  // Check to see if it is time to execute the various tasks
  sensor_task.step();
  fsm_task.step();
  control_task.step();
}

Component 3: Testing


What to Hand In

All components of the project are due by Thursday, March 29th at 1:30 pm

Grading

Personal programming credit: Group grade distribution:

Group Grading Rubric

Grades for individuals will be based on the group grade, but weighted by the assessed contributions of the group members to the non-personal programming items.


andrewhfagg -- gmail.com

Last modified: Wed Mar 28 15:09:50 2018