Digital control of the inverted pendulum
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
1-eps-converted-to.pdf
1.eps
2-eps-converted-to.pdf
2.eps
3-eps-converted-to.pdf
3.eps
4-eps-converted-to.pdf
4.eps
4th_Order_All_States_Measured_Discrete.png
4th_Order_Live_Measured_Values.png
4th_Order_Live_State_Estimates.png
4th_Order_State_Esimates_Discrete.png
4th_Order_Step_Response_with_LQR_Control.png
4th_Order_Step_Response_with_Observer-Based_State-Feedback_Control.png
4th_Order_Step_Response_with_Precompensation_and_LQR_Control.png
4th_Order_UFIR_State_Estimates_Discrete.png
4th_Order_Voltage_Output.png
5-eps-converted-to.pdf
5.eps
6-eps-converted-to.pdf
6.eps
6th_Order_All_States_Measured_Discrete.png
6th_Order_Live_Measured_Values.png
6th_Order_Live_State_Estimates.png
6th_Order_State_Esimates_Discrete.png
6th_Order_Step_Response_with_LQR_Control.png
6th_Order_Step_Response_with_Observer-Based_State-Feedback_Control.png
6th_Order_Step_Response_with_Precompensation_and_LQR_Control.png
6th_Order_UFIR_State_Estimates_Discrete.png
6th_Order_Voltage_Output.png
6thorder_equations.txt
6thorder_equations_both.txt
7-eps-converted-to.pdf
7.eps
8thOrder.png
Block Diagram of Controlled Pendulum.png
Cart FBD.jpg
Correct4thOrder_estimated.png
Correct4thOrder_measured.png
ENGR454_pendulum4th.m
Inverted Pendulum Diagram.jpg
Pendulum FBD.jpg
Pendulum KD.jpg
Pendulum_project_report.pdf
Pendulum_project_report.tex
README.md
System4thOrder.png
System6thOrder.png
System8thOrder.png
blockd.png
ctrlbox.m
mcode.sty
observer_blockd.png
parameters.m
pendulum.m
pendulum_6th.m
pendulum_6th_run.m
pendulum_frohne.m
pendulum_run.m
pendulum_sixth_order.mw
pendulum_sixth_order_both.mw
pendulum_spring.m
pendulum_with_spring.mw
pendulum_with_spring.png
pendulum_with_spring.sage
pendulum_wrong.m
pendulum_wrong_run.m
pendulumfbd.png
rscale.m
spring_equations.txt
tcpdemo.m
ufir.m

README.md

Digital Control of Inverted Pendulum

Connecting to the Pendulum

This is using Walla Walla University's inverted pendulum up in the digital or analog labs in Kretschmar.

Connect to board

Plug into ethernet, set IPv4 settings:

IP: 169.254.0.2
Netmask: 255.255.255.0
Gateway: 169.254.0.2

Set the ethernet MAC address to be (Identity --> Cloned Address):

00:13:F7:1A:79:FA

Check "Use this connection only for resources on its network"

Reset the board. Then connect to this with NetworkManager if you're using it.

Install Octave libraries

On Arch Linux, you can install from the AUR, e.g.:

spinach -i octave-control octave-sockets

or, in Octave, download the control and sockets packages and then install them:

pkg install control-3.0.0.tar.gz sockets-1.2.0.tar.gz

Testing Pendulum Connnection

There's a tcpdemo script that'll make the motor move back and forth and plot the data it received back over the network connection.

Pendulum Control

Run in simulation:

octave
>> pendulum            # 4th order, 30 V, correct rd
>> pendulum_6th        # 6th order, 30 V, correct rd
>> pendulum_wrong      # 4th order, 20 V, wrong rd (rd^2)
>> pendulum_spring     # 8th order, not observable or controllable

In these non-_run files, at the top is a plotAll variable that if set to true will generate all the plots. In the 6th order one, there's also a bothPendulums variable which if set to true will balance both pendulums rather than the long one up and the small one down.

Run on the pendulum:

octave
>> pendulum_run        # 4th order, 30 V, correct rd
>> pendulum_6th_run    # 6th order, 30 V, correct rd
>> pendulum_wrong_run  # 4th order, 20 V, wrong rd (rd^2)

In the _run files, there's a saveData variable which if set to true will save data while the system is running and then stop balancing the pendulum after a certain number of seconds (set by maxTime) and generate plots of the measurements and estimates.

Report

The report documenting the derivations and results is Pendulum_project_report.pdf.