资 源 简 介
/***************************************************************自平衡程序修改时间:2013.12.8***************************************************************/#include "main.h"#define position_max 6000 //位置最大值int j=0;int position=0;int k=0;int i=0;int speed1=0;int speed=0;int acc_y=0;int acc_z=0;int gyr_x=0;int receive=0;int pwm=0;float G_X=0,A_X=0;float gyro_angle=0;float balan_angle=0;float balan_angle1=0;float G_X1=0,A_X1=0,G_X2=0,G_X3=0,GXERRO=0;float erro[3]; int pwmneed=0;int pwmturn=0;void adjust(void);void judge(){ pwm=PID_control(erro[0],G_X)+PID_control_2(speed,position); //pwm+=pwmneed; if(pwm>100) //pwm限幅 { pwm=100; } if(pwm<-100) { pwm=-100; }