描述
<div class="document">
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">注:* 为必填项</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong><span style="color: #0093e6;">请在报名阶段填写 ↓</span></strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">* 1、项目功能介绍</h3>
<hr class="horizontal-splitline normal-bold-2">
<p><strong>出于丰富业余生活,提高动手能力、创新能力,我们团队仿照两轮自平衡电动车的行进模式,<span>DIY</span>了一款<span>mini</span>平衡小车,小车以两个轮子驱动进行直立行走,通过手机<span>app</span>控制小车行进的速度及方向;</strong></p>
<p><strong>日常可以给小朋友拿到广场上当遥控玩具车,既为小孩的户外活动增添乐趣,</strong></p>
<p><strong>又能增加亲子互动的时光。</strong></p>
<p><span> </span></p>
<p><strong>经过三周的设计与制作,终于实现了平衡小车的平衡、遥控以及抬起行走方向的控制;</strong></p>
<p><strong>本项目的总结将分为三部分:流程控制、硬件设计和控制算法。</strong></p>
<p><strong>平衡小车是通过读取、计算传感器的数据来控制电机的转动,从而达到小车的动态平衡。</strong></p>
<p><strong>平衡小车的控制中用到了三级的<span>PID</span>算法,还是很有难度的,而对于小车的硬件结构来说,重心越低,越容易平衡,而重心越高平衡的难度就越大。</strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">*2、项目属性</h3>
<hr class="horizontal-splitline normal-bold-2">
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span style="color: #95a5a6; font-size: 14px;">未参加其他比赛</span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">* 3、开源协议</h3>
<hr class="horizontal-splitline normal-bold-2">
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span style="color: #95a5a6; font-size: 14px;">注:利他即利己,请认真阅读下述内容。</span></p>
<ol style="line-height: 1.8;">
<li class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt pap-hanging-indent-1.6em" style="line-height: 1.8;"><span style="color: #95a5a6; font-size: 14px;">拥抱开源,赋予项目无限价值。建议项目核心功能开源80%以上;</span></li>
<li class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt pap-hanging-indent-1.6em" style="line-height: 1.8;"><span style="color: #95a5a6; font-size: 14px;">若某一部分功能不可替代且删掉之后项目无法解决对应的问题,则这一部分实现的功能就是项目的核心功能;比如设计了一台电子负载且设计了一款上位机软件监控功率变化,则电子负载为核心功能,上位机软件为辅助功能;比如电子负载中使用了一款隔离485模块与上位机通信,则此485模块实现的通讯功能为辅助功能;</span></li>
<li class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt pap-hanging-indent-1.6em" style="line-height: 1.8;"><span style="color: #95a5a6; font-size: 14px;">项目应选择适合自己的<span style="text-decoration: underline;"><a href="/posts/98fdb2accd754af7b51990790db3b47a" target="_blank">开源协议</a></span>,若项目引用其他开源项目,应注明来源并遵循原作者的开源协议规定;原创项目推荐使用GPL3.0开源协议;</span></li>
<li class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt pap-hanging-indent-1.6em" style="line-height: 1.8;"><span style="color: #95a5a6; font-size: 14px;">直接引用开源项目的原电路或原代码实现的功能不可作为自己项目的核心功能、使用市场上通用模块直接实现的功能不可作为自己项目的核心功能。</span></li>
</ol>
<p style="line-height: 1.8;"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong><span style="color: #0093e6;">请在竞赛阶段填写 ↓</span></strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">*4、硬件部分</h3>
<hr class="horizontal-splitline normal-bold-2">
<h2><a target="_blank"></a>小车的硬件系统模块拓扑结构</h2>
<p><span> </span></p>
<p align="center"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span style="color: #95a5a6; font-size: 14px;">注:推荐使用<span style="text-decoration: underline;"><a href="https://lceda.cn/editor" target="_blank">立创EDA</a></span>。若选择其他EDA工具,请在附件上传PDF格式的原理图,PDF格式的PCB图纸,Gerber格式的PCB文件。这里可以详细说明您的项目实现原理和机制、注意事项、调试方法、测试方法等。推荐图文并茂的形式向别人介绍您的想法。</span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt pap-left-indent-1.6em" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">*5、软件部分</h3>
<hr class="horizontal-splitline normal-bold-2">
<h1><a target="_blank"></a>流程控制</h1>
<p>首先是平衡小车的控制流程图,我把流程图分为如下五个部分:</p>
<p><strong><span>1. </span></strong><strong>主函数、</strong></p>
<p><strong><span>2. </span></strong><strong>中断控制函数、</strong></p>
<p><strong><span>3. </span></strong><strong>直立环、</strong></p>
<p><strong><span>4. </span></strong><strong>速度环、</strong></p>
<p><strong><span>5. </span></strong><strong>转向环。</strong></p>
<p><strong><span> </span></strong></p>
<p><span> </span></p>
<h2><a target="_blank"></a><span>1</span>、主函数</h2>
<p>在主函数中完成系统各部分的初始化,并且在循环中每<span>50ms</span>在<span>OLED</span>显示运行数据:</p>
<p align="center"><span> </span></p>
<h2><span><a target="_blank"></a>2</span>、中断控制函数</h2>
<p>由<span>MPU6050</span>的中断引脚触发的外部中断的中断函数是整个系统的控制函数,<span>MPU6050</span>每<span>5ms</span>触发一次中断,而我调节的周期为<span>10ms:</span></p>
<p align="center"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span> </span></p>
<p align="left"><span> </span></p>
<h2><span><a target="_blank"></a>3</span>、直立环</h2>
<p>这是平衡小车最重要的部分,对于小车来说立起来是最终要的,在我的<span>PID</span>分类下有一篇专门记录如何将小车立起来的博客,我在这个过程也是花费了大量的时间,经过长时间的调节参数终于使小车可以稳定直立。</p>
<p align="center"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span> </span></p>
<p align="left"><span> </span></p>
<h2><span><a target="_blank"></a>4</span>、速度环</h2>
<p>他的作用是使小车在平衡时趋向于原地静止,当然要想使小车完全不动的直立在原地是不可能的,通过速度环只能使小车尽可能的减少移动。</p>
<p><span> </span></p>
<p align="center"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span> </span></p>
<p align="left"><span> </span></p>
<h2><span><a target="_blank"></a>5</span>、转向环</h2>
<p>他可能是平衡小车中最不重要的一部分,但是想要使小车走直线或者可以通过遥控控制转向,转向环也是必不可少的,转向环通过编码器和加速度计的融合算法来使小车实现转向功能。</p>
<h1><a target="_blank"></a>控制算法</h1>
<h2><a target="_blank"></a><span>PID</span>控制</h2>
<p><span>PID</span>控制,就是对偏差进行比例、积分和微分的控制。</p>
<p><span>PID</span>由<span>3</span>个单元组成,分别是比例(<span>P</span>)单元、积分(<span>I</span>)单元、微分(<span>D</span>)单位。</p>
<p>工程中<span>P</span>必然存在,在<span>P</span>的基础上又有如<span>PD</span>控制器、<span>PI</span>控制器、<span>PID</span>控制器等。</p>
<p><span> </span></p>
<p>比例项:提高响应速度,减小静差。</p>
<p>积分项:消除稳态误差。只要有偏差,我就积分,有一丁点偏差,我也会积分。积积,就会非常大。直到你偏差变为<span>0.</span></p>
<p>微分项:减小震荡以及超调。</p>
<p><em><span>Pwm=Kp*e(k)+Ki*</span></em><em>∑<span>e(k)+Kd*[e(k)-e(k-1)]</span></em></p>
<p><em><span>Kp*e(k)</span></em></p>
<p><em><span>Ki*</span></em><em>∑<span>e(k)</span></em></p>
<p><em><span>Kd*[e(k)-e(k-1)]</span></em></p>
<p><em><span> </span></em></p>
<p><em><span>Ki=Kp*(1/Ti) *Ti</span></em></p>
<p><em><span>Kd=Kp*(1/T)*Td</span></em></p>
<p><span> </span></p>
<h2><a target="_blank"></a>位置<span>PID</span></h2>
<p><strong><em><span>1.</span></em></strong><strong><em>理论分析</em></strong></p>
<p>位置闭环控制就是根据编码器的脉冲累加测量电机的位置信息,并与目标值进行比较,得到控制偏差,</p>
<p>然后通过对偏差的比例、积分、微分进行控制,使偏差趋向于零的过程。</p>
<p><strong><em><span>2.</span></em></strong><strong><em>公式</em></strong></p>
<p><em><span>Pwm=Kp*e(k)+Ki*</span></em><em>∑<span>e(k)+Kd*[e(k)-e(k-1)]</span></em></p>
<p><strong><span>e(k)</span></strong>:本次偏差</p>
<p><strong><span>e(k-1)</span></strong>:上一次的偏差<span> </span></p>
<p><strong>∑<span>e(k)</span></strong>:<span>e(k)</span>以及之前的偏差的累积和<span>;</span>其中<span>k</span>为<span>1,2,,k;</span></p>
<p><strong><span>Pwm</span></strong>代表输出</p>
<p><strong><em><span>3.</span></em></strong><strong><em>结构框图</em></strong></p>
<p align="center"><img src="//image.lceda.cn/pullimage/gcnAUKG1tlmdK9I7Ba1HmZhxyFUlsmAKjiL05Zxn.png"></p>
<p><strong><em><span>4.C</span></em></strong><strong><em>语言实现</em></strong></p>
<p><span>int Position_PID (int Encoder , int Target)</span></p>
<p><span> { </span></p>
<p><span> static float Bias, Pwm, Integral_bias, Last_Bias;</span></p>
<p><span> Bias=Encoder-Target; //</span>计算偏差</p>
<p><span> Integral_bias+=Bias; //</span>求出偏差的积分<span> </span></p>
<p><span> Pwm=Position_KP*Bias+Position_KI*Integral_bias+Position_KD*(Bias-Last_Bias); //</span>位置式<span>PID</span>控制器 <span> </span></p>
<p><span> Last_Bias=Bias; //</span>保存上一次偏差</p>
<p><span> return Pwm; //</span>输出</p>
<p><span> }</span></p>
<h2><a target="_blank"></a>直立环</h2>
<p><strong><em><span>1.</span></em></strong><strong><em>理论</em></strong></p>
<p>小车往那边倒,车轮就往哪边开,既可以保持车子的平衡。</p>
<p align="center"><img src="//image.lceda.cn/pullimage/6rV3sVlUR8BUowSpJZr1UDNOlnSMxMRPB74UkjUe.png"></p>
<p><strong><em><span>2.</span></em></strong><strong><em>公式</em></strong></p>
<p><span>a=b1*</span>θ<span>+b2*</span>θ<strong>'</strong><span>; </span>——<span>> </span>比例微分控制【<span>PDout=Kp*Angle+Kd*( Angle-Angle_last)</span>】</p>
<p><strong><em><span>3.</span></em></strong><strong><em>结构框图</em></strong></p>
<p align="center"> </p>
<p><span> <img src="//image.lceda.cn/pullimage/CsqqULi6fv6mkVbkjRjaeWTcOeXatuVkHHrD2i09.png"></span></p>
<p>直立环:让小车角度趋近<span>0</span>;</p>
<p>速度环:让电机速度趋近<span>0</span>;</p>
<h2><a target="_blank"></a>速度环、串级<span>PID</span></h2>
<p align="center"> </p>
<p align="center"><img src="//image.lceda.cn/pullimage/LO0uyrXwT4r4xupmzfH9IVYlISpcVhMxqsHNAYzX.png"></p>
<p>速度环输入:<span>1.</span>给定速度。<span>2.</span>速度反馈。</p>
<p>输出:角度值(直立环的期望速度输入)</p>
<p><span> </span></p>
<p>直立环输入:<span>1.</span>给定角度(速度环输出)。<span>2.</span>角度反馈</p>
<p>输出:<span>PWM</span>(直接控制小车)</p>
<p><span> </span></p>
<p><span>Vertical_out=Kp1*</span><span>( real_Angle- expect_Angle)</span><span>+Kd*D</span><span>( real_Angle- expect_Angle) //</span>直立<span>PD</span>控制器</p>
<p><span>Velocity_out =Kp2*</span><span>(Encoder_ real- Encoder_ expect)</span><span>+Ki*S</span><span>(Encoder_ real- Encoder_ expect) //</span>速度<span>PI</span>控制器</p>
<p>(<span>NOTE</span>:(<span>1</span>)<span>Velocity_out = expect_Angle.</span>(<span>2</span>)<span>Kp1</span>:<span>Vertical_Kp.</span>(<span>3</span>)<span>Kp2</span>:<span>Velocity_Kp.</span>)</p>
<p><span> </span></p>
<p>直立环输出<span>=Kp1*</span>(真实角度<span>-</span>期望角度<span>+</span>机械中值)<span>+Kd*</span>角度偏差的微分<span> //</span>角度偏差<span>=</span>真实角度<span>-</span>期望角度</p>
<p>速度环输出<span>=Kp2*</span>(反馈编码器值<span>-</span>期望编码器值)<span>+Ki*</span>编码器偏差的积分<span> //</span>编码器偏差<span>=</span>反馈编码器值<span>-</span>期望编码器值</p>
<p>(<span>NOTE</span>:(<span>1</span>)速度环输出<span>=</span>直立环的期望角度。(<span>2</span>)<span>Kp1</span>:直立环<span>Kp</span>。(<span>3</span>)<span>Kp2</span>:速度环<span>Kp</span>。)</p>
<p><span> </span></p>
<h2><a target="_blank"></a>合并推导:</h2>
<p>直立环输出<span>Vertical_out</span><span>=</span><span>Kp1*</span><span>(</span>θ<span>_r</span><span>-</span>θ<span>_e</span><span>)+</span><span>Kd*</span><span> (</span>θ<span>_r-</span>θ<span>_e)</span><strong>'</strong></p>
<p>速度环输出<span>Velocity_out</span><span>=</span><span>Kp2*</span><span>(E_r- E_e)</span><span>+Ki*</span>Σ<span>(E_r- E_e)</span></p>
<p>因为:θ<span>_e</span><span> = Velocity_out</span></p>
<p>所以直立环输出<span>Vertical_out =</span></p>
<p><span>= Kp1*</span><span>{</span> θ<span>_r</span><span>-</span><span>[ Kp2*</span><span>(E_r- E_e)</span><span>+Ki*</span>Σ<span>(E_r- E_e)</span><span> ]</span><span>}</span><span>+</span><span>Kd*</span><span>(</span>θ<span>_r-</span>θ<span>_e)</span><strong>'</strong></p>
<p><span>=</span><span> Kp1*</span> θ<span>_r</span><span>-</span><span> Kp1* Kp2*</span><span>(E_r- E_e)</span><span>- </span><span>Kp1*Ki</span> <span>*</span>Σ<span>(E_r- E_e)</span><span> +</span><span>Kd*</span><span>(</span>θ<span>_r-</span>θ<span>_e)</span><strong>'</strong></p>
<p><span>=</span><span> Kp1*</span> θ<span>_r+</span><span> Kd*</span><span>(</span>θ<span>_r-</span>θ<span>_e)</span>'<strong><span>- </span></strong><span>Kp1* [Kp2*</span><span>(E_r- E_e)+ </span><span>Ki</span> <span>*</span>Σ<span>(E_r- E_e)</span><span>]</span></p>
<p><span>=Kp1*</span>真实角度<span>+</span><span> Kd*</span>角度偏差的微分<strong><span>-</span></strong><span>Kp1* [Kp2*</span>编码器偏差<span>- </span><span>Ki</span> <span>*</span>编码器偏差的积分<span>]</span></p>
<p><span> </span></p>
<p><span> </span></p>
<p><span> </span></p>
<p><span> </span></p>
<p>即:</p>
<p>串级输出<span>OUT=</span></p>
<p><span>Kp1</span><span>*</span> <span>real_Angle</span><span> +Kd</span><span>* </span><span>D</span><span>( real_Angle- expect_Angle)</span></p>
<p><strong>—</strong></p>
<p><span>Kp1</span><span>*[</span><span>Kp2</span><span>*(Encoder_ real- Encoder_ expect)+</span><span>Ki</span><span>*</span><span> S</span><span>(Encoder_ real- Encoder_ expect)] </span></p>
<p><span> </span></p>
<h2><a target="_blank"></a>纯比例控制</h2>
<p>单摆的加速度和单摆的倾角成正比</p>
<p>只存在大小与角度偏差成正比的回复力</p>
<p><span>a=b1*</span>θ<span>; </span>——<span>> </span>比例控制【<span>Pout=Kp*Angle</span>】</p>
<p><img src="//image.lceda.cn/pullimage/ATVURRRF72eEn1TV6HJYnEwaaTJQDFYwIJaVS0eG.png"></p>
<p><img src="//image.lceda.cn/pullimage/YwNGmHahVbYfOJlMHFlKY7I9PnKAXX7FmwtEMmC3.png"></p>
<p> </p>
<p><span> </span></p>
<h2><a target="_blank"></a>比例微分控制器</h2>
<p>大小与角度成正比、方向与角速度成正比的回复力</p>
<p>大小与角速度成正比、方向与回复力成反比的阻尼力</p>
<p><span>a=b1*</span>θ<span>+b2*</span>θ<strong>'</strong><span>; </span>——<span>></span>比例微分控制【<span>PDout=Kp*Angle+Kd*( Angle-Angle_last)</span>】</p>
<p><img src="//image.lceda.cn/pullimage/0FTMIPFsKgcj6UppN7KaOj0kHyVlfm6Wd7JZ0bsV.png"></p>
<p><span> </span></p>
<p>控制函数写在外部中断服务函数里面。</p>
<p><span>10ms</span>控制周期由<span>MPU6050</span>的<span>INT</span>引脚给定。</p>
<p>保证数据的采集和处理的同步性。</p>
<p><span> </span></p>
<p>《修正<span>control.c</span>的遗漏处》、</p>
<p>《速度环的反馈系统》、</p>
<p>《平衡小车硬件结构与组装》</p>
<p><span> </span></p>
<p><span> </span></p>
<h2><a target="_blank"></a>调参步骤:</h2>
<p><span>1. </span>确立机械中值。</p>
<p><span>2. </span>直立环(内环)—<span>Kp</span>极性、<span>Kp</span>大小。<span>Kd</span>极性、<span>Kd</span>大小。</p>
<p><span>3. </span>速度环(外环)——<span>Kp&Ki</span>极性、<span>Kp&Ki</span>大小。</p>
<p><span>4. </span>转向环——系数极性、系数大小。</p>
<p><span> </span></p>
<p><span> </span></p>
<p><strong>机械中值</strong><strong>:</strong>把平衡小车放在地面上,从前向后以及从后向前绕电机轴旋转平衡小车,两次的向另一边倒下的角度的中值,就是机械中值。</p>
<h3><a target="_blank"></a>直立环</h3>
<p><strong><span>Kp</span></strong><strong>极性:</strong></p>
<p>极性<strong>错误</strong>:小车往哪边倒,车轮就往反方向开,会使得小车加速倒下。</p>
<p>极性<strong>正确</strong>:小车往哪边倒,车轮就往哪边开,以保证小车有直立的趋势。</p>
<p><strong><span>Kp</span></strong><strong>大小:</strong></p>
<p><span>Kp</span>一直增加,直到出现大幅低频震荡。</p>
<p><strong><span>Kd</span></strong><strong>极性:</strong></p>
<p>极性<strong>错误</strong>:拿起小车绕电机轴旋转,车轮反向转动,无跟随。</p>
<p>极性<strong>正确</strong>:拿起小车绕电机轴旋转,车轮同向转动,有跟随。</p>
<p><strong><span>Kd</span></strong><strong>大小:</strong></p>
<p><span>Kd</span>一直增加,直到出现高频震荡。</p>
<p><span> </span></p>
<p>直立环调试完毕后,对所有确立的参数乘以<span>0.6</span>作为最终参数。</p>
<p>原因:之前得到的参数都是<span>Kp</span>、<span>Kd</span>最大值,根据工程经验平衡小车的理想参数为最大参数乘以<span>0.6</span>求得。</p>
<p>结果:乘以<span>0.6</span>后,小车的抖动消失,但同时直立效果也变差。待下面加入速度环就能得到更好的性能。</p>
<p><span> </span></p>
<h3><a target="_blank"></a>速度环</h3>
<p><strong>速度环参数调节前注意:</strong></p>
<p><strong>一、</strong></p>
<p>在调试【速度环参数极性】时:需要去掉(注释掉)【直立环运算】</p>
<p>在调试【速度环参数大小】时:再次引入(取消注释)【直立环运算】</p>
<p><strong>二、</strong></p>
<p>【转向环运算】始终是去掉(注释)的一个状态。若转向环已提前将参数调试好,则未注释也影响不大。</p>
<p><strong><span>Kp&Ki</span></strong><strong>:</strong></p>
<p>线性关系、<span>Ki=(1/200)*Kp</span>、仅调<span>Kp</span>即可。</p>
<p><strong><span>Kp&Ki</span></strong><strong>极性:</strong></p>
<p>极性<strong>错误</strong>:手动转动其中一个车轮,另一车轮会以同样速度反向旋转——典型负反馈。</p>
<p>极性<strong>正确</strong>:手动转动其中一个车轮,两个车伦会同向加速,直至电机最大速度——典型正反馈。</p>
<p><strong><span>Kp&Ki</span></strong><strong>大小:</strong></p>
<p>增加<span>Kp&Ki</span>,直至:小车保持平衡的同时,速度接近于零。且回位效果较好。</p>
<p><span> </span></p>
<h3><a target="_blank"></a>转向环</h3>
<p><strong><span>Kp</span></strong><strong>极性:</strong></p>
<p>极性<strong>错误</strong>:拿起小车,并将小车绕<span>Z</span>轴旋转,两车轮旋转的趋势与小车旋转趋势一致——典型正反馈。</p>
<p>极性<strong>正确</strong>:拿起小车,并将小车绕<span>Z</span>轴旋转,两车轮旋转的趋势与小车旋转趋势相反——典型负反馈。</p>
<p><strong><span>Kp</span></strong><strong>大小:</strong></p>
<p>加大<span>Kp</span>,直至走直线效果较好,且无剧烈抖动。</p>
<p><span> </span></p>
<p><span> </span></p>
<p><span> </span></p>
<p align="left"><span> </span></p>
<h1><a target="_blank"></a>源码结构</h1>
<p>基于<span>Keilv5.23</span>环境,组织源码结构如下:</p>
<p><img src="//image.lceda.cn/pullimage/H5UGpJydShjd4Dy1B0gLxhFBMQdTbf3X83fna3wc.png"></p>
<p><span> </span></p>
<p align="left"><strong><span> </span></strong></p>
<h1><a target="_blank"></a>编译环境</h1>
<p>基于<span>Keilv5.23</span>环境,具体工具链如下:</p>
<p><img src="//image.lceda.cn/pullimage/81iVmXfA9ZrIvAMlSm4lBBNSw5oYt69UADF2nIVw.png"></p>
<p><span> </span></p>
<p align="left"><strong><span> </span></strong></p>
<h1><a target="_blank"></a>编译及下载方法</h1>
<p>基于<span>Keilv5.23</span>环境,编译下载方式如下:</p>
<p><img src="//image.lceda.cn/pullimage/ldYBWPHesq3cSO1pOfpRf0X2PVscoJvSJxixY6uC.png"></p>
<p><span> </span></p>
<p align="center"> </p>
<p align="center"><span> </span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span> </span></p>
<p align="left"><span> </span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span style="color: #95a5a6; font-size: 14px;">注:若您的项目涉及软件开发,请在附件上传对应的工程源码。这里可以详细说明您的软件流程图、功能模块框图、相关算法的解释或科普、源码结构、编译环境的搭建和配置、源码编译方法、程序烧录方法等。推荐图文并茂的形式向别人介绍您的想法。</span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt pap-left-indent-1.6em" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">*6、BOM清单</h3>
<hr class="horizontal-splitline normal-bold-2">
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><img src="//image.lceda.cn/pullimage/Ger2buyly4R9fsRFperB9Z2B2SCOHzwpgLwEpd4G.png"></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><img src="//image.lceda.cn/pullimage/ZOqitx7zyHkXJeHiDT6SUqgIVZNTdaETs9nJxWk1.png"></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span style="color: #95a5a6; font-size: 14px;">注:项目涉及的BOM清单。这个位置请上传BOM的截图。清单详情请以PDF的格式上传到附件中。建议包括型号、品牌、名称、封装、采购渠道、用途等内容。具体内容和形式应以表达清楚项目构成为准。</span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">*7、大赛LOGO验证</h3>
<hr class="horizontal-splitline normal-bold-2">
<p style="line-height: 1.8;"><img src="//image.lceda.cn/pullimage/TSBrsrGtdPoapZRsrioYPEkuqUmaxblZhsqBlMac.png"></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span style="color: #95a5a6; font-size: 14px;">请上传包含大赛logo的项目图片,logo以丝印形式印刷在PCB上面。</span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span style="color: #95a5a6; font-size: 14px;">点击zip下载大赛logo标识! <span style="text-decoration: underline;"><a href="https://lceda.oss-cn-shenzhen.aliyuncs.com/diy/uploads/file/2019/05/29/0e4d93a463d7ceb5e7dc77d774b7a4ae.zip" target="_blank">(大赛标识).zip</a></span></span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">* 8、演示您的项目并录制成视频上传</h3>
<hr class="horizontal-splitline normal-bold-2">
<p style="line-height: 1.8;"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span style="color: #95a5a6; font-size: 14px;">视频要求:请横屏拍摄,分辨率不低于1280×720,格式Mp4/Mov,单个视频大小限100M内;</span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span style="color: #95a5a6; font-size: 14px;">视频标题:立创电赛:{项目名称}-{视频模块名称};如立创电赛:《自动驾驶》-团队介绍。</span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span style="font-size: 14px;">更多详情:<a href="/posts/06c94d90c2c447dfbd9ed7339ff4a5b1" target="_blank">https://diy.szlcsc.com/posts/06c94d90c2c447dfbd9ed7339ff4a5b1</a></span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
</div>
评论(1)