简易旋转倒立摆及控制装置的设计

2014-04-29 01:12徐泽远
安徽农业科学 2014年26期

徐泽远

摘要 [目的]设计并制作一套简易旋转倒立摆及其控制装置。[方法]采用9S12XE单片机作为简易旋转倒立摆及控制装置的监测和控制系统的核心,采用L298驱动直流电机作为动力。通过编码器及最优控制策略LQR在平衡点附近给出系统的线性化模型,对系统的稳定性、能控性进行调试。[结果]应用Lagrange方程对试验采用的单级旋转倒立摆系统进行建模,获得了旋臂长度(r)、水平和竖直方向的角位移(Q)、摆杆质心与铰链距离(L)4者的最佳平衡点与动态方程;优化LQR控制器获得最优状态反馈增益矩阵;进行计算机编程,应用9s12XE单片机控制,并执行试验;结果表明旋转臂的转动频率趋近于摆杆的转周期则摆杆能到达正负155度以上,能很快地完成设计要求的基本动作,并且能迅速进入PID控制器调控范围,完成坚立状态。[结论]经误差分析表明该装置的稳定性良好,误差范围可控制在正负15度之内;调试结果证明,已实现了倒立摆的平衡控制。

关键词 旋转倒立摆;角度编码器;最优控制策略LQR

中图分类号 S220.2 文献标识码

A 文章编号 0517-6611(2014)26-09216-02

Design of Simple Rotary Inverted Pendulum and Control Device

XU Ze-yuan (College of Mechanical and Electrical Engineering, Northeast Forestry University, Harbin, Heilongjiang 150040)

Abstract [Objective] To design a simple rotary inverted pendulum and control device. [Method] The system uses 9S12XE micro-controller as a core monitoring and controlling system of simple rotary inverted pendulum and control device, using L298 drive DC motors. By the encoder and LQR optimal control strategy given linearized model of the system in the vicinity of the equilibrium point, the systems stability, controllability are debugged to achieve a balanced inverted pendulum control. [Result] Using Lagrange equation, the adopted rotary inverted pendulum was modeled, the optimal balance point and dynamic equation of the length of the rotary arm(r), angular displacement of level and vertical direction(Q), the pendulum mass and hinge distance [L] were obtained; LQR was optimized to obtain the best state; 9512XE single chip microcomputer control was applied to carry out the test. The results showed that pendulum rod can up to above negative 155 angel when the rotation cycle frequency approaches the pendulum rod rotating arm and rapidly complete the basic design requirements. [Conclusion] Through error analysis, it was found that the device has good stability, error range could be controlled within positive and negative 15 angle; the results proved the balance control of inverted pendulum.

Key words Rotary inverted pendulum; Angle encoder; LQR optimal control strategy

1 設计目的

设计并制作一套简易旋转倒立摆及其控制装置(图1)。该装置必须满足下例条件:①摆杆从处于自然下垂状态开始,驱动电机带动旋转臂作往复旋转使摆杆摆动,并尽快达到或超过正负60度;②直至完成圆周运动;③外力将摆杆由自然下垂状态拉起至165度位置,外力撤除同时,启动控制旋转臂使摆杆保持倒立状态时间不少于5s;期间旋转臂的转动角度不大于90度。

2 方案

根据项目要求,设计的系统模块组成为电机模块、传感器模块(作为输入),微控制器模块MCU(作为处理中心),电机驱动模块(作为输出)。

2.1 电机模块 采用直流电机。直流电机是依靠直流电驱动的,在小型电器上应用广泛。直流电机可实现平滑调速。

2.2 传感器模块 绝对值型旋转编码器是一种速度位移传感器,是模拟电压量输出,需采用AD直接采样,旋转编码器的模拟输出电压经ADC转换后,输出二进制编码给单片机,单片机据此作出分析与下一步控制。

3 理论分析与计算

3.1 系统数学模型的建立

对旋转倒立摆系统建立数学模型,并对试验采用的单级旋转倒立摆系统的数学模型进行分析(图2)。由图2可知,在忽略各种阻力和摩擦的条件下,旋臂和摆杆可以抽象为2个匀质杆,其中旋臂长度为r,相对其水平方向零位的角位移为θ;摆杆质心与铰链距离为L,相对其竖直方向零位的角位移为α。

软件和硬件系统具备良好的稳定性,能满足基础部分的要求。

参考文献

[1]段旭东,许可.单级旋转倒立摆的建模与控制仿真[J].机器人技术与应用,2002(5):43-46.

[2] 李保林,吕跃,袁浩.一级旋转倒立摆的模糊控制[J].实验室科学,2008(5):77-79.