2010-12-26 20:59:17 -04:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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" / >
< title > ArduPilot Libraries: /home/jgoppert/Projects/ap/libraries/AP_RangeFinder/RangeFinder.cpp Source File< / title >
< link href = "tabs.css" rel = "stylesheet" type = "text/css" / >
2010-12-26 23:23:35 -04:00
< link href = "search/search.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javaScript" src = "search/search.js" > < / script >
2010-12-26 20:59:17 -04:00
< link href = "doxygen.css" rel = "stylesheet" type = "text/css" / >
< / head >
2010-12-26 23:23:35 -04:00
< body onload = 'searchBox.OnSelectItem(0);' >
2010-12-26 20:59:17 -04:00
<!-- Generated by Doxygen 1.7.1 -->
< div class = "navigation" id = "top" >
< div class = "tabs" >
< ul class = "tablist" >
< li > < a href = "main.html" > < span > Main Page< / span > < / a > < / li >
< li > < a href = "namespaces.html" > < span > Namespaces< / span > < / a > < / li >
< li > < a href = "annotated.html" > < span > Classes< / span > < / a > < / li >
< li class = "current" > < a href = "files.html" > < span > Files< / span > < / a > < / li >
< / ul >
< / div >
< div class = "tabs2" >
< ul class = "tablist" >
< li > < a href = "files.html" > < span > File List< / span > < / a > < / li >
< li > < a href = "globals.html" > < span > File Members< / span > < / a > < / li >
< / ul >
< / div >
< div class = "header" >
< div class = "headertitle" >
< h1 > /home/jgoppert/Projects/ap/libraries/AP_RangeFinder/RangeFinder.cpp< / h1 > < / div >
< / div >
< div class = "contents" >
< a href = "_range_finder_8cpp.html" > Go to the documentation of this file.< / a > < div class = "fragment" > < pre class = "fragment" > < a name = "l00001" > < / a > 00001 < span class = "comment" > // -*- tab-width: 4; Mode: C++; c-basic-offset: 3; indent-tabs-mode: t -*-< / span >
< a name = "l00002" > < / a > 00002 < span class = "comment" > /*< / span >
< a name = "l00003" > < / a > 00003 < span class = "comment" > AP_RangeFinder.cpp - Arduino Library for Sharpe GP2Y0A02YK0F < / span >
< a name = "l00004" > < / a > 00004 < span class = "comment" > infrared proximity sensor< / span >
< a name = "l00005" > < / a > 00005 < span class = "comment" > Code by Jose Julio and Randy Mackay. DIYDrones.com< / span >
< a name = "l00006" > < / a > 00006 < span class = "comment" > < / span >
< a name = "l00007" > < / a > 00007 < span class = "comment" > This library is free software; you can redistribute it and/or< / span >
< a name = "l00008" > < / a > 00008 < span class = "comment" > modify it under the terms of the GNU Lesser General Public< / span >
< a name = "l00009" > < / a > 00009 < span class = "comment" > License as published by the Free Software Foundation; either< / span >
< a name = "l00010" > < / a > 00010 < span class = "comment" > version 2.1 of the License, or (at your option) any later version.< / span >
< a name = "l00011" > < / a > 00011 < span class = "comment" > < / span >
< a name = "l00012" > < / a > 00012 < span class = "comment" > This has the basic functions that all RangeFinders need implemented< / span >
< a name = "l00013" > < / a > 00013 < span class = "comment" > */< / span >
< a name = "l00014" > < / a > 00014
< a name = "l00015" > < / a > 00015 < span class = "comment" > // AVR LibC Includes< / span >
< a name = "l00016" > < / a > 00016 < span class = "preprocessor" > #include " WConstants.h" < / span >
< a name = "l00017" > < / a > 00017 < span class = "preprocessor" > #include " < a class = "code" href = "_range_finder_8h.html" > RangeFinder.h< / a > " < / span >
< a name = "l00018" > < / a > 00018
< a name = "l00019" > < / a > 00019 < span class = "comment" > // Public Methods //////////////////////////////////////////////////////////////< / span >
< a name = "l00020" > < / a > < a class = "code" href = "class_range_finder.html#a7d6aef1559f205bac93327078c58840a" > 00020< / a > < span class = "keywordtype" > void< / span > < a class = "code" href = "class_range_finder.html#a7d6aef1559f205bac93327078c58840a" > RangeFinder::set_orientation< / a > (< span class = "keywordtype" > int< / span > x, < span class = "keywordtype" > int< / span > y, < span class = "keywordtype" > int< / span > z)
< a name = "l00021" > < / a > 00021 {
< a name = "l00022" > < / a > 00022 < a class = "code" href = "class_range_finder.html#a8cb4faa15ec6ff0e3b36420d56affd22" > orientation_x< / a > = x;
< a name = "l00023" > < / a > 00023 < a class = "code" href = "class_range_finder.html#a6541be7eef7c55b9c20b0de4bf5f88a5" > orientation_y< / a > = y;
< a name = "l00024" > < / a > 00024 < a class = "code" href = "class_range_finder.html#a559d092b3e3c550b4352d7c0ad3b6e84" > orientation_z< / a > = z;
< a name = "l00025" > < / a > 00025 }
< a name = "l00026" > < / a > 00026
< a name = "l00027" > < / a > 00027 < span class = "comment" > // Protected Methods //////////////////////////////////////////////////////////< / span >
< a name = "l00028" > < / a > < a class = "code" href = "class_range_finder.html#a833cdd23c2de887860e50e0180601add" > 00028< / a > < span class = "keywordtype" > int< / span > < a class = "code" href = "class_range_finder.html#a833cdd23c2de887860e50e0180601add" > RangeFinder::filter< / a > (< span class = "keywordtype" > int< / span > latestValue)
< a name = "l00029" > < / a > 00029 {
< a name = "l00030" > < / a > 00030 < span class = "keywordtype" > int< / span > i;
< a name = "l00031" > < / a > 00031 < span class = "keywordtype" > int< / span > total = 0;
< a name = "l00032" > < / a > 00032 < a class = "code" href = "class_range_finder.html#ab23a1a69f5b96fd791491f845ad1bfdb" > _history_ptr< / a > = (< a class = "code" href = "class_range_finder.html#ab23a1a69f5b96fd791491f845ad1bfdb" > _history_ptr< / a > + 1) % < a class = "code" href = "_range_finder_8h.html#a1147ca7cf8e4c7fffd466f82bc899234" > AP_RANGEFINDER_NUM_AVERAGES< / a > ;
< a name = "l00033" > < / a > 00033 < a class = "code" href = "class_range_finder.html#a4f45693be996b3395f063a4624b853b4" > _history< / a > [< a class = "code" href = "class_range_finder.html#ab23a1a69f5b96fd791491f845ad1bfdb" > _history_ptr< / a > ] = latestValue;
< a name = "l00034" > < / a > 00034 < span class = "keywordflow" > for< / span > (i=0; i< AP_RANGEFINDER_NUM_AVERAGES; i++ )
< a name = "l00035" > < / a > 00035 total += < a class = "code" href = "class_range_finder.html#a4f45693be996b3395f063a4624b853b4" > _history< / a > [i];
< a name = "l00036" > < / a > 00036 < span class = "keywordflow" > return< / span > total / AP_RANGEFINDER_NUM_AVERAGES;
< a name = "l00037" > < / a > 00037 }
< / pre > < / div > < / div >
< / div >
2010-12-26 23:23:35 -04:00
< hr class = "footer" / > < address class = "footer" > < small >
Generated for ArduPilot Libraries by < a href = "http://www.doxygen.org/index.html" > < img class = "footer" src = "doxygen.png" alt = "doxygen" / > < / a > < / small > < / address >
2010-12-26 20:59:17 -04:00
< / body >
< / html >