deploy: 185c703bc0
This commit is contained in:
1 parent
9cc2596f5f
commit
42624d163b
42 files changed
+1019
-269
No files matched your search
@@ -44,7 +44,7 @@
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="../other/getting_started.html">Getting started</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../gs/getting_started.html">Getting started</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../hardware/index.html">Hardware</a></li>
|
||||
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Software</a><ul class="current">
|
||||
<li class="toctree-l2"><a class="reference internal" href="sw_description.html">Software Description</a></li>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="../other/getting_started.html">Getting started</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../gs/getting_started.html">Getting started</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../hardware/index.html">Hardware</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Software</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="sw_description.html">Software Description</a></li>
|
||||
@@ -92,8 +92,6 @@
|
||||
<li class="toctree-l2"><a class="reference internal" href="sw_description.html#control-loop-digital-controller">Control Loop & Digital Controller</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="sw_description.html#startup-controller">Startup Controller</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="sw_description.html#pid-controller">PID Controller</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="sw_description.html#gain-scheduling">Gain Scheduling</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="sw_description.html#id2">Feed-forward</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="sw_description.html#back-emf-voltage-measurement">Back-EMF voltage measurement</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="../other/getting_started.html">Getting started</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../gs/getting_started.html">Getting started</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../hardware/index.html">Hardware</a></li>
|
||||
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Software</a><ul class="current">
|
||||
<li class="toctree-l2 current"><a class="current reference internal" href="#">Software Description</a><ul>
|
||||
@@ -53,8 +53,6 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="#control-loop-digital-controller">Control Loop & Digital Controller</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#startup-controller">Startup Controller</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#pid-controller">PID Controller</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#gain-scheduling">Gain Scheduling</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#id2">Feed-forward</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#back-emf-voltage-measurement">Back-EMF voltage measurement</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -188,20 +186,31 @@
|
||||
<p><span class="caption-text">Control Loop - Block diagram</span><a class="headerlink" href="#id5" title="Link to this image"></a></p>
|
||||
</figcaption>
|
||||
</figure>
|
||||
<p>The block diagram above shows the complete control loop. The actual digital controller block is explained below.</p>
|
||||
<p>The Speed Helper block effectively sets the setpoint of the controller according to the CV configured acceleration and deceleration rates and actual target speedstep.</p>
|
||||
<p>For feedback the back EMF voltage V_EMF is measured via voltage divider and ADC. V_EMF is proportional to the motor speed in RPM.</p>
|
||||
<p>TODO: rewrite this: While the central component is the PID controller, there is an additional block called <a class="reference external" href="https://en.wikipedia.org/wiki/Feed_forward_(control)">Feed-forward</a> that has an impact on the control output variable. The Feed-forward block adds an additional offset to the output depending on the setpoint; this is done to achieve better control. A more detailed explanation regarding Feed-forward can be found below. The speed helper block corresponds to the <code class="docutils literal notranslate"><span class="pre">speed_helper()</span></code> function, which delays changing the setpoint according to the configured deceleration/acceleration rates.</p>
|
||||
<p>The block diagram above shows the (simplified) control loop. The actual digital controller block is explained below.</p>
|
||||
<p>The <em>Speed Helper</em> block effectively sets the setpoint of the controller according to the CV configured acceleration and deceleration rates and actual target speedstep.</p>
|
||||
<p>For feedback the back EMF voltage <em>V_EMF</em> is measured via voltage divider and ADC. <em>V_EMF</em> is proportional to the motor speed.</p>
|
||||
<p>While the central component is the PID controller, there is an additional block called <a class="reference external" href="https://en.wikipedia.org/wiki/Feed_forward_(control)">Feed-forward</a> that has an impact on the control output variable. The Feed-forward block adds an additional offset to the output depending on the setpoint; this is done to achieve better control. A more detailed explanation regarding Feed-forward can be found below. The speed helper block corresponds to the <code class="docutils literal notranslate"><span class="pre">speed_helper()</span></code> function, which delays changing the setpoint according to the configured deceleration/acceleration rates.</p>
|
||||
<figure class="align-center" id="id6">
|
||||
<img alt="Block Diagram - Digital Controller" src="../../svg/sw/Block_Diagram_Digital_Controller.svg" />
|
||||
<img alt="Block Diagram - Digital Controller" src="../_images/Block_Diagram_Digital_Controller.svg" />
|
||||
<figcaption>
|
||||
<p><span class="caption-text">Digital Controller - Block diagram</span><a class="headerlink" href="#id6" title="Link to this image"></a></p>
|
||||
</figcaption>
|
||||
</figure>
|
||||
<p>The controller is divided into two parts, depending on whether the motor is stationary or in motion. The startup controller handles overcoming friction of the motor, and finding base PWM level for overcoming friction. The base PWM level is saved and added to the output of the PID controller which handles motor control when the motor is in motion.</p>
|
||||
<p>The controller is divided into two parts, depending on whether the motor is stationary or in motion.
|
||||
At all times either the startup controller or the PID controller is active.</p>
|
||||
<p>The startup controller handles overcoming friction of the motor, and finding a base PWM level for overcoming friction.
|
||||
The base PWM level is equivalent to a certain PWM duty cycle.
|
||||
The base level gets saved and added to the output of the PID controller which handles motor control when the motor is in motion.
|
||||
This means the actual output of the PID controller is the sum of the PID output and the base PWM level. This is referred to as the <a class="reference internal" href="#id2"><span class="std std-ref">feed forward</span></a> block.
|
||||
The benefit of doing this is that the PID controller does not have to work in the non linear friction region of the motor, improving control performance.</p>
|
||||
<section id="startup-controller">
|
||||
<h3>Startup Controller<a class="headerlink" href="#startup-controller" title="Link to this heading"></a></h3>
|
||||
<p>Used on startup, meaning when the motor is not moving. The startup controller sets a PWM duty cycle level of <span class="math notranslate nohighlight">\(\frac{2}{3} \cdot \text{base_pwm}\)</span> and then ramps up the duty cycle/PWM level until the motor starts moving. This is done in order to overcome the friction of the drive train and motor. <span class="math notranslate nohighlight">\(\text{base_pwm}\)</span> is the average value of the 16 previous startup PWM levels. When no previous startup PWM levels are saved the startup controller begins ramping up from 0. The actual value at which the motor started moving is used as a reference for the <a class="reference internal" href="#id2"><span class="std std-ref">feed forward</span></a> block.</p>
|
||||
<p>Used on startup, meaning when the motor is not moving. First the startup controller retrieves the last <cite>BASE_PWM_ARR_LEN</cite> base PWM levels.
|
||||
The base pwm levels are not retained on a power cycle. That means when there is no previous base PWM level saved, the startup controller will start ramping up from 0.
|
||||
When there is less than <cite>BASE_PWM_ARR_LEN</cite> base PWM levels saved, the startup controller will ramp up from the average of the saved base PWM levels.</p>
|
||||
<p>After the startup controller retrieved the average of the last base pwm levels <span class="math notranslate nohighlight">\(\bar{b}\)</span> it sets a PWM duty cycle level of <span class="math notranslate nohighlight">\(\frac{2}{3} \cdot \bar{b}\)</span> and then ramps up the duty cycle/PWM level until the motor starts moving.
|
||||
When no previous startup PWM levels are saved the startup controller begins ramping up from 0.
|
||||
The actual value at which the motor started moving is multiplied by <cite>K_FF</cite> and used as a reference for the <a class="reference internal" href="#id2"><span class="std std-ref">feed forward</span></a> block.</p>
|
||||
</section>
|
||||
<section id="pid-controller">
|
||||
<h3>PID Controller<a class="headerlink" href="#pid-controller" title="Link to this heading"></a></h3>
|
||||
@@ -237,9 +246,8 @@ d_n &= \frac{2 K_D \cdot \left(e_n - e_{n-1}\right) + \left(2 \tau - T_s\rig
|
||||
<li><p>The previously explained base PWM is added to the actual output as well, meaning the formula above only shows the actual PID control part without feed forward.</p></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section id="gain-scheduling">
|
||||
<h3>Gain Scheduling<a class="headerlink" href="#gain-scheduling" title="Link to this heading"></a></h3>
|
||||
<h4>Gain Scheduling<a class="headerlink" href="#gain-scheduling" title="Link to this heading"></a></h4>
|
||||
<figure class="align-center" id="id8">
|
||||
<img alt="Gain Scheduling figure" src="../_images/adaptive_kp.svg" />
|
||||
<figcaption>
|
||||
@@ -249,15 +257,11 @@ d_n &= \frac{2 K_D \cdot \left(e_n - e_{n-1}\right) + \left(2 \tau - T_s\rig
|
||||
<p>Another aspect to consider is the implementation of <a class="reference external" href="https://en.wikipedia.org/wiki/Gain_scheduling">gain scheduling</a>. K<sub>P</sub> is a function of the current setpoint. Often it is favorable to have a higher proportional gain K<sub>P</sub> for slow speeds, achieving better control results. The illustration above shows the default setting for K<sub>P</sub>. CV_54 & CV_55 are used to set K<sub>P</sub> @ x<sub>0</sub>, CV_56 & CV_57 for K<sub>P</sub> @ x<sub>1</sub>, and CV_58 & CV_59 for K<sub>P</sub> @ x<sub>2</sub>. Additionally, CV_60 is used to shift x<sub>1</sub> from the leftmost point (0% = 0/255) to the rightmost point (100% = 255/255).</p>
|
||||
</section>
|
||||
<section id="id2">
|
||||
<span id="id3"></span><h3>Feed-forward<a class="headerlink" href="#id2" title="Link to this heading"></a></h3>
|
||||
<figure class="align-center" id="id9">
|
||||
<img alt="Feed forward figure" src="../_images/feed_forward.svg" />
|
||||
<figcaption>
|
||||
<p><span class="caption-text">Feed-forward</span><a class="headerlink" href="#id9" title="Link to this image"></a></p>
|
||||
</figcaption>
|
||||
</figure>
|
||||
<p>TODO: Update this part:</p>
|
||||
<p>To achieve better control, <a class="reference external" href="https://en.wikipedia.org/wiki/Feed_forward_(control)">Feed-forward</a> is used. On startup, the decoder will check for a configuration regarding Feed-forward control. When no configuration is found, the decoder automatically runs a calibration to establish a base PWM level (y<sub>1</sub>) for both directions. The base PWM level (y<sub>1</sub>) will vary depending on load, motor, and voltage on the tracks and can be configured with CV_176 - CV_179. If the setpoint is greater than the threshold, y<sub>2</sub> is corrected automatically when i<sub>n</sub> reaches 0.5i<sub>min</sub> or 0.5i<sub>max</sub>. CV_47 can be used to set how sensitive this correction is.</p>
|
||||
<span id="id3"></span><h4>Feed-forward<a class="headerlink" href="#id2" title="Link to this heading"></a></h4>
|
||||
<p>As previously mentioned, to achieve better control, <a class="reference external" href="https://en.wikipedia.org/wiki/Feed_forward_(control)">Feed-forward</a> is used.
|
||||
In essence this means that the output of the PID controller is not only the sum of the proportional, integral, and derivative parts, but also the base PWM level.
|
||||
The base PWM level is set by the startup controller and is the PWM level at which the motor starts moving.</p>
|
||||
</section>
|
||||
</section>
|
||||
<section id="back-emf-voltage-measurement">
|
||||
<h3>Back-EMF voltage measurement<a class="headerlink" href="#back-emf-voltage-measurement" title="Link to this heading"></a></h3>
|
||||
|
||||
Reference in new issue
Block a user