When the James Webb Space Telescope (or nearly any other modern spacecraft, for that matter) wants to change its orientation, how does it do so? It's not obvious how to turn something around in space where there's nothing (not even air) to push against. You might consider using thrusters, but those come at a cost! They require propellant. Propellant weighs a lot, and you can run out of it! A thruster shoots material into space when it fires, which can interfere with sensitive instrumentation. Furthermore, thruster fires tend to be impulsive in nature, which can excite vibrational modes in the spacecraft and don't allow for the ultra-precise control required to point at a distant star. Fortunately, thrusters aren't the only option for changing a spacecraft's orientation!
For changing the orbit of a spacecraft, you must have an external force (like a thruster) acting on the spacecraft. But to change the orientation of a spacecraft, we just need a torque! That torque might come from a thruster exerting a force, since $\bf{\tau} = \bf{F} \times \bf{r}$, but it can also come from a change in angular momentum, since $\tau = \frac{d \bf{L}}{dt}$. A spacecraft can change its orientation by storing angular momentum in an internal device, and then exchanging angular momentum between that device and the spacecraft body. Often, that device is a reaction wheel.
A reaction wheel is a heavy, spinning disc rigidly mounted inside the spacecraft. The reaction wheel + spacecraft is a closed system which must conserve angular momentum. So, if we make the reaction wheel spin slightly faster in the clockwise direction, the spacecraft body will compensate by spinning in the counterclockwise direction. Point a reaction wheel in each direction, and you've got 3-axis control! If you care to dive into the physics, please see here.
In this lab, we will use a PID controller to modulate the speed of a reaction wheel at the end of an inverted pendulum. The torque that the reaction wheel exerts on the pendulum will balance it. In order for this to work, we must close the loop around a measurement of the pendulum angle. This angle will be estimated using a complementary filter of accelerometer and gyroscope measurements from an IMU.
Key concepts: PID control, PWM, electrical isolation, complementary filters and sensor fusion, I2C, timers, timer interrupts, digital low-pass filtering, gyroscopes, accelerometers, UART, threading, VGA, fixed-point arithmetic
Please see demo video below.
Experience shows that students prefer these webpages short. For that reason, please find the reading and background materials on the webpages linked below. Please note that the information in these readings will be critical for completing the lab.
You may organize your program however you like. Here is a suggestion:
- Clears the interrupt flag
- Reads the MPU-6050 for accelerometer and gyro measurements
- Uses these measurements in a complementary filter to compute arm angle.
- Runs the PID control loop at 1000/sec using the angle measurements from the complementary filter and the desired angle
- Sets a hardware PWM signals using output-compare units to control the motor using the command:
pwm_set_chan_level(slice_num, PWM_CHAN_X[A or B], pwm_on_time);
.
- Takes user input from the serial interface to setup PID parameters and the desired angle.
- Diplays accelerometer angle, gyro angle, complementary angle, and low-passed control input on VGA display
Note that these checkpoints are cumulative. In week 2, for example, you must have also completed all of the requirements from week 1.
By the end of the lab section in week one of the lab you must have:
By the end of the lab secton in week two of the lab you must have:
- Set the desired tilt angle
- Set the PID proportional gain
- Set the PID differential gain
- Set the PID integral gain
- The new values should take effect immediately
- One set of coefficients should produce balancing and minor disturbance rejection.
You will demo all of the features above to a course staff member. You program should not need to be reset during the demo.
Your written lab report should include all the sections mentioned on the policy page, and: