⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 indirect_8hpp-source.html

📁 Bayes滤波器算法C++类说明文档,源码见Bayes滤波器算法
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Bayes++ Bayesian Filtering Classes: indirect.hpp Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.2 --><div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Compound&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Compound&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div><h1>indirect.hpp</h1><a href="indirect_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="preprocessor">#ifndef _BAYES_FILTER_INDIRECT</span>00002 <span class="preprocessor"></span><span class="preprocessor">#define _BAYES_FILTER_INDIRECT</span>00003 <span class="preprocessor"></span>00004 <span class="comment">/*</span>00005 <span class="comment"> * Bayes++ the Bayesian Filtering Library</span>00006 <span class="comment"> * Copyright (c) 2002 Michael Stevens</span>00007 <span class="comment"> * See accompanying Bayes++.htm for terms and conditions of use.</span>00008 <span class="comment"> *</span>00009 <span class="comment"> * $Header: /cvsroot/bayesclasses/Bayes++/BayesFilter/filters/indirect.hpp,v 1.6.2.1 2004/02/11 21:06:42 mistevens Exp $</span>00010 <span class="comment"> * $NoKeywords: $</span>00011 <span class="comment"> */</span>00012  00013 <span class="comment">/*</span>00014 <span class="comment"> * Indirect Filter Adaptor</span>00015 <span class="comment"> *  Hides the details of the indirect operation of the filter</span>00016 <span class="comment"> *  The error filter uses the same linear models as the direct filter,</span>00017 <span class="comment"> *  observation error computation (subtraction) is linear!</span>00018 <span class="comment"> */</span>00019 00020 <span class="comment">/* Filter namespace */</span>00021 <span class="keyword">namespace </span>Bayesian_filter00022 {00023 00024 00025 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Error_base&gt;<a name="l00026"></a><a class="code" href="classBayesian__filter_1_1Indirect__state__filter.html">00026</a> <span class="keyword">class </span><a class="code" href="classBayesian__filter_1_1Indirect__state__filter.html">Indirect_state_filter</a> : <span class="keyword">public</span> <a class="code" href="classBayesian__filter_1_1State__filter.html">State_filter</a> {00027 <span class="comment">/*</span>00028 <span class="comment"> * Indirect state filter</span>00029 <span class="comment"> *  Estimates state using an associated observation error filter</span>00030 <span class="comment"> */</span>00031 <span class="keyword">public</span>:<a name="l00032"></a><a class="code" href="classBayesian__filter_1_1Indirect__state__filter.html#a0">00032</a>     <a class="code" href="classBayesian__filter_1_1Indirect__state__filter.html#a0">Indirect_state_filter</a> (Error_base&amp; error_filter)00033         : <a class="code" href="classBayesian__filter_1_1State__filter.html">State_filter</a>(error_filter.<a class="code" href="classBayesian__filter_1_1State__filter.html#o0">x</a>.size()), direct(error_filter)00034     {   <span class="comment">// Construct and zero initial error filter</span>00035         direct.x.clear();00036     }00037 00038     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> P_model&gt;<a name="l00039"></a><a class="code" href="classBayesian__filter_1_1Indirect__state__filter.html#a1">00039</a>     <span class="keywordtype">void</span> <a class="code" href="classBayesian__filter_1_1Indirect__state__filter.html#a1">predict</a> (P_model&amp; f)00040     {00041         <a class="code" href="classBayesian__filter_1_1State__filter.html#o0">x</a> = f.f(<a class="code" href="classBayesian__filter_1_1State__filter.html#o0">x</a>);00042         direct.predict(f);              <span class="comment">// May be optimised for linear f as x = 0</span>00043     };00044 00045     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> O_model&gt;<a name="l00046"></a><a class="code" href="classBayesian__filter_1_1Indirect__state__filter.html#a2">00046</a>     <span class="keywordtype">void</span> <a class="code" href="classBayesian__filter_1_1Indirect__state__filter.html#a2">observe</a> (O_model&amp; h, <span class="keyword">const</span> FM::Vec&amp; z)00047     {00048                 <span class="comment">// Observe error (explict temporary)</span>00049         FM::Vec z_error(z.size());00050         z_error = h.h(<a class="code" href="classBayesian__filter_1_1State__filter.html#o0">x</a>);00051         z_error -= z;00052         direct.observe (h, z_error);00053                 <span class="comment">// Update State estimate with error</span>00054         <a class="code" href="classBayesian__filter_1_1State__filter.html#o0">x</a> -= direct.x;00055                 <span class="comment">// Reset the error</span>00056         direct.x.clear();00057     }00058 00059     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> O_model&gt;<a name="l00060"></a><a class="code" href="classBayesian__filter_1_1Indirect__state__filter.html#a3">00060</a>     <span class="keywordtype">void</span> <a class="code" href="classBayesian__filter_1_1Indirect__state__filter.html#a3">observe_error</a> (O_model&amp; h, <span class="keyword">const</span> FM::Vec&amp; z_error)00061     {00062         direct.observe (h, z_error);00063                 <span class="comment">// Update State estimate with error</span>00064         <a class="code" href="classBayesian__filter_1_1State__filter.html#o0">x</a> -= direct.x;00065                 <span class="comment">// Reset the error</span>00066         direct.x.clear();00067     }00068 <a name="l00069"></a><a class="code" href="classBayesian__filter_1_1Indirect__state__filter.html#a4">00069</a>     <span class="keywordtype">void</span> <a class="code" href="classBayesian__filter_1_1Indirect__state__filter.html#a4">update</a> ()00070     <span class="comment">/* Update filters state</span>00071 <span class="comment">         Updates x(k|k)</span>00072 <span class="comment">    */</span>00073     {}00074 00075 <span class="keyword">private</span>:00076     Error_base&amp; direct;00077 };00078 00079 00080 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Error_base&gt;<a name="l00081"></a><a class="code" href="classBayesian__filter_1_1Indirect__kalman__filter.html">00081</a> <span class="keyword">class </span><a class="code" href="classBayesian__filter_1_1Indirect__kalman__filter.html">Indirect_kalman_filter</a> : <span class="keyword">public</span> <a class="code" href="classBayesian__filter_1_1Kalman__state__filter.html">Kalman_state_filter</a> {00082 <span class="comment">/*</span>00083 <span class="comment"> * Indirect kalman filter</span>00084 <span class="comment"> *  Estimates state using an associated observation error filter</span>00085 <span class="comment"> */</span>00086 <span class="keyword">public</span>:<a name="l00087"></a><a class="code" href="classBayesian__filter_1_1Indirect__kalman__filter.html#a0">00087</a>     <a class="code" href="classBayesian__filter_1_1Indirect__kalman__filter.html#a0">Indirect_kalman_filter</a> (Error_base&amp; error_filter)00088         : <a class="code" href="classBayesian__filter_1_1Kalman__state__filter.html">Kalman_state_filter</a>(error_filter.<a class="code" href="classBayesian__filter_1_1State__filter.html#o0">x</a>.size()), direct(error_filter)00089     {   00090     }00091 <a name="l00092"></a><a class="code" href="classBayesian__filter_1_1Indirect__kalman__filter.html#a1">00092</a>     <span class="keywordtype">void</span> <a class="code" href="classBayesian__filter_1_1Indirect__kalman__filter.html#a1">init</a> ()00093     <span class="comment">/* Initialise from state and state covariance</span>00094 <span class="comment">    */</span>00095     {00096         direct.x.clear();               <span class="comment">// Zero initial error</span>00097         direct.X = <a class="code" href="classBayesian__filter_1_1Kalman__state__filter.html#o0">X</a>;00098         direct.init();00099     }00100 00101     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> P_model&gt;<a name="l00102"></a><a class="code" href="classBayesian__filter_1_1Indirect__kalman__filter.html#a2">00102</a>     <span class="keywordtype">void</span> <a class="code" href="classBayesian__filter_1_1Indirect__kalman__filter.html#a2">predict</a> (P_model&amp; f)00103     {00104         <a class="code" href="classBayesian__filter_1_1State__filter.html#o0">x</a> = f.f(<a class="code" href="classBayesian__filter_1_1State__filter.html#o0">x</a>);00105         direct.predict(f);              <span class="comment">// May be optimised for linear f as x = 0</span>00106     };00107 00108     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> O_model&gt;<a name="l00109"></a><a class="code" href="classBayesian__filter_1_1Indirect__kalman__filter.html#a3">00109</a>     <span class="keywordtype">void</span> <a class="code" href="classBayesian__filter_1_1Indirect__kalman__filter.html#a3">observe</a> (O_model&amp; h, <span class="keyword">const</span> FM::Vec&amp; z)00110     {00111                 <span class="comment">// Observe error (explict temporary)</span>00112         FM::Vec z_error(z.size());00113         z_error = h.h(<a class="code" href="classBayesian__filter_1_1State__filter.html#o0">x</a>);00114         z_error -= z;00115         direct.observe (h, z_error);00116         direct.update();00117                 <span class="comment">// Update State estimate with error</span>00118         <a class="code" href="classBayesian__filter_1_1State__filter.html#o0">x</a> -= direct.x;00119                 <span class="comment">// Reset the error</span>00120         direct.x.clear();00121         direct.init ();00122     }00123 00124     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> O_model&gt;<a name="l00125"></a><a class="code" href="classBayesian__filter_1_1Indirect__kalman__filter.html#a4">00125</a>     <span class="keywordtype">void</span> <a class="code" href="classBayesian__filter_1_1Indirect__kalman__filter.html#a4">observe_error</a> (O_model&amp; h, <span class="keyword">const</span> FM::Vec&amp; z_error)00126     {00127         direct.observe (h, z_error);00128                 <span class="comment">// Update State estimate with error</span>00129         <a class="code" href="classBayesian__filter_1_1State__filter.html#o0">x</a> -= direct.x;00130                 <span class="comment">// Reset the error</span>00131         direct.clear();00132     }00133 <a name="l00134"></a><a class="code" href="classBayesian__filter_1_1Indirect__kalman__filter.html#a5">00134</a>     <span class="keywordtype">void</span> <a class="code" href="classBayesian__filter_1_1Indirect__kalman__filter.html#a5">update</a> ()00135     <span class="comment">/* Update filters state</span>00136 <span class="comment">         Updates x(k|k)</span>00137 <span class="comment">    */</span>00138     {00139         direct.update();00140         <a class="code" href="classBayesian__filter_1_1Kalman__state__filter.html#o0">X</a> = direct.X;00141     }00142 00143 <span class="keyword">private</span>:00144     Error_base&amp; direct;00145 };00146 00147 00148 }<span class="comment">//namespace</span>00149 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Feb 16 11:20:39 2004 for Bayes++ Bayesian Filtering Classes by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 > </a>1.3.2 </small></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -