自动控制原理 Automatic Control Fundamentals
Objective
Introduce the fundamentals of classical and modern control theories for undergraduates in College of Engineering. The graduate students in dynamics and control are welcome if their undergraduate trainning is not in control. The scope of this course covers stability and dynamic analysis, and synthesize control methods in frequency domain and time domain.Textbook
- Oppenheim A.V., Signal and System. (Prerequisite)
- Dorf R. C., Bishop R. H. Modern Control Systems, 11th edition.
- 胡寿松, 自动控制原理,西工大、北航、南航三校合编控制专业教材。
- 吴麒,自动控制原理,清华大学自动化系教材。
Grading policy
- Experiment and Report, 30%.
- Midterm, 30%.
- Final, 40%.
Syllabus
- Introduction. Reading: Chap 1. HWs: E1.2, E1.9, E1.10, P1.21, DP1.6
- Fourier & Laplace. Chap 2 (Read more references and develop insights of Fourier series, Fourier transform and Laplace transform).
- Chap 2 (omit the motor part, in Table 2.5 for example; omit the whole signal-flow graph part, i.e. Sec 2.7) HWs: (1) Go through Sec 2.9 by using MATLAB; (2) E2.5, E2.8, E2.21, E2.27, P2.43, CP2.6.
- State space and Laplace (I). Reading: Chaps 2-3 (omit all parts need signal-flow graph). HWs: (1) Go through Example 3.2 (omit signal-flow graph); (2) Go through Example 3.4; (3) Go through Sec 3.9 with MATLAB; (4) E3.19, P3.8.
- State space and Laplace (II). HW the same as above.
- Transfer function and modes. Finish reading chap 1-3.
- Feedback system characteristics. Reading: Chap 4. Self-test: E4.1-4.10. HWs: P4.2, P4.7, P4.12.
- Feedback system performance. Reading: Chap 5. Self-test: E5.1-5.2, E5.4, E5.5, E5.8-12, E5.17, E5.19.
- Feedback more and examples. Reading: Finish reading Chap 4-5 together. HWs: P5.5-P5.7, AP5.1, AP5.4.
- Stability. Reading: Chap 6. Self-test: E6.1-6.4, E6.7, E6.9-6-13, E6.22. HWs: P6.2, P6.10, P6.12, P6.17-6.18.
- Root locus. Rading: Chap 7. HW: Announced during the class.
- Frequency response. Reading: Chap 8. HW: E8.1, 8.5, 8.12-13, P8.6.
- Control applications I.
- Control applications II.
- Mock exam.
控制原理实验课-倒立摆
前置准备
- 下载并安装 Arduino IDE 1.8.16。
- 确保电脑已配置 Python 3(建议 3.8)。
- 下载 倒立摆控制代码包,解压放入同一文件夹下。安装 Python 所需依赖库:time,math,multiprocessing,matplotlib,pyqtgraph,serial,datetime。
课程安排
-
第一节课:硬件连接与传感器调试
- 讲解系统组件:Arduino、TB6612 驱动、电位计、编码器、倒立摆机构
图1:倒立摆系统结构 - 根据提供接线图完成连线
图2:倒立摆接线图示意 图3:电机接线图示意 - 烧录测试代码
A_0.cpp
,通过工具 → 串口监视器查看 A0 电位计值。 - 将
inverted_pendulum_v2_class_v4.py
以及full_state_controller_v2_class_v4.py
中竖直电位计值设定值更改为观测值(一般在 750–800)。
- 讲解系统组件:Arduino、TB6612 驱动、电位计、编码器、倒立摆机构
-
第二节课:PID 控制器设计
- 回顾讲解 PID 控制原理。
- 补写 Python 控制器代码,实现对竖直角的闭环控制。
- 调试参数,连好硬件,打开 IDE,双击 Arduino 复位键,在工具中选择正确的板子和端口(例如显示端口为 COM4),烧录 Arduino 代码。随后打开
full_state_controller_v2_class_v4.py
,更改通信部分端口为 COM4。给电机通电,将倒立摆扶到竖直位置,同时运行full_state_controller_v2_class_v4.py
,倒立摆开始运转。运行一轮后,单击 Arduino 上的复位键,可运行下一次,实现 30 秒稳定控制。 - 记录控制响应并分析控制器动态特性。
-
第三节课:全状态反馈控制器设计
- 讲解全状态反馈控制理论,参考 知乎专栏文章。
- 根据倒立摆参数,使用 MATLAB 计算 LQR 最优化增益。
- 完善
fullstate_controller_v2_class_v4.py
控制逻辑。 - 连好硬件,实现 30 秒稳定控制。启动方式同第二节课。
通信及 py 代码简介
-
UART 通信机制:使用 USB 实现 PC 与 Arduino 间的 UART 通信,采用握手机制确保同步。
- PC 端发送握手命令
self.ser.write(b"GO\n")
- Arduino 端接收 3 字节并检查
buf == "GO\n"
- PC 端发送握手命令
-
通信数据结构:
- PC → Arduino:3 字节控制指令 [方向 dir,占空比 pwm,标志位 17]
- Arduino → PC:10 字节状态数据 [电位计值、电位计变化率、编码器值、编码器变化率、符号标志]
-
Python 控制代码结构:
arduino_v2.py
:封装串口通信逻辑,负责握手、读写数据。inverted_pendulum_v2_class_v4.py
:处理 Arduino 返回的原始数据,并转换为物理状态。fullstate_controller_v2_class_v4.py
:主控制器程序,基于 LQR 实现全状态反馈。save_angle_values_v2.py
与save_actions.py
:将运行过程中记录的角度值(theta/alpha)与控制指令(PWM)存储为文本。
-
Arduino 固件
uart_inverted_pendulum.ino
:- 读取编码器和电位计数据。
- 计算角速度,响应上位机控制指令。
- 通过 UART 定时发送 10 字节状态数据。
实验考核
- 需提交电子报告(PDF),包括:
- 实验图片、Python 控制器代码截图、角度随时间变化曲线。
- 对 PID 与全状态反馈控制的比较分析。