CN110162068A - A kind of control method of self-balance robot - Google Patents
A kind of control method of self-balance robot Download PDFInfo
- Publication number
- CN110162068A CN110162068A CN201910352331.4A CN201910352331A CN110162068A CN 110162068 A CN110162068 A CN 110162068A CN 201910352331 A CN201910352331 A CN 201910352331A CN 110162068 A CN110162068 A CN 110162068A
- Authority
- CN
- China
- Prior art keywords
- self
- axis
- control
- module
- control method
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05D—SYSTEMS FOR CONTROLLING OR REGULATING NON-ELECTRIC VARIABLES
- G05D1/00—Control of position, course, altitude or attitude of land, water, air or space vehicles, e.g. using automatic pilots
- G05D1/08—Control of attitude, i.e. control of roll, pitch, or yaw
- G05D1/0891—Control of attitude, i.e. control of roll, pitch, or yaw specially adapted for land vehicles
Landscapes
- Engineering & Computer Science (AREA)
- Aviation & Aerospace Engineering (AREA)
- Radar, Positioning & Navigation (AREA)
- Remote Sensing (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Automation & Control Theory (AREA)
- Manipulator (AREA)
Abstract
本发明提供了一种自平衡机器人的控制方法,通过电源模块提供稳定的直流电源驱动模块,控制模块发出指令控制执行模块的直流电机按照程序编写的方式运行,并由编码器组成反馈回路;由姿态检测模块采集系统中各姿态角,并将传输到主控制器,组成控制回路,对电机进行控制。所述的姿态检测模块中传感器能直接读取四元数和加速度,精确得到倾角值和角速度值,使得自平衡机器人的稳定性更高,对外界环境进行自适应同时能最大程度降低外界环境对自平衡机器人的干扰,从而保证了其安全性和稳定性,另外,减少主控制器的算法压力,提高了数据传输的精确度,提高了系统的实时性。
The invention provides a control method for a self-balancing robot. A stable DC power drive module is provided through a power supply module, the control module sends an instruction to control the DC motor of the execution module to run according to the programming mode, and an encoder forms a feedback loop; The attitude detection module collects each attitude angle in the system and transmits it to the main controller to form a control loop to control the motor. The sensor in the attitude detection module can directly read the quaternion and acceleration, and accurately obtain the inclination value and angular velocity value, so that the stability of the self-balancing robot is higher, and the external environment can be adapted to the external environment. The interference of the self-balancing robot ensures its safety and stability. In addition, the algorithm pressure of the main controller is reduced, the accuracy of data transmission is improved, and the real-time performance of the system is improved.
Description
技术领域technical field
本发明涉及自平衡机器人领域,具体而言,涉及一种自平衡机器人的控制方法。The invention relates to the field of self-balancing robots, in particular to a control method of a self-balancing robot.
背景技术Background technique
自平衡机器人是一种新型的小型交通工具,其模型类似于一级倒立摆,具有非线性和强耦合性等特点。它的结构特点是双轮共轴,左右平行布置,自平衡机器人是一个高度不稳定的系统,陀螺仪有很好的动态效果,但是由于陀螺仪存在温漂,静态时积分后得到的角度会产生很大的偏差;而对加速度计信号采用平滑滤波去噪,可以得到很好的静态角度,但在运动过程中容易受动态加速度干扰。因此,单独使用加速度计或陀螺仪都不能够得到有效而可靠的车体姿态信息,而且这种线性组合方式使得系统的稳定上无法兼顾,面对较大的干扰时,系统不稳定,因此,有必要研究一款稳定性高的自平衡机器人以实现自平衡机器人的平衡行走、准确行走、避障。Self-balancing robot is a new type of small vehicle. Its model is similar to a first-order inverted pendulum, which has the characteristics of nonlinearity and strong coupling. Its structural characteristics are that the two wheels are coaxial and the left and right are arranged in parallel. The self-balancing robot is a highly unstable system. The gyroscope has a good dynamic effect. However, due to the temperature drift of the gyroscope, the angle obtained after integration during static time will not A large deviation is generated; while smooth filtering and denoising are used for the accelerometer signal, a good static angle can be obtained, but it is easily disturbed by dynamic acceleration during the movement. Therefore, the use of accelerometer or gyroscope alone cannot obtain effective and reliable vehicle body attitude information, and this linear combination method makes it impossible to take into account the stability of the system. In the face of large interference, the system is unstable. Therefore, It is necessary to study a self-balancing robot with high stability to realize balanced walking, accurate walking and obstacle avoidance of the self-balancing robot.
一种自平衡机器人的控制方法,其实际应用中的亟待处理的实际问题还有很多未提出具体的解决方案。A control method of a self-balancing robot, there are still many practical problems to be solved in its practical application, and no specific solutions have been proposed.
发明内容SUMMARY OF THE INVENTION
本发明的目的在于提出了一种自平衡机器人的控制方法以解决所述问题。The purpose of the present invention is to propose a control method of a self-balancing robot to solve the problem.
为了实现上述目的,本发明采用如下技术方案:In order to achieve the above object, the present invention adopts the following technical solutions:
一种自平衡机器人的控制方法包括电气系统,所述的电气系统分为控制模块、姿态检测模块、无线通讯模块、执行模块、电源模块;其中电源模块为其它部分提供稳定的直流电源驱动模块,控制模块发出指令控制执行模块中的直流电机按照程序编写的方式运行,并由编码器组成反馈回路;系统运动时各方向姿态角的变化,均由姿态检测模块测量,并上传数据处理进行分析,同时数据反馈到主控制器,组成控制回路;A control method for a self-balancing robot includes an electrical system, wherein the electrical system is divided into a control module, an attitude detection module, a wireless communication module, an execution module, and a power supply module; wherein the power supply module provides a stable DC power drive module for other parts, The control module sends instructions to control the DC motor in the execution module to run according to the programming method, and the feedback loop is formed by the encoder; the change of the attitude angle in each direction when the system moves is measured by the attitude detection module, and the data is uploaded for analysis. At the same time, the data is fed back to the main controller to form a control loop;
所述的姿态检测模块采用传感器采集角速度和加速度信号,通过传感器的DMP直接读取四元数和加速度并将四元数直接转换为机器人倾角,通过控制模块输出施加在电机上的电压和转向,对电机进行控制。The attitude detection module adopts the sensor to collect the angular velocity and acceleration signals, directly reads the quaternion and acceleration through the DMP of the sensor, and directly converts the quaternion into the robot inclination, and outputs the voltage and steering applied on the motor through the control module, Control the motor.
可选地,所述的传感器为六轴惯性传感器。Optionally, the sensor is a six-axis inertial sensor.
可选地,所述的六轴惯性传感器包括三轴MEMS加速度计和三轴MEMS陀螺仪,还包含一个数字运动处理器DMP,能将三轴MEMS加速度计和三轴MEMS陀螺仪采集的数据进行融合,独立完成姿态解算。Optionally, the six-axis inertial sensor includes a three-axis MEMS accelerometer and a three-axis MEMS gyroscope, and also includes a digital motion processor DMP, which can process the data collected by the three-axis MEMS accelerometer and the three-axis MEMS gyroscope. Fusion, complete attitude calculation independently.
可选地,所述的六轴惯性传感器能与其它数字传感器连接扩展成九轴传感器,能够输出一个九轴的信号,建立完整的空间姿态信息。Optionally, the six-axis inertial sensor can be connected with other digital sensors to expand into a nine-axis sensor, which can output a nine-axis signal to establish complete spatial attitude information.
可选地,所述的三轴MEMS陀螺仪和所述的三轴MEMS加速度计分别采集x轴、y轴和z轴的电压值,然后通过ADC转换成数字信号,最后通过I2C总线传送到主控制芯片。Optionally, the three-axis MEMS gyroscope and the three-axis MEMS accelerometer collect the voltage values of the x-axis, the y-axis and the z-axis respectively, and then convert them into digital signals through the ADC, and finally transmit them to the host through the I2C bus. control chip.
可选地,所述的四元数转换为机器人倾角的公式为:Optionally, the formula for converting the quaternion into the inclination of the robot is:
其中,Pitch旋转角就是所需要求得的自平衡机器人的倾角。Among them, the Pitch rotation angle is the required inclination angle of the self-balancing robot.
可选地,通过无线通讯模块实现自平衡机器人与外部设备进行数据通讯。Optionally, data communication between the self-balancing robot and external equipment is implemented through a wireless communication module.
可选地,所述的控制模块包括核心控制器,所述的核心控制器为单片机嵌入式计算机系统。Optionally, the control module includes a core controller, and the core controller is a single-chip embedded computer system.
可选地,所述的控制模块中设定表达式,angle:平衡角度偏差;Gyro_y:y轴角速度;V:速度偏差;Vi:速度偏差积分;Gyro_z:z轴角速度,所述的表达式为:Optionally, an expression is set in the control module, angle: balance angle deviation; Gyro_y: y-axis angular velocity; V: velocity deviation; Vi: velocity deviation integral; Gyro_z: z-axis angular velocity, the expression is :
PWM=angle·Kp+Gyro_y·Kd+V·Kps+Vi·Kis+Gyro_z·Kpt。PWM=angle·Kp+Gyro_y·Kd+V·Kps+Vi·Kis+Gyro_z·Kpt.
可选地,所述的控制模块中采用临界比例法进行参数整定。Optionally, in the control module, a critical proportional method is used for parameter setting.
与现有技术相比,本发明所取得的有益技术效果是:Compared with the prior art, the beneficial technical effects achieved by the present invention are:
1、本发明的控制方法采用传感器采集加速度和加速度信号,通过传感器自带的DMP直接读取四元数和加速度,能精确得到倾角值和角速度值,使得自平衡机器人的稳定性更高,以实现自平衡机器人的平衡行走、准确行走、避障。1. The control method of the present invention adopts the sensor to collect acceleration and acceleration signals, and directly reads the quaternion and acceleration through the DMP that comes with the sensor. Realize the balanced walking, accurate walking and obstacle avoidance of the self-balancing robot.
2、本发明的控制方法能够对外界环境进行自适应同时能最大程度降低外界环境对自平衡机器人的干扰,从而保证了其安全性和稳定性。2. The control method of the present invention can self-adapt to the external environment and at the same time can reduce the interference of the external environment on the self-balancing robot to the greatest extent, thereby ensuring its safety and stability.
3、本发明的控制方法能减少主控制器的算法压力,提高了数据传输的精确度,提高了系统的实时性。3. The control method of the present invention can reduce the algorithm pressure of the main controller, improve the accuracy of data transmission, and improve the real-time performance of the system.
附图说明Description of drawings
从以下结合附图的描述可以进一步理解本发明。图中的部件不一定按比例绘制,而是将重点放在示出实施例的原理上。在不同的视图中,相同的附图标记指定对应的部分。The present invention can be further understood from the following description in conjunction with the accompanying drawings. The components in the figures are not necessarily to scale, emphasis instead being placed upon illustrating the principles of the embodiments. Like reference numerals designate corresponding parts throughout the different views.
图1是本发明实施例之一中一种自平衡机器人的控制方法的总系统图;1 is a general system diagram of a control method of a self-balancing robot in one of the embodiments of the present invention;
图2是本发明实施例之一中一种自平衡机器人的控制方法的控制模块流程图。FIG. 2 is a flow chart of a control module of a control method for a self-balancing robot in one embodiment of the present invention.
图3是本发明实施例之一中一种自平衡机器人的控制方法的临界比例法进行参数整定的系统图。FIG. 3 is a system diagram of parameter setting by the critical proportional method of a control method of a self-balancing robot in one embodiment of the present invention.
具体实施方式Detailed ways
为了使得本发明的目的、技术方案及优点更加清楚明白,以下结合其实施例,对本发明进行进一步详细说明;应当理解,此处所描述的具体实施例仅用于解释本发明,并不用于限定本发明。对于本领域技术人员而言,在查阅以下详细描述之后,本实施例的其它系统、方法和/或特征将变得显而易见。旨在所有此类附加的系统、方法、特征和优点都包括在本说明书内、包括在本发明的范围内,并且受所附权利要求书的保护。在以下详细描述描述了所公开的实施例的另外的特征,并且这些特征根据以下将详细描述将是显而易见的。In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be described in further detail below in conjunction with its embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention, not to limit the present invention. invention. Other systems, methods and/or features of the present embodiments will become apparent to those skilled in the art upon review of the following detailed description. It is intended that all such additional systems, methods, features and advantages be included within this description, be within the scope of the invention, and be protected by the accompanying claims. Additional features of the disclosed embodiments are described in the following detailed description and will be apparent from the following detailed description.
本发明实施例的附图中相同或相似的标号对应相同或相似的部件;在本发明的描述中,需要理解的是,若有术语“上”、“下”、“左”、The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar components; in the description of the present invention, it should be understood that if there are terms “upper”, “lower”, “left”,
“右”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或组件必须具有特定的方位、以特定的方位构造和操作,因此附图中描述位置关系的用语仅用于示例性说明,不能理解为对本专利的限制,对于本领域的普通技术人员而言,可以根据具体情况理解上述术语的具体含义。The orientation or positional relationship indicated by "right" and the like is based on the orientation or positional relationship shown in the accompanying drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the indicated device or component must have a specific orientation, It is constructed and operated in a specific orientation, so the terms describing the positional relationship in the accompanying drawings are only used for exemplary illustration, and should not be construed as a limitation on this patent. specific meaning.
本发明为一种自平衡机器人的控制方法,根据图1-3所示讲述以下实施例:The present invention is a control method of a self-balancing robot, and the following embodiments are described according to FIGS. 1-3:
实施例一:Example 1:
一种自平衡机器人的控制方法包括电气系统,所述的电气系统分为控制模块、姿态检测模块、无线通讯模块、执行模块、电源模块;其中电源模块为其它部分提供稳定的直流电源驱动模块,控制模块发出指令控制执行模块中的直流电机按照程序编写的方式运行,并由编码器组成反馈回路;系统运动时各方向姿态角的变化,均由姿态检测模块测量,并上传数据处理进行分析,同时数据反馈到主控制器,组成控制回路;A control method for a self-balancing robot includes an electrical system, wherein the electrical system is divided into a control module, an attitude detection module, a wireless communication module, an execution module, and a power supply module; wherein the power supply module provides a stable DC power drive module for other parts, The control module sends instructions to control the DC motor in the execution module to run according to the programming method, and the feedback loop is formed by the encoder; the change of the attitude angle in each direction when the system moves is measured by the attitude detection module, and the data is uploaded for analysis. At the same time, the data is fed back to the main controller to form a control loop;
所述的姿态检测模块采用传感器采集角速度和加速度信号,通过传感器的DMP直接读取四元数和加速度并将四元数直接转换为机器人倾角,通过控制模块输出施加在电机上的电压和转向,对电机进行控制。The attitude detection module adopts the sensor to collect the angular velocity and acceleration signals, directly reads the quaternion and acceleration through the DMP of the sensor, and directly converts the quaternion into the robot inclination, and outputs the voltage and steering applied on the motor through the control module, Control the motor.
其中,所述的传感器为六轴惯性传感器;所述的六轴惯性传感器包括三轴MEMS加速度计和三轴MEMS陀螺仪,还包含一个数字运动处理器DMP,能将三轴MEMS加速度计和三轴MEMS陀螺仪采集的数据进行融合,独立完成姿态解算;所述的六轴惯性传感器能与其它数字传感器连接扩展成九轴传感器,能够输出一个九轴的信号,建立完整的空间姿态信息;所述的三轴MEMS陀螺仪和所述的三轴MEMS加速度计分别采集x轴、y轴和z轴的电压值,然后通过ADC转换成数字信号,最后通过I2C总线传送到主控制芯片;所述的四元数转换为机器人倾角的公式为:Wherein, the sensor is a six-axis inertial sensor; the six-axis inertial sensor includes a three-axis MEMS accelerometer and a three-axis MEMS gyroscope, and also includes a digital motion processor DMP, which can combine the three-axis MEMS accelerometer and the three-axis MEMS accelerometer with the three-axis MEMS gyroscope. The data collected by the axis MEMS gyroscope is fused to complete the attitude calculation independently; the six-axis inertial sensor can be connected with other digital sensors to expand into a nine-axis sensor, which can output a nine-axis signal to establish complete spatial attitude information; The three-axis MEMS gyroscope and the three-axis MEMS accelerometer collect the voltage values of the x-axis, the y-axis and the z-axis respectively, and then convert them into digital signals through the ADC, and finally transmit them to the main control chip through the I2C bus; The formula for converting the above-mentioned quaternion to the inclination of the robot is:
Pitch旋转角就是所需要求得的小车倾角;通过无线通讯模块实现自平衡机器人与外部设备进行数据通讯;所述的控制模块包括核心控制器,所述的核心控制器为单片机嵌入式计算机系统;所述的控制模块中设定表达式,angle:平衡角度偏差;Gyro_y:y轴角速度;V:速度偏差;Vi:速度偏差积分;Gyro_z:z轴角速度,所述的表达式为:The pitch rotation angle is the required inclination angle of the car; the wireless communication module realizes data communication between the self-balancing robot and external equipment; the control module includes a core controller, and the core controller is a single-chip embedded computer system; An expression is set in the control module, angle: balance angle deviation; Gyro_y: y-axis angular velocity; V: velocity deviation; Vi: velocity deviation integral; Gyro_z: z-axis angular velocity, the expression is:
PWM=angle·Kp+Gyro_y·Kd+V·Kps+Vi·Kis+Gyro_z·Kpt;所述的控制模块中采用临界比例法进行参数整定。PWM=angle·Kp+Gyro_y·Kd+V·Kps+Vi·Kis+Gyro_z·Kpt; the critical proportional method is used for parameter setting in the control module.
实施例二:Embodiment 2:
参见图1,一种自平衡机器人的控制方法包括电气系统,所述的电气系统分为控制模块、姿态检测模块、无线通讯模块、执行模块、电源模块;其中电源模块为其它部分提供稳定的直流电源驱动模块,控制模块发出指令控制执行模块中的直流电机按照程序编写的方式运行,并由编码器组成反馈回路;系统运动时各方向姿态角的变化,均由姿态检测模块测量,并上传数据处理进行分析,同时数据反馈到主控制器,组成控制回路;通过无线通讯模块实现自平衡机器人与外部设备进行数据通讯。Referring to Fig. 1, a control method of a self-balancing robot includes an electrical system. The electrical system is divided into a control module, an attitude detection module, a wireless communication module, an execution module, and a power supply module; wherein the power supply module provides stable DC for other parts. The power drive module, the control module sends instructions to control the DC motor in the execution module to run according to the programming method, and the feedback loop is formed by the encoder; the change of the attitude angle in each direction when the system moves is measured by the attitude detection module, and upload the data Processing and analysis, and the data is fed back to the main controller to form a control loop; data communication between the self-balancing robot and external equipment is realized through the wireless communication module.
所述的姿态检测模块采用传感器采集角速度和加速度信号,通过传感器的DMP直接读取四元数和加速度并将四元数直接转换为机器人倾角,通过控制模块输出施加在电机上的电压和转向,对电机进行控制。The attitude detection module adopts the sensor to collect the angular velocity and acceleration signals, directly reads the quaternion and acceleration through the DMP of the sensor, and directly converts the quaternion into the robot inclination, and outputs the voltage and steering applied on the motor through the control module, Control the motor.
所述的传感器为六轴惯性传感器,其包括三轴MEMS加速度计和三轴MEMS陀螺仪,还包含一个数字运动处理器DMP,能将三轴MEMS加速度计和三轴MEMS陀螺仪采集的数据进行融合,独立完成姿态解算;且所述的六轴惯性传感器能与其它数字传感器连接扩展成九轴传感器,能够输出一个九轴的信号,建立完整的空间姿态信息。在芯片正常工作时,所述的三轴MEMS陀螺仪和所述的三轴MEMS加速度计分别采集x轴、y轴和z轴的电压值,然后通过ADC转换成数字信号,最后通过I2C总线传送到主控制芯片,主控芯片通过采用400KHz的I2C的方式与其它设备通信,片内嵌有一个温度传感器、1024字节的FIFO和一个高精度振荡器,DMP数字运动处理引擎可将陀螺仪和加速度计的数据进行融合演算,直接输出四元数,STM32通过简单的计算就可以得到机器人的倾角,使得主控制器不用额外执行融合算法,有更多的时间去处理控制模块中的各种参数和电机调速,减轻了主控制的压力,提高了系统的实时性;所述的四元数转换为机器人倾角的公式为:The sensor is a six-axis inertial sensor, which includes a three-axis MEMS accelerometer and a three-axis MEMS gyroscope, as well as a digital motion processor DMP, which can process the data collected by the three-axis MEMS accelerometer and the three-axis MEMS gyroscope. Fusion, the attitude calculation is completed independently; and the six-axis inertial sensor can be connected with other digital sensors to expand into a nine-axis sensor, and can output a nine-axis signal to establish complete spatial attitude information. When the chip is working normally, the three-axis MEMS gyroscope and the three-axis MEMS accelerometer collect the voltage values of the x-axis, the y-axis and the z-axis respectively, and then convert them into digital signals through the ADC, and finally transmit them through the I2C bus. To the main control chip, the main control chip communicates with other devices by using 400KHz I2C. A temperature sensor, a 1024-byte FIFO and a high-precision oscillator are embedded in the chip. The DMP digital motion processing engine can convert the gyroscope and The data of the accelerometer is fused and calculated, and the quaternion is directly output. STM32 can obtain the inclination of the robot through simple calculation, so that the main controller does not need to perform the fusion algorithm additionally, and has more time to process various parameters in the control module and motor speed regulation, which reduces the pressure of the main control and improves the real-time performance of the system; the formula for converting the quaternion to the robot inclination is:
四元数就是形如ai+bj+ck+d的数,其中a、b、c、d是实数,i、j、k是虚数,a2+b2+c2+d2的平方根,称为四元数的模。定义:A quaternion is a number in the form of ai+bj+ck+d, where a, b, c, and d are real numbers, i, j, and k are imaginary numbers, and the square root of a2+b2+c2+d2 is called a quaternion 's model. definition:
q=[w x y z]T q=[wxyz] T
|q|2=w2+x2+y2+z2=1;|q| 2 =w 2 +x 2 +y 2 +z 2 =1;
通过旋转轴和绕该旋转轴的角度可以构造一个四元数:A quaternion can be constructed from an axis of rotation and an angle around that axis:
w=cos(α/2)w=cos(α/2)
x=sin(α/2)cos(Roll)x=sin(α/2)cos(Roll)
y=sin(α/2)cos(Pitch)y=sin(α/2)cos(Pitch)
z=sin(α/2)cos(Yaw)z=sin(α/2)cos(Yaw)
其中,α是绕旋转轴的角度;cos(Roll),cos(Pitch),cos(Yaw)为旋转轴在x、y、z方向的分量;Among them, α is the angle around the rotation axis; cos(Roll), cos(Pitch), cos(Yaw) are the components of the rotation axis in the x, y, and z directions;
四元数到倾角的转换:Quaternion to dip conversion:
其中,Pitch旋转角就是所需要求得的自平衡机器人的倾角。Among them, the Pitch rotation angle is the required inclination angle of the self-balancing robot.
参见图2,本发明采用MPU6050内部的数字运动处理器,须对MPU6050进行相关的初始化和设置,传输到初始化传感器模块中,通过控制模块进行一系列的程序操作,进行PWM输出或控制电机。Referring to Figure 2, the present invention adopts the digital motion processor inside the MPU6050, and the MPU6050 must be initialized and set up, transferred to the initialization sensor module, and a series of program operations are performed through the control module to perform PWM output or control the motor.
所述的控制模块包括核心控制器,所述的核心控制器为单片机嵌入式计算机系统。The control module includes a core controller, and the core controller is a single-chip embedded computer system.
参见图3,所述的控制模块中设定表达式,angle:平衡角度偏差;Gyro_y:y轴角速度;V:速度偏差;Vi:速度偏差积分;Gyro_z:z轴角速度,所述的表达式为:Referring to Fig. 3, the expression is set in the control module, angle: balance angle deviation; Gyro_y: y-axis angular velocity; V: velocity deviation; Vi: velocity deviation integral; Gyro_z: z-axis angular velocity, the expression is :
PWM=angle·Kp+Gyro_y·Kd+V·Kps+Vi·Kis+Gyro_z·Kpt。PWM=angle·Kp+Gyro_y·Kd+V·Kps+Vi·Kis+Gyro_z·Kpt.
所述的控制模块中采用临界比例法进行参数整定,整定步骤如下:In the control module, the critical proportional method is used for parameter tuning, and the tuning steps are as follows:
(1)控制模块中只加入比例控制环节,其他参数设为零,增加主控制器的比例增益参数P值,观察输出值,直到系统出现临界振荡,即可认为系统达到临界状态,最后确定比例增益参数P值为当前值的60%-70%;(1) Only the proportional control link is added to the control module, other parameters are set to zero, the proportional gain parameter P value of the main controller is increased, and the output value is observed until the system has a critical oscillation, and the system can be considered to reach a critical state, and the proportion is finally determined. The gain parameter P value is 60%-70% of the current value;
(2)确定比例增益参数P值后,取一个较大的Ti值,然后逐渐减小Ti值,直至系统出现振荡,反之,逐渐加大Ti值,直至系统振荡消失,最后确定参数Ti值为当前值的150%-180%;(2) After determining the proportional gain parameter P value, take a larger Ti value, and then gradually reduce the Ti value until the system oscillates. On the contrary, gradually increase the Ti value until the system oscillation disappears, and finally determine the parameter Ti value as 150%-180% of the current value;
(3)参数微分时间常数Td值的确定方法与比例增益参数P值方法相同,取不振荡时的30%。(3) The method for determining the value of the parameter differential time constant Td is the same as the method for the value of the proportional gain parameter P, which is 30% of the time when there is no oscillation.
另外,在系统输出不振荡时,尽量增大比例增益参数P值、减小积分时间常数Ti和增大微分时间常数Td。In addition, when the system output does not oscillate, try to increase the proportional gain parameter P value, decrease the integral time constant Ti and increase the differential time constant Td.
在该实施例中,对及其人进行闭环控制,通过控制模块计算后将结果输出到执行模块中。In this embodiment, closed-loop control is performed on the person and the control module, and the result is output to the execution module after calculation by the control module.
实施例三:Embodiment three:
一种自平衡机器人的控制方法包括电气系统,通过电源模块为其它部分提供稳定的直流电源驱动模块,控制模块发出指令控制执行模块中的直流电机按照程序编写的方式运行,前提要对个模块进行初始化操作,该步骤为整个自平衡机器人的初始化操作,包括主控制器的初始化、传感器初始化、执行模块的初始化、无线通信初始化、中断初始化操作,中断初始化能准确地控制嵌入式操作系统,实现一系列功能,无线通信模块初始化操作能为芯片之间的通信提供保障,传感器的初始化能更精准地检测到姿态信息;并由编码器组成反馈回路;系统运动时各方向姿态角的变化,均由姿态检测模块测量,并上传数据处理进行分析,同时数据反馈到主控制器,组成控制回路;执行模块初始化能对电机的参数进行初始化,尤其对执行模块中的编码器的初始值进行记录。A control method for a self-balancing robot includes an electrical system, providing a stable DC power drive module for other parts through a power module, and the control module sends out instructions to control the DC motor in the execution module to run according to the programming method. Initialization operation, this step is the initialization operation of the entire self-balancing robot, including the initialization of the main controller, sensor initialization, execution module initialization, wireless communication initialization, and interrupt initialization operations. Serial functions, the initialization operation of the wireless communication module can provide guarantee for the communication between the chips, the initialization of the sensor can detect the attitude information more accurately; and the feedback loop is formed by the encoder; the change of the attitude angle in each direction when the system moves is determined by The attitude detection module measures, uploads the data for analysis, and feeds back the data to the main controller to form a control loop; the execution module initialization can initialize the parameters of the motor, especially the initial value of the encoder in the execution module is recorded.
所述的姿态检测模块采用传感器采集角速度和加速度信号,通过传感器的DMP直接读取四元数和加速度并将四元数直接转换为机器人倾角,通过控制模块输出施加在电机上的电压和转向,对电机进行控制。由于一般姿态传感器无法直接应用于自平衡控制,需要根据实际传感器的选择与系统情况进行滤波、拟合等计算,从而获得可控的姿态信息传递,减少了主控制器的算法压力。The attitude detection module adopts the sensor to collect the angular velocity and acceleration signals, directly reads the quaternion and acceleration through the DMP of the sensor, and directly converts the quaternion into the robot inclination, and outputs the voltage and steering applied on the motor through the control module, Control the motor. Since general attitude sensors cannot be directly applied to self-balancing control, it is necessary to perform calculations such as filtering and fitting according to the actual sensor selection and system conditions, so as to obtain controllable attitude information transmission and reduce the algorithm pressure of the main controller.
在具体的实施例中,所述的传感器为六轴惯性传感器;所述的六轴惯性传感器包括三轴MEMS加速度计和三轴MEMS陀螺仪,还包含一个数字运动处理器DMP,能将三轴MEMS加速度计和三轴MEMS陀螺仪采集的数据进行融合,独立完成姿态解算;所述的六轴惯性传感器能与其它数字传感器连接扩展成九轴传感器,能够输出一个九轴的信号,建立完整的空间姿态信息;所述的三轴MEMS陀螺仪和所述的三轴MEMS加速度计分别采集x轴、y轴和z轴的电压值,然后通过ADC转换成数字信号,最后通过I2C总线传送到主控制芯片;六轴惯性传感器中的陀螺仪动态性能较好,加速度计静态性能较好,根据其特性,能设计设定值得到四元数。所述的四元数转换为机器人倾角的公式为:In a specific embodiment, the sensor is a six-axis inertial sensor; the six-axis inertial sensor includes a three-axis MEMS accelerometer and a three-axis MEMS gyroscope, and also includes a digital motion processor DMP, which can convert the three-axis The data collected by the MEMS accelerometer and the three-axis MEMS gyroscope are fused to independently complete the attitude calculation; the six-axis inertial sensor can be connected with other digital sensors to expand into a nine-axis sensor, which can output a nine-axis signal to establish a complete The three-axis MEMS gyroscope and the three-axis MEMS accelerometer collect the voltage values of the x-axis, y-axis and z-axis respectively, and then convert them into digital signals through ADC, and finally transmit them to the I2C bus. Main control chip; the dynamic performance of the gyroscope in the six-axis inertial sensor is better, and the static performance of the accelerometer is better. According to its characteristics, the set value can be designed to obtain the quaternion. The formula for converting the quaternion to the inclination of the robot is:
Pitch旋转角就是所需要求得的小车倾角;通过无线通讯模块实现自平衡机器人与外部设备进行数据通讯;所述的控制模块包括核心控制器,所述的核心控制器为单片机嵌入式计算机系统;The pitch rotation angle is the required inclination angle of the car; the wireless communication module realizes data communication between the self-balancing robot and external equipment; the control module includes a core controller, and the core controller is a single-chip embedded computer system;
在一优选的实施例中,自平衡机器人采用PID控制算法通过设计合理的PID控制参数来完成位置控制功能。PID控制由比例单元P、积分单元I和微分单元D组成。通过Kp,Ki和Kd三个参数的设定。PID控制器主要适用于基本线性和动态特性不随时间变化的系统,是一个在工业控制应用中常见的反馈回路部件。这个控制器把收集到的数据和一个参考值进行比较,然后把这个差别用于计算新的输入值,这个新的输入值的目的是可以让系统的数据达到或者保持在参考值。和其他简单的控制运算不同,PID控制器可以根据历史数据和差别的出现率来调整输入值,这样可以使系统更加准确,更加稳定。在该实施例中,采用临界比例法进行参数整定,整定步骤如下:In a preferred embodiment, the self-balancing robot uses a PID control algorithm to complete the position control function by designing reasonable PID control parameters. PID control consists of proportional unit P, integral unit I and differential unit D. Through the setting of three parameters Kp, Ki and Kd. The PID controller is mainly suitable for systems whose basic linear and dynamic characteristics do not change with time, and is a common feedback loop component in industrial control applications. The controller compares the collected data to a reference value, and then uses the difference to calculate a new input value that is intended to allow the system's data to reach or maintain the reference value. Different from other simple control operations, the PID controller can adjust the input value according to the historical data and the occurrence rate of the difference, which can make the system more accurate and stable. In this embodiment, the critical ratio method is used for parameter tuning, and the tuning steps are as follows:
(1)控制模块中只加入比例控制环节,其他参数设为零,增加主控制器的比例增益参数P值,观察输出值,直到系统出现临界振荡,即可认为系统达到临界状态,最后确定比例增益参数P值为当前值的60%-70%;(1) Only the proportional control link is added to the control module, other parameters are set to zero, the proportional gain parameter P value of the main controller is increased, and the output value is observed until the system has a critical oscillation, and the system can be considered to reach a critical state, and the proportion is finally determined. The gain parameter P value is 60%-70% of the current value;
(2)确定比例增益参数P值后,取一个较大的Ti值,然后逐渐减小Ti值,直至系统出现振荡,反之,逐渐加大Ti值,直至系统振荡消失,最后确定参数Ti值为当前值的150%-180%;(2) After determining the proportional gain parameter P value, take a larger Ti value, and then gradually reduce the Ti value until the system oscillates. On the contrary, gradually increase the Ti value until the system oscillation disappears, and finally determine the parameter Ti value as 150%-180% of the current value;
(3)参数微分时间常数Td值的确定方法与比例增益参数P值方法相同,取不振荡时的30%。(3) The method for determining the value of the parameter differential time constant Td is the same as the method for the value of the proportional gain parameter P, which is 30% of the time when there is no oscillation.
另外,在系统输出不振荡时,尽量增大比例增益参数P值、减小积分时间常数Ti和增大微分时间常数Td。In addition, when the system output does not oscillate, try to increase the proportional gain parameter P value, decrease the integral time constant Ti and increase the differential time constant Td.
将执行模块中的编码器所反应自平衡机器人的实时位置信息作为自平衡控制器的反馈量,通过位置迭代的方式得到自平衡控制的控制量,将控制量和反馈量的差作为闭环PID控制的输入量,计算后将结果输出到执行模块中。The real-time position information of the self-balancing robot reflected by the encoder in the execution module is used as the feedback quantity of the self-balancing controller, and the control quantity of the self-balancing control is obtained by position iteration, and the difference between the control quantity and the feedback quantity is used as the closed-loop PID control. The input quantity is calculated, and the result is output to the execution module.
其中,设定表达式,angle:平衡角度偏差;Gyro_y:y轴角速度;V:速度偏差;Vi:速度偏差积分;Gyro_z:z轴角速度,所述的表达式为:Among them, set the expression, angle: balance angle deviation; Gyro_y: y-axis angular velocity; V: velocity deviation; Vi: velocity deviation integral; Gyro_z: z-axis angular velocity, the expression is:
PWM=angle·Kp+Gyro_y·Kd+V·Kps+Vi·Kis+Gyro_z·Kpt;PWM=angle Kp+Gyro_y Kd+V Kps+Vi Kis+Gyro_z Kpt;
所述的执行模块包括电机、驱动轮、以及用于实时反馈自平衡机器人的位置信息的编码器。其中,电机连接驱动轮,编码器连接电机,编码器将电机旋转产生的角度变化转变成自身的码数变化,进而产生电信号的变化,电信号的变化作为自平衡机器人的位置信息反馈给所述自平衡位置控制器,且编码器具有较高精度,用于实时、精准地反馈自平衡机器人的位置信息,图1已经描绘了带有编码器如何与电机实现信息反馈;图2已经描绘了控制模块中PID控制算法与其它模块之间的信息反馈关系;图3已经描绘了具体的优化PID控制算法的具体参数整定步骤。The execution module includes a motor, a driving wheel, and an encoder for real-time feedback of the position information of the self-balancing robot. Among them, the motor is connected to the driving wheel, the encoder is connected to the motor, and the encoder converts the angle change generated by the rotation of the motor into its own code number change, which in turn generates the change of the electrical signal, which is used as the position information of the self-balancing robot. The self-balancing position controller is described above, and the encoder has high precision, which is used for real-time and accurate feedback of the position information of the self-balancing robot. Figure 1 has depicted how the encoder and the motor realize information feedback; Figure 2 has depicted The information feedback relationship between the PID control algorithm and other modules in the control module; Fig. 3 has described the specific parameter setting steps of the specific optimized PID control algorithm.
综合上,本发明的自平衡机器人的控制方法简便,能减轻主控制器的算法压力,得到更精准的倾角参数,使得自平衡机器人更加稳定与安全。To sum up, the control method of the self-balancing robot of the present invention is simple and convenient, can reduce the algorithm pressure of the main controller, obtain more accurate inclination parameters, and make the self-balancing robot more stable and safe.
虽然上面已经参考各种实施例描述了本发明,但是应当理解,在不脱离本发明的范围的情况下,可以进行许多改变和修改。也就是说上面讨论的方法,系统和设备是示例。各种配置可以适当地省略,替换或添加各种过程或组件。例如,在替代配置中,可以以与所描述的顺序不同的顺序执行方法,和/或可以添加,省略和/或组合各种部件。而且关于某些配置描述的特征可以以各种其他配置组合,如可以以类似的方式组合配置的不同方面和元素。此外,随着技术发展其中的元素可以更新,即许多元素是示例,并不限制本公开或权利要求的范围。While the invention has been described above with reference to various embodiments, it should be understood that many changes and modifications can be made without departing from the scope of the invention. That said, the methods, systems and apparatus discussed above are examples. Various configurations may omit, substitute or add various procedures or components as appropriate. For example, in alternative configurations, the methods may be performed in an order different from that described, and/or various components may be added, omitted, and/or combined. Also features described with respect to certain configurations may be combined in various other configurations, eg, different aspects and elements of the configurations may be combined in a similar manner. Furthermore, elements therein may be updated as technology develops, ie, many of the elements are examples and do not limit the scope of the disclosure or the claims.
在说明书中给出了具体细节以提供对包括实现的示例性配置的透彻理解。然而,可以在没有这些具体细节的情况下实践配置例如,已经示出了众所周知的电路,过程,算法,结构和技术而没有不必要的细节,以避免模糊配置。该描述仅提供示例配置,并且不限制权利要求的范围,适用性或配置。相反,前面对配置的描述将为本领域技术人员提供用于实现所描述的技术的使能描述。在不脱离本公开的精神或范围的情况下,可以对元件的功能和布置进行各种改变。Specific details are given in the description to provide a thorough understanding of example configurations, including implementations. However, configurations may be practiced without these specific details. For example, well-known circuits, procedures, algorithms, structures and techniques have been shown without unnecessary detail in order to avoid obscuring the configurations. This description provides example configurations only, and does not limit the scope, applicability, or configuration of the claims. Rather, the foregoing descriptions of configurations will provide those skilled in the art with an enabling description for implementing the described techniques. Various changes may be made in the function and arrangement of elements without departing from the spirit or scope of the disclosure.
综上,其旨在上述详细描述被认为是例示性的而非限制性的,并且应当理解,以下权利要求(包括所有等同物)旨在限定本发明的精神和范围。以上这些实施例应理解为仅用于说明本发明而不用于限制本发明的保护范围。在阅读了本发明的记载的内容之后,技术人员可以对本发明作各种改动或修改,这些等效变化和修饰同样落入本发明权利要求所限定的范围。In conclusion, it is intended that the foregoing detailed description be regarded as illustrative and not restrictive, and that it should be understood that the following claims, including all equivalents, are intended to define the spirit and scope of the invention. The above embodiments should be understood as only for illustrating the present invention and not for limiting the protection scope of the present invention. After reading the contents of the description of the present invention, the skilled person can make various changes or modifications to the present invention, and these equivalent changes and modifications also fall within the scope defined by the claims of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910352331.4A CN110162068A (en) | 2019-04-29 | 2019-04-29 | A kind of control method of self-balance robot |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910352331.4A CN110162068A (en) | 2019-04-29 | 2019-04-29 | A kind of control method of self-balance robot |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110162068A true CN110162068A (en) | 2019-08-23 |
Family
ID=67632979
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910352331.4A Pending CN110162068A (en) | 2019-04-29 | 2019-04-29 | A kind of control method of self-balance robot |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110162068A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112744308A (en) * | 2021-01-18 | 2021-05-04 | 北京博清科技有限公司 | Overturn-preventing wall-climbing robot and control method |
CN113911360A (en) * | 2021-11-13 | 2022-01-11 | 太原理工大学 | A single-channel unmanned detection flying robot |
CN114995392A (en) * | 2022-05-10 | 2022-09-02 | 重庆大学 | Self-adaptive steering speed regulation device for mobile robot |
CN115813332A (en) * | 2023-02-17 | 2023-03-21 | 成都信和创业科技有限责任公司 | Eye tracker detection device for simulating eyeball movement |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170106931A1 (en) * | 2015-10-15 | 2017-04-20 | Focus Designs Inc. | Self-balancing electric vehicle with strain-based controls |
CN107562063A (en) * | 2016-06-30 | 2018-01-09 | 沈阳新松机器人自动化股份有限公司 | A kind of self-balance robot attitude control method and system |
CN109108936A (en) * | 2018-10-24 | 2019-01-01 | 电子科技大学 | A kind of the self-balance robot control system and control method of Multiple Source Sensor data fusion |
CN109202883A (en) * | 2017-06-29 | 2019-01-15 | 沈阳新松机器人自动化股份有限公司 | A kind of position control method of self-balance robot |
CN109240305A (en) * | 2018-10-19 | 2019-01-18 | 广州大学华软软件学院 | Coaxial two wheels robot kinetic control system and method based on complementary filter |
-
2019
- 2019-04-29 CN CN201910352331.4A patent/CN110162068A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170106931A1 (en) * | 2015-10-15 | 2017-04-20 | Focus Designs Inc. | Self-balancing electric vehicle with strain-based controls |
CN107562063A (en) * | 2016-06-30 | 2018-01-09 | 沈阳新松机器人自动化股份有限公司 | A kind of self-balance robot attitude control method and system |
CN109202883A (en) * | 2017-06-29 | 2019-01-15 | 沈阳新松机器人自动化股份有限公司 | A kind of position control method of self-balance robot |
CN109240305A (en) * | 2018-10-19 | 2019-01-18 | 广州大学华软软件学院 | Coaxial two wheels robot kinetic control system and method based on complementary filter |
CN109108936A (en) * | 2018-10-24 | 2019-01-01 | 电子科技大学 | A kind of the self-balance robot control system and control method of Multiple Source Sensor data fusion |
Non-Patent Citations (5)
Title |
---|
CHEN GONGXING: "The research of chaotic attractor generation based on state machine", 《PROCEEDINGS 2013 INTERNATIONAL CONFERENCE ON MECHATRONIC SCIENCES, ELECTRIC ENGINEERING AND COMPUTER (MEC)》 * |
唐光荣: "《微型计算机应用技术(上)-数据采集与控制技术》", 31 August 2000 * |
张华: "《计算机控制技术》", 31 August 2017, 延边大学出版社 * |
温子祺: "《ARM Cortex-M4微控制器深度实战》", 31 January 2018 * |
陈公兴: "一种爬坡机器人设计与实现", 《科技与创新》 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112744308A (en) * | 2021-01-18 | 2021-05-04 | 北京博清科技有限公司 | Overturn-preventing wall-climbing robot and control method |
CN112744308B (en) * | 2021-01-18 | 2022-06-21 | 北京博清科技有限公司 | Overturn-preventing wall-climbing robot and control method |
CN113911360A (en) * | 2021-11-13 | 2022-01-11 | 太原理工大学 | A single-channel unmanned detection flying robot |
CN114995392A (en) * | 2022-05-10 | 2022-09-02 | 重庆大学 | Self-adaptive steering speed regulation device for mobile robot |
CN115813332A (en) * | 2023-02-17 | 2023-03-21 | 成都信和创业科技有限责任公司 | Eye tracker detection device for simulating eyeball movement |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110162068A (en) | A kind of control method of self-balance robot | |
CN105588567B (en) | A kind of attitude heading reference system and method for autoelectrinic compass calibration assist type | |
Xiong et al. | Path tracking of a four-wheel independently driven skid steer robotic vehicle through a cascaded NTSM-PID control method | |
CN104914874B (en) | A kind of pose control system for unmanned plane and method based on adaptive Mutually fusion | |
CN106444804A (en) | Complementary filtering algorithm and cascade PID based four-rotor aircraft design method | |
CN107247459B (en) | Anti-interference flight control method and device | |
CN102620719B (en) | Inclination sensor with high precision and temperature compensation and its dynamic compensation method | |
CN106994687B (en) | Installation posture calibration method of six-dimensional force sensor at the end of industrial robot | |
CN104182614A (en) | System and method for monitoring attitude of mechanical arm with six degrees of freedom | |
CN109108936A (en) | A kind of the self-balance robot control system and control method of Multiple Source Sensor data fusion | |
CN104772756A (en) | Mechanical arm based on inertial measurement units and control method thereof | |
CN105865453B (en) | A kind of navigation system and its fusion method of position sensor and attitude transducer | |
CN108759822B (en) | Mobile robot 3D positioning system | |
CN108731676A (en) | A kind of posture fusion enhancing measurement method and system based on inertial navigation technology | |
CN204128560U (en) | A kind of quadrotor inertial measurement system | |
CN114216456A (en) | An Attitude Measurement Method Based on Fusion of IMU and Robot Body Parameters | |
Xu et al. | A robust incremental-quaternion-based angle and axis estimation algorithm of a single-axis rotation using MARG sensors | |
CN115533915A (en) | Active contact detection control method for aerial work robot in uncertain environment | |
CN104682789A (en) | PID (Proportion Integration Differentiation) controller applied to two-wheeled robots | |
Díaz-Téllez et al. | ROS-based Controller for a Two-Wheeled Self-Balancing Robot | |
CN113848780B (en) | A high-mobility platform attitude calculation device and method under a multi-core heterogeneous processor architecture | |
CN109202883A (en) | A kind of position control method of self-balance robot | |
Lv et al. | Research and design of four rotor uav based on cascade pid | |
CN116429101A (en) | Track tracking control system and method based on inertial navigation | |
CN106292678B (en) | A kind of robot for space pedestal decoupling control method for object run |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190823 |
|
RJ01 | Rejection of invention patent application after publication |