自平衡小车程序.doc

  1. 1、本文档共18页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
自平衡小车程序

#include "DSP281x_Device.h" // Headerfile Include File #include "DSP281x_Examples.h" // #define HIST 16 unsigned int k=0; static float adc_current_samples[6][HIST];//定义行为6,列为16的二维数组 static float adclo=0.0; static Uint16 totsamples_0; unsigned int count; #define OCRMAX 1023 unsigned int pwm; static float left_cof=1.00; static float right_cof=1.00; struct gyro_filter pitch_filter; static Uint16 mode=0x00;//0x00----balance mode; 0x01-------assist mode static Uint16 still=0x00; //still=1.0, no move; still=0.0,move. static Uint16 stand=0x00; static Uint16 last_balance_s0; static Uint16 samples[6],ticks; static float left_steer_cof=0.05; static float right_steer_cof=0.05; static float steer_lim=0.13; static float initial_angle=0.0000874; static float hard_speed_lim=0.90; static float bus_current; static float cmd; static float lpf_angle; static float lpf_angrate; static float lpf_steer_knob; static float left_motor_pwm, right_motor_pwm, steer_cmd; static float left_motor_pwm, right_motor_pwm, steer_cmd; static float batt_voltage1, ay, ax, in_steer_knob; static float pitch_rate; static float interval; static float timer0_seconds_conv; static float p_gain; static float d_gain; static float p1_gain; static float d1_gain; static float p0_gain; static float d0_gain; static float tp0,td0,tp1,td1,tp,td; static float d_step=0.0001; static float p_step; static float cor_bat; static float p_cmd,d_cmd;//next_cmd; static float sample_conv = 1.0/1024.0/(float)HIST*5.0;//=3.052exp(-4) static float sample_conv1 = 1.0/1024.0/(float)HIST*2.07; static float sample_conv2 = 1.0/1024.0/(float)HIST*1.9; static float sample_conv3 = 1.0/1024.0/(float)HIST*333.3*2.5; interrupt void T2_AD_isr(void); void InitEv(void); void InitAdc(void); void InitGpio(void); struct gyro_filter { float angle; float ay_bias; //float ax_bias; float rate_bias; float steer_knob_bias; float rate; float steer_knob; float curr_bias; float curr;

文档评论(0)

sd44055 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档