TheAlgorithms-C/d0/d43/structpid.html
2020-07-22 03:01:23 +00:00

150 lines
7.8 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C: pid Struct Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Algorithms_in_C
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Set of algorithms implemented in C.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('d0/d43/structpid.html','../../'); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#pub-attribs">Data Fields</a> </div>
<div class="headertitle">
<div class="title">pid Struct Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>PID Controller.
<a href="../../d0/d43/structpid.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:a5a7b54866748e12568f9b9599b31f8eb"><td class="memItemLeft" align="right" valign="top"><a id="a5a7b54866748e12568f9b9599b31f8eb"></a>
float&#160;</td><td class="memItemRight" valign="bottom"><b>kP</b></td></tr>
<tr class="separator:a5a7b54866748e12568f9b9599b31f8eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a65e8bc146e02bad2702a0286d37b81bc"><td class="memItemLeft" align="right" valign="top"><a id="a65e8bc146e02bad2702a0286d37b81bc"></a>
float&#160;</td><td class="memItemRight" valign="bottom"><b>kI</b></td></tr>
<tr class="separator:a65e8bc146e02bad2702a0286d37b81bc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6c721a7983511fb9f91777ae45481473"><td class="memItemLeft" align="right" valign="top"><a id="a6c721a7983511fb9f91777ae45481473"></a>
float&#160;</td><td class="memItemRight" valign="bottom"><b>kD</b></td></tr>
<tr class="separator:a6c721a7983511fb9f91777ae45481473"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad661092f21ab1e0e6aa35fbcfcf6f161"><td class="memItemLeft" align="right" valign="top"><a id="ad661092f21ab1e0e6aa35fbcfcf6f161"></a>
float&#160;</td><td class="memItemRight" valign="bottom"><b>lastError</b></td></tr>
<tr class="separator:ad661092f21ab1e0e6aa35fbcfcf6f161"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3c54185f7b4867281786eff640443a00"><td class="memItemLeft" align="right" valign="top"><a id="a3c54185f7b4867281786eff640443a00"></a>
float&#160;</td><td class="memItemRight" valign="bottom"><b>integral</b></td></tr>
<tr class="separator:a3c54185f7b4867281786eff640443a00"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>PID Controller. </p>
<p>The PID controller is a linear control algorithm that has three terms:</p><ul>
<li>Proportional: A simple scaling of the error value by a gain kP</li>
<li>Integral: Integration of the error value over time, then multipled by gain kI</li>
<li>Derivative: Rate of change of the error value over time, multiplied by gain kD</li>
</ul>
<p>Terms of the controller can be removed by setting their gain to 0, creating a PI (kD = 0) or PD (kI = 0) controller. Depending on the control problem at hand, some terms may not increase the performance of the system, or may have a negative effect.</p>
<p>For a more mathematical expanation of the PID Controller, see <a href="https://en.wikipedia.org/wiki/PID_controller">https://en.wikipedia.org/wiki/PID_controller</a></p>
<p>Limitations of this implementation:</p><ul>
<li>Since this implementation is just for demonstration, the pid_step function takes the dt as a parameter, and it can be provided by the user in <a class="el" href="../../dd/d93/client_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4" title="Driver code.">main()</a>. This allows deterministic experimentation with the algorithm, rather than using time(NULL) which would make the function non-deterministic.</li>
</ul>
<p>Inputs: e(t) - Current error at time t. For example, how far a servo is off the desired angle Output: u(t) - Controller output at time t. </p>
</div><hr/>The documentation for this struct was generated from the following file:<ul>
<li>misc/pid.c</li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="../../d0/d43/structpid.html">pid</a></li>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.18 </li>
</ul>
</div>
</body>
</html>