Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > 4bc66056a634db26a1f4d0845dc41ca6 > files > 694

mrpt-doc-0.9.5-0.1.20110925svn2670.fc16.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>CHokuyoURG.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<div align="left"><a href="http://www.mrpt.org/">Main MRPT website</a> &gt; <b>C++ reference</b> </div>
<div align="right">
<a href="index.html"><img border="0" src="mrpt_logo.png" alt="MRPT logo"></a>
</div>
<!-- Generated by Doxygen 1.7.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</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>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
          <div class="left">
            <form id="FSearchBox" action="search.php" method="get">
              <img id="MSearchSelect" src="search/mag.png" alt=""/>
              <input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S" 
                     onfocus="searchBox.OnSearchFieldFocus(true)" 
                     onblur="searchBox.OnSearchFieldFocus(false)"/>
            </form>
          </div><div class="right"></div>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">CHokuyoURG.h</div>  </div>
</div>
<div class="contents">
<a href="_c_hokuyo_u_r_g_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* +---------------------------------------------------------------------------+</span>
<a name="l00002"></a>00002 <span class="comment">   |          The Mobile Robot Programming Toolkit (MRPT) C++ library          |</span>
<a name="l00003"></a>00003 <span class="comment">   |                                                                           |</span>
<a name="l00004"></a>00004 <span class="comment">   |                       http://www.mrpt.org/                                |</span>
<a name="l00005"></a>00005 <span class="comment">   |                                                                           |</span>
<a name="l00006"></a>00006 <span class="comment">   |   Copyright (C) 2005-2011  University of Malaga                           |</span>
<a name="l00007"></a>00007 <span class="comment">   |                                                                           |</span>
<a name="l00008"></a>00008 <span class="comment">   |    This software was written by the Machine Perception and Intelligent    |</span>
<a name="l00009"></a>00009 <span class="comment">   |      Robotics Lab, University of Malaga (Spain).                          |</span>
<a name="l00010"></a>00010 <span class="comment">   |    Contact: Jose-Luis Blanco  &lt;jlblanco@ctima.uma.es&gt;                     |</span>
<a name="l00011"></a>00011 <span class="comment">   |                                                                           |</span>
<a name="l00012"></a>00012 <span class="comment">   |  This file is part of the MRPT project.                                   |</span>
<a name="l00013"></a>00013 <span class="comment">   |                                                                           |</span>
<a name="l00014"></a>00014 <span class="comment">   |     MRPT is free software: you can redistribute it and/or modify          |</span>
<a name="l00015"></a>00015 <span class="comment">   |     it under the terms of the GNU General Public License as published by  |</span>
<a name="l00016"></a>00016 <span class="comment">   |     the Free Software Foundation, either version 3 of the License, or     |</span>
<a name="l00017"></a>00017 <span class="comment">   |     (at your option) any later version.                                   |</span>
<a name="l00018"></a>00018 <span class="comment">   |                                                                           |</span>
<a name="l00019"></a>00019 <span class="comment">   |   MRPT is distributed in the hope that it will be useful,                 |</span>
<a name="l00020"></a>00020 <span class="comment">   |     but WITHOUT ANY WARRANTY; without even the implied warranty of        |</span>
<a name="l00021"></a>00021 <span class="comment">   |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         |</span>
<a name="l00022"></a>00022 <span class="comment">   |     GNU General Public License for more details.                          |</span>
<a name="l00023"></a>00023 <span class="comment">   |                                                                           |</span>
<a name="l00024"></a>00024 <span class="comment">   |     You should have received a copy of the GNU General Public License     |</span>
<a name="l00025"></a>00025 <span class="comment">   |     along with MRPT.  If not, see &lt;http://www.gnu.org/licenses/&gt;.         |</span>
<a name="l00026"></a>00026 <span class="comment">   |                                                                           |</span>
<a name="l00027"></a>00027 <span class="comment">   +---------------------------------------------------------------------------+ */</span>
<a name="l00028"></a>00028 <span class="preprocessor">#ifndef CHokuyoURG_H</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define CHokuyoURG_H</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;<a class="code" href="_c_pose3_d_8h.html">mrpt/poses/CPose3D.h</a>&gt;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;<a class="code" href="_c2_d_range_finder_abstract_8h.html">mrpt/hwdrivers/C2DRangeFinderAbstract.h</a>&gt;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;<a class="code" href="stl__extensions_8h.html">mrpt/utils/stl_extensions.h</a>&gt;</span>
<a name="l00034"></a>00034 
<a name="l00035"></a>00035 <span class="keyword">namespace </span>mrpt
<a name="l00036"></a>00036 {
<a name="l00037"></a>00037         <span class="keyword">namespace </span>hwdrivers
<a name="l00038"></a>00038         {<span class="comment"></span>
<a name="l00039"></a>00039 <span class="comment">                /** This software driver implements the protocol SCIP-2.0 for interfacing HOKUYO URG, UTM and UXM laser scanners.</span>
<a name="l00040"></a>00040 <span class="comment">                  *  Refer to the wiki page for more details:</span>
<a name="l00041"></a>00041 <span class="comment">                  *    http://www.mrpt.org/Example:HOKUYO_URG/UTM_Laser_Scanner</span>
<a name="l00042"></a>00042 <span class="comment">                  *</span>
<a name="l00043"></a>00043 <span class="comment">                  *  See also the application &quot;rawlog-grabber&quot; for a ready-to-use application to gather data from the scanner.</span>
<a name="l00044"></a>00044 <span class="comment">                  *</span>
<a name="l00045"></a>00045 <span class="comment">                  *  \code</span>
<a name="l00046"></a>00046 <span class="comment">                  *  PARAMETERS IN THE &quot;.INI&quot;-LIKE CONFIGURATION STRINGS:</span>
<a name="l00047"></a>00047 <span class="comment">                  * -------------------------------------------------------</span>
<a name="l00048"></a>00048 <span class="comment">                  *   [supplied_section_name]</span>
<a name="l00049"></a>00049 <span class="comment">                  *    HOKUYO_motorSpeed_rpm=600</span>
<a name="l00050"></a>00050 <span class="comment">                  *    //HOKUYO_HS_mode   = false    // Optional (un-comment line if used): Set/unset the High-sensitivity mode (not on all models/firmwares!)</span>
<a name="l00051"></a>00051 <span class="comment">                  *    COM_port_WIN = COM3</span>
<a name="l00052"></a>00052 <span class="comment">                  *    COM_port_LIN = ttyS0</span>
<a name="l00053"></a>00053 <span class="comment">                  *    pose_x=0.21      // Laser range scaner 3D position in the robot (meters)</span>
<a name="l00054"></a>00054 <span class="comment">                  *    pose_y=0</span>
<a name="l00055"></a>00055 <span class="comment">                  *    pose_z=0.34</span>
<a name="l00056"></a>00056 <span class="comment">                  *    pose_yaw=0       // Angles in degrees</span>
<a name="l00057"></a>00057 <span class="comment">                  *    pose_pitch=0</span>
<a name="l00058"></a>00058 <span class="comment">                  *    pose_roll=0</span>
<a name="l00059"></a>00059 <span class="comment">                  *    //IP_DIR =       192.168.0.10 // Uncommented this and &quot;PORT_DIR&quot; if the used HOKUYO is connected by Ethernet instead of USB</span>
<a name="l00060"></a>00060 <span class="comment">                  *    //PORT_DIR = 10940</span>
<a name="l00061"></a>00061 <span class="comment">                  *</span>
<a name="l00062"></a>00062 <span class="comment">                  *    // Optional: reduced FOV:</span>
<a name="l00063"></a>00063 <span class="comment">                  *    // reduced_fov  = 25 // Deg</span>
<a name="l00064"></a>00064 <span class="comment">                  *</span>
<a name="l00065"></a>00065 <span class="comment">                  *    // Optional: Exclusion zones to avoid the robot seeing itself:</span>
<a name="l00066"></a>00066 <span class="comment">                  *    //exclusionZone1_x = 0.20 0.30 0.30 0.20</span>
<a name="l00067"></a>00067 <span class="comment">                  *    //exclusionZone1_y = 0.20 0.30 0.30 0.20</span>
<a name="l00068"></a>00068 <span class="comment">                  *</span>
<a name="l00069"></a>00069 <span class="comment">                  *    // Optional: Exclusion zones to avoid the robot seeing itself:</span>
<a name="l00070"></a>00070 <span class="comment">                  *    //exclusionAngles1_ini = 20  // Deg</span>
<a name="l00071"></a>00071 <span class="comment">                  *    //exclusionAngles1_end = 25  // Deg</span>
<a name="l00072"></a>00072 <span class="comment">                  *</span>
<a name="l00073"></a>00073 <span class="comment">                  *  \endcode</span>
<a name="l00074"></a>00074 <span class="comment">                  * \ingroup mrpt_hwdrivers_grp</span>
<a name="l00075"></a>00075 <span class="comment">                  */</span>
<a name="l00076"></a>00076                 <span class="keyword">class </span><a class="code" href="hwdrivers__impexp_8h.html#a5bcf681973c7e4e76310bd0791f1b612">HWDRIVERS_IMPEXP</a> CHokuyoURG : <span class="keyword">public</span> C2DRangeFinderAbstract
<a name="l00077"></a>00077                 {
<a name="l00078"></a>00078                         <a class="code" href="_c_generic_sensor_8h.html#ab8b72c811c520eb036fa4080d9cd9d1d" title="This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...">DEFINE_GENERIC_SENSOR</a>(CHokuyoURG)
<a name="l00079"></a>00079                 public:
<a name="l00080"></a>00080 <span class="comment"></span>
<a name="l00081"></a>00081 <span class="comment">                        /** Used in CHokuyoURG::displayVersionInfo */</span>
<a name="l00082"></a>00082                         struct TSensorInfo
<a name="l00083"></a>00083                         {
<a name="l00084"></a><a class="code" href="structmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g_1_1_t_sensor_info.html#a0685850a521da79e58a5fe307139561a">00084</a>                                 std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a>             <a class="code" href="structmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g_1_1_t_sensor_info.html#a0685850a521da79e58a5fe307139561a" title="The sensor model.">model</a>;                  <span class="comment">//!&lt; The sensor model</span>
<a name="l00085"></a><a class="code" href="structmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g_1_1_t_sensor_info.html#a19d76c32fe2f861bc33b54e114edf43f">00085</a> <span class="comment"></span>                                <span class="keywordtype">double</span>                  <a class="code" href="structmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g_1_1_t_sensor_info.html#a19d76c32fe2f861bc33b54e114edf43f">d_min</a>,d_max;    <span class="comment">//!&lt; Min/Max ranges, in meters.</span>
<a name="l00086"></a><a class="code" href="structmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g_1_1_t_sensor_info.html#a148f0d6abb0e14f154c27119ee920690">00086</a> <span class="comment"></span>                                <span class="keywordtype">int</span>                             <a class="code" href="structmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g_1_1_t_sensor_info.html#a148f0d6abb0e14f154c27119ee920690" title="Number of measuremens per 360 degrees.">scans_per_360deg</a>;       <span class="comment">//!&lt; Number of measuremens per 360 degrees.</span>
<a name="l00087"></a><a class="code" href="structmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g_1_1_t_sensor_info.html#ad8c41473c3a94d58cd8406660604a602">00087</a> <span class="comment"></span>                                <span class="keywordtype">int</span>                             scan_first,<a class="code" href="structmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g_1_1_t_sensor_info.html#ad8c41473c3a94d58cd8406660604a602">scan_last</a>, scan_front;       <span class="comment">//!&lt; First, last, and front step of the scanner angular span.</span>
<a name="l00088"></a><a class="code" href="structmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g_1_1_t_sensor_info.html#a706573363ee3a684e4eae6520c30aec4">00088</a> <span class="comment"></span>                                <span class="keywordtype">int</span>                             <a class="code" href="structmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g_1_1_t_sensor_info.html#a706573363ee3a684e4eae6520c30aec4" title="Standard motor speed, rpm.">motor_speed_rpm</a>;                <span class="comment">//!&lt; Standard motor speed, rpm.</span>
<a name="l00089"></a>00089 <span class="comment"></span>                        };
<a name="l00090"></a>00090 
<a name="l00091"></a>00091                 <span class="keyword">private</span>:
<a name="l00092"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#afd21b67347b033fb077b9d4eb920291b">00092</a>                         <span class="keywordtype">int</span>             m_firstRange,<a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#afd21b67347b033fb077b9d4eb920291b" title="The first and last ranges to consider from the scan.">m_lastRange</a>;   <span class="comment">//!&lt; The first and last ranges to consider from the scan.</span>
<a name="l00093"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#af778f907212ac6427fe4ea9ce99fb881">00093</a> <span class="comment"></span>                        <span class="keywordtype">int</span>             <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#af778f907212ac6427fe4ea9ce99fb881" title="The motor speed (default=600rpm)">m_motorSpeed_rpm</a>;           <span class="comment">//!&lt; The motor speed (default=600rpm)</span>
<a name="l00094"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a8b7b2a11b7fb90beac8b704fbb2d6391">00094</a> <span class="comment"></span>                        poses<a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">::CPose3D</a>  <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a8b7b2a11b7fb90beac8b704fbb2d6391" title="The sensor 6D pose:">m_sensorPose</a>;       <span class="comment">//!&lt; The sensor 6D pose:</span>
<a name="l00095"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a80b98e185edc36578a7682fa8a3c10e5">00095</a> <span class="comment"></span>                        mrpt<a class="code" href="classmrpt_1_1utils_1_1circular__buffer.html">::utils::circular_buffer&lt;uint8_t&gt;</a> <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a80b98e185edc36578a7682fa8a3c10e5" title="Auxiliary buffer for readings.">m_rx_buffer</a>; <span class="comment">//!&lt; Auxiliary buffer for readings</span>
<a name="l00096"></a>00096 <span class="comment"></span>
<a name="l00097"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#aed9b38ef8406bf96e56da57d66423d13">00097</a>                         std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a>     <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#aed9b38ef8406bf96e56da57d66423d13" title="The last sent measurement command (MDXXX), including the last 0x0A.">m_lastSentMeasCmd</a>; <span class="comment">//!&lt; The last sent measurement command (MDXXX), including the last 0x0A.</span>
<a name="l00098"></a>00098 <span class="comment"></span>
<a name="l00099"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a5f8bf1fb50422e723ad1962fc33c14ba">00099</a>                         <span class="keywordtype">bool</span>                    <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a5f8bf1fb50422e723ad1962fc33c14ba">m_verbose</a>;
<a name="l00100"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a2f474244d9a69dfa1524c86ef0d1029d">00100</a>                         <span class="keywordtype">bool</span>                    <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a2f474244d9a69dfa1524c86ef0d1029d" title="High sensitivity [HS] mode (default: false)">m_highSensMode</a>;  <span class="comment">//!&lt; High sensitivity [HS] mode (default: false)</span>
<a name="l00101"></a>00101 <span class="comment"></span><span class="comment"></span>
<a name="l00102"></a>00102 <span class="comment">                        /** Enables the SCIP2.0 protocol (this must be called at the very begining!).</span>
<a name="l00103"></a>00103 <span class="comment">                          * \return false on any error</span>
<a name="l00104"></a>00104 <span class="comment">                          */</span>
<a name="l00105"></a>00105                         <span class="keywordtype">bool</span>  enableSCIP20();
<a name="l00106"></a>00106 <span class="comment"></span>
<a name="l00107"></a>00107 <span class="comment">                        /** Passes to 115200bps bitrate.</span>
<a name="l00108"></a>00108 <span class="comment">                          * \return false on any error</span>
<a name="l00109"></a>00109 <span class="comment">                          */</span>
<a name="l00110"></a>00110                         <span class="keywordtype">bool</span>  setHighBaudrate();
<a name="l00111"></a>00111 <span class="comment"></span>
<a name="l00112"></a>00112 <span class="comment">                        /** Switchs the laser on.</span>
<a name="l00113"></a>00113 <span class="comment">                          * \return false on any error</span>
<a name="l00114"></a>00114 <span class="comment">                          */</span>
<a name="l00115"></a>00115                         <span class="keywordtype">bool</span>  switchLaserOn();
<a name="l00116"></a>00116 <span class="comment"></span>
<a name="l00117"></a>00117 <span class="comment">                        /** Switchs the laser off</span>
<a name="l00118"></a>00118 <span class="comment">                          * \return false on any error</span>
<a name="l00119"></a>00119 <span class="comment">                          */</span>
<a name="l00120"></a>00120                         <span class="keywordtype">bool</span>  switchLaserOff();
<a name="l00121"></a>00121 <span class="comment"></span>
<a name="l00122"></a>00122 <span class="comment">                        /** Changes the motor speed in rpm&#39;s (default 600rpm)</span>
<a name="l00123"></a>00123 <span class="comment">                          * \return false on any error</span>
<a name="l00124"></a>00124 <span class="comment">                          */</span>
<a name="l00125"></a>00125                         <span class="keywordtype">bool</span>  setMotorSpeed(<span class="keywordtype">int</span> motoSpeed_rpm);
<a name="l00126"></a>00126 <span class="comment"></span>
<a name="l00127"></a>00127 <span class="comment">                        /** Ask to the device, and print to the debug stream, details about the firmware version,serial number,...</span>
<a name="l00128"></a>00128 <span class="comment">                          * \return false on any error</span>
<a name="l00129"></a>00129 <span class="comment">                          */</span>
<a name="l00130"></a>00130                         <span class="keywordtype">bool</span>  displayVersionInfo(  );
<a name="l00131"></a>00131 <span class="comment"></span>
<a name="l00132"></a>00132 <span class="comment">                        /** Ask to the device, and print to the debug stream, details about the sensor model.</span>
<a name="l00133"></a>00133 <span class="comment">                          *  It also optionally saves all the information in an user supplied data structure &quot;out_data&quot;.</span>
<a name="l00134"></a>00134 <span class="comment">                          * \return false on any error</span>
<a name="l00135"></a>00135 <span class="comment">                          */</span>
<a name="l00136"></a>00136                         <span class="keywordtype">bool</span>  displaySensorInfo( <a class="code" href="structmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g_1_1_t_sensor_info.html" title="Used in CHokuyoURG::displayVersionInfo.">CHokuyoURG::TSensorInfo</a> * out_data = NULL );
<a name="l00137"></a>00137 <span class="comment"></span>
<a name="l00138"></a>00138 <span class="comment">                        /** Start the scanning mode, using parameters stored in the object (loaded from the .ini file)</span>
<a name="l00139"></a>00139 <span class="comment">                          * After this command the device will start to send scans until &quot;switchLaserOff&quot; is called.</span>
<a name="l00140"></a>00140 <span class="comment">                          * \return false on any error</span>
<a name="l00141"></a>00141 <span class="comment">                          */</span>
<a name="l00142"></a>00142                         <span class="keywordtype">bool</span>  startScanningMode();
<a name="l00143"></a>00143 <span class="comment"></span>
<a name="l00144"></a>00144 <span class="comment">                        /** Turns the laser on */</span>
<a name="l00145"></a>00145                         <span class="keywordtype">void</span> initialize();
<a name="l00146"></a>00146 <span class="comment"></span>
<a name="l00147"></a>00147 <span class="comment">                        /** Waits for a response from the device.</span>
<a name="l00148"></a>00148 <span class="comment">                          * \return false on any error</span>
<a name="l00149"></a>00149 <span class="comment">                          */</span>
<a name="l00150"></a>00150                         <span class="keywordtype">bool</span>  receiveResponse(
<a name="l00151"></a>00151                                         <span class="keyword">const</span> <span class="keywordtype">char</span>      *sentCmd_forEchoVerification,
<a name="l00152"></a>00152                                         <span class="keywordtype">char</span>    &amp;rcv_status0,
<a name="l00153"></a>00153                                         <span class="keywordtype">char</span>    &amp;rcv_status1,
<a name="l00154"></a>00154                                         <span class="keywordtype">char</span>    *rcv_data,
<a name="l00155"></a>00155                                         <span class="keywordtype">int</span>             &amp;rcv_dataLength);
<a name="l00156"></a>00156 
<a name="l00157"></a>00157 <span class="comment"></span>
<a name="l00158"></a>00158 <span class="comment">                        /** Assures a minimum number of bytes in the input buffer, reading from the serial port only if required.</span>
<a name="l00159"></a>00159 <span class="comment">                          * \return false if the number of bytes are not available, even after trying to fetch more data from the serial port.</span>
<a name="l00160"></a>00160 <span class="comment">                          */</span>
<a name="l00161"></a>00161                         <span class="keywordtype">bool</span> assureBufferHasBytes(<span class="keyword">const</span> <span class="keywordtype">size_t</span> nDesiredBytes);
<a name="l00162"></a>00162 
<a name="l00163"></a>00163                 <span class="keyword">public</span>:<span class="comment"></span>
<a name="l00164"></a>00164 <span class="comment">                        /** Constructor</span>
<a name="l00165"></a>00165 <span class="comment">                          */</span>
<a name="l00166"></a>00166                         <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html" title="This software driver implements the protocol SCIP-2.0 for interfacing HOKUYO URG, UTM and UXM laser s...">CHokuyoURG</a>();
<a name="l00167"></a>00167 <span class="comment"></span>
<a name="l00168"></a>00168 <span class="comment">                        /** Destructor: turns the laser off */</span>
<a name="l00169"></a>00169                         <span class="keyword">virtual</span> ~<a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html" title="This software driver implements the protocol SCIP-2.0 for interfacing HOKUYO URG, UTM and UXM laser s...">CHokuyoURG</a>();
<a name="l00170"></a>00170 <span class="comment"></span>
<a name="l00171"></a>00171 <span class="comment">                        /** Specific laser scanner &quot;software drivers&quot; must process here new data from the I/O stream, and, if a whole scan has arrived, return it.</span>
<a name="l00172"></a>00172 <span class="comment">                          *  This method will be typically called in a different thread than other methods, and will be called in a timely fashion.</span>
<a name="l00173"></a>00173 <span class="comment">                          */</span>
<a name="l00174"></a>00174                         <span class="keywordtype">void</span>  doProcessSimple(
<a name="l00175"></a>00175                                 <span class="keywordtype">bool</span>                                                    &amp;outThereIsObservation,
<a name="l00176"></a>00176                                 <a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html" title="A &quot;CObservation&quot;-derived class that represents a 2D range scan measurement (typically from a laser sc...">mrpt::slam::CObservation2DRangeScan</a>     &amp;outObservation,
<a name="l00177"></a>00177                                 <span class="keywordtype">bool</span>                                                    &amp;hardwareError );
<a name="l00178"></a>00178 <span class="comment"></span>
<a name="l00179"></a>00179 <span class="comment">                        /** Enables the scanning mode (which may depend on the specific laser device); this must be called before asking for observations to assure that the protocol has been initializated.</span>
<a name="l00180"></a>00180 <span class="comment">                          * \return If everything works &quot;true&quot;, or &quot;false&quot; if there is any error.</span>
<a name="l00181"></a>00181 <span class="comment">                          */</span>
<a name="l00182"></a>00182                         <span class="keywordtype">bool</span>  turnOn();
<a name="l00183"></a>00183 <span class="comment"></span>
<a name="l00184"></a>00184 <span class="comment">                        /** Disables the scanning mode (this can be used to turn the device in low energy mode, if available)</span>
<a name="l00185"></a>00185 <span class="comment">                          * \return If everything works &quot;true&quot;, or &quot;false&quot; if there is any error.</span>
<a name="l00186"></a>00186 <span class="comment">                          */</span>
<a name="l00187"></a>00187                         <span class="keywordtype">bool</span>  turnOff();
<a name="l00188"></a>00188 <span class="comment"></span>
<a name="l00189"></a>00189 <span class="comment">                        /** Empties the RX buffers of the serial port */</span>
<a name="l00190"></a>00190                         <span class="keywordtype">void</span> purgeBuffers();
<a name="l00191"></a>00191 <span class="comment"></span>
<a name="l00192"></a>00192 <span class="comment">                        /** If set to non-empty, the serial port will be attempted to be opened automatically when this class is first used to request data from the laser.  */</span>
<a name="l00193"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a649938742b4b547472a8198daa5e3ad6">00193</a>                         <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a649938742b4b547472a8198daa5e3ad6" title="If set to non-empty, the serial port will be attempted to be opened automatically when this class is ...">setSerialPort</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a> &amp;port_name) { m_com_port = port_name; }
<a name="l00194"></a>00194                         <span class="comment"></span>
<a name="l00195"></a>00195 <span class="comment">                        /** Set the ip direction and port to connect using Ethernet communication */</span>
<a name="l00196"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a493faccb1583d35dd08bd930835eb8e5">00196</a>                         <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a493faccb1583d35dd08bd930835eb8e5" title="Set the ip direction and port to connect using Ethernet communication.">setIPandPort</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a> &amp;ip, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> &amp;port) { m_ip_dir = ip; m_port_dir = port; }
<a name="l00197"></a>00197 <span class="comment"></span>
<a name="l00198"></a>00198 <span class="comment">                        /** Returns the currently set serial port \sa setSerialPort */</span>
<a name="l00199"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a610d92b0d221bd2f58d80f0182bde4d6">00199</a>                         <span class="keyword">const</span> std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a> <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a610d92b0d221bd2f58d80f0182bde4d6" title="Returns the currently set serial port.">getSerialPort</a>() { <span class="keywordflow">return</span> m_com_port; }
<a name="l00200"></a>00200 <span class="comment"></span>
<a name="l00201"></a>00201 <span class="comment">                        /** If called (before calling &quot;turnOn&quot;), the field of view of the laser is reduced to the given range (in radians), discarding the rest of measures.</span>
<a name="l00202"></a>00202 <span class="comment">                          *  Call with &quot;0&quot; to disable this reduction again (the default).</span>
<a name="l00203"></a>00203 <span class="comment">                          */</span>
<a name="l00204"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a989289ffb6072e3f3493ab9fb5720b6e">00204</a>                         <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a989289ffb6072e3f3493ab9fb5720b6e" title="If called (before calling &quot;turnOn&quot;), the field of view of the laser is reduced to the given range (in...">setReducedFOV</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> fov) { m_reduced_fov = fov; }
<a name="l00205"></a>00205 <span class="comment"></span>
<a name="l00206"></a>00206 <span class="comment">                        /** Changes the high sensitivity mode (HS) (default: false)</span>
<a name="l00207"></a>00207 <span class="comment">                          * \return false on any error</span>
<a name="l00208"></a>00208 <span class="comment">                          */</span>
<a name="l00209"></a>00209                         <span class="keywordtype">bool</span>  setHighSensitivityMode(<span class="keywordtype">bool</span> enabled);
<a name="l00210"></a>00210 
<a name="l00211"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#ac9b357d18e13a33eb472222c4b72c843">00211</a>                         <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#ac9b357d18e13a33eb472222c4b72c843">setVerbose</a>(<span class="keywordtype">bool</span> enable = <span class="keyword">true</span>) { m_verbose = enable; }
<a name="l00212"></a>00212 
<a name="l00213"></a>00213 
<a name="l00214"></a>00214                 <span class="keyword">protected</span>:<span class="comment"></span>
<a name="l00215"></a>00215 <span class="comment">                        /** Returns true if there is a valid stream bound to the laser scanner, otherwise it first try to open the serial port &quot;m_com_port&quot;</span>
<a name="l00216"></a>00216 <span class="comment">                          */</span>
<a name="l00217"></a>00217                         <span class="keywordtype">bool</span>  checkCOMisOpen();
<a name="l00218"></a>00218 
<a name="l00219"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a84157502f5a8573e5a729ff6bb47894d">00219</a>                         <span class="keywordtype">double</span>                  <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a84157502f5a8573e5a729ff6bb47894d" title="Used to reduce artificially the interval of scan ranges.">m_reduced_fov</a>; <span class="comment">//!&lt; Used to reduce artificially the interval of scan ranges.</span>
<a name="l00220"></a>00220 <span class="comment"></span>
<a name="l00221"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a5b714bf193b24aa61d51c81210173223">00221</a>                         std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a>             <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a5b714bf193b24aa61d51c81210173223" title="If set to non-empty, the serial port will be attempted to be opened automatically when this class is ...">m_com_port</a>;             <span class="comment">//!&lt; If set to non-empty, the serial port will be attempted to be opened automatically when this class is first used to request data from the laser.</span>
<a name="l00222"></a>00222 <span class="comment"></span>
<a name="l00223"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#adaae01b49f030a3e545abd0923e229d7">00223</a>                         std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a>             <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#adaae01b49f030a3e545abd0923e229d7" title="If set to non-empty and m_port_dir too, the program will try to connect to a Hokuyo using Ethernet co...">m_ip_dir</a>;       <span class="comment">//!&lt; If set to non-empty and m_port_dir too, the program will try to connect to a Hokuyo using Ethernet communication</span>
<a name="l00224"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a3003d7d83ccf8ab3cf8661d28c455895">00224</a> <span class="comment"></span>                        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>    <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a3003d7d83ccf8ab3cf8661d28c455895" title="If set to non-empty and m_ip_dir too, the program will try to connect to a Hokuyo using Ethernet comm...">m_port_dir</a>;     <span class="comment">//!&lt; If set to non-empty and m_ip_dir too, the program will try to connect to a Hokuyo using Ethernet communication     </span>
<a name="l00225"></a>00225 <span class="comment"></span><span class="comment"></span>
<a name="l00226"></a>00226 <span class="comment">                        /** The information gathered when the laser is first open */</span>
<a name="l00227"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a008022bd5d84b46985bb83af7d9a4c24">00227</a>                         <a class="code" href="structmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g_1_1_t_sensor_info.html" title="Used in CHokuyoURG::displayVersionInfo.">TSensorInfo</a>             <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a008022bd5d84b46985bb83af7d9a4c24" title="The information gathered when the laser is first open.">m_sensor_info</a>;
<a name="l00228"></a>00228 
<a name="l00229"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#aea0bf2150874a54b4d3ca6d0587163bf">00229</a>                         <span class="keywordtype">bool</span>                    <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#aea0bf2150874a54b4d3ca6d0587163bf">m_I_am_owner_serial_port</a>;
<a name="l00230"></a>00230 
<a name="l00231"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a2a25597fdbdca0945086a3a5ad8c0ed9">00231</a>                         uint32_t                <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a2a25597fdbdca0945086a3a5ad8c0ed9" title="Time of the first data packet, for synchronization purposes.">m_timeStartUI</a>;  <span class="comment">//!&lt; Time of the first data packet, for synchronization purposes.</span>
<a name="l00232"></a><a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a022ea533d54b0220d09e0e23c3c770e6">00232</a> <span class="comment"></span>                        mrpt<a class="code" href="group__time__date.html#ga42674286d8d56afea013b6329bb7327a" title="A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...">::system::TTimeStamp</a>        <a class="code" href="classmrpt_1_1hwdrivers_1_1_c_hokuyo_u_r_g.html#a022ea533d54b0220d09e0e23c3c770e6">m_timeStartTT</a>;
<a name="l00233"></a>00233 <span class="comment"></span>
<a name="l00234"></a>00234 <span class="comment">                        /** Loads specific configuration for the device from a given source of configuration parameters, for example, an &quot;.ini&quot; file, loading from the section &quot;[iniSection]&quot; (see utils::CConfigFileBase and derived classes)</span>
<a name="l00235"></a>00235 <span class="comment">                          *  See hwdrivers::CHokuyoURG for the possible parameters</span>
<a name="l00236"></a>00236 <span class="comment">                          */</span>
<a name="l00237"></a>00237                         <span class="keywordtype">void</span>  loadConfig_sensorSpecific(
<a name="l00238"></a>00238                                 <span class="keyword">const</span> <a class="code" href="classmrpt_1_1utils_1_1_c_config_file_base.html" title="This class allows loading and storing values and vectors of different types from a configuration text...">mrpt::utils::CConfigFileBase</a> &amp;configSource,
<a name="l00239"></a>00239                                 <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>         &amp;iniSection );
<a name="l00240"></a>00240 
<a name="l00241"></a>00241                 };      <span class="comment">// End of class</span>
<a name="l00242"></a>00242 
<a name="l00243"></a>00243         } <span class="comment">// End of namespace</span>
<a name="l00244"></a>00244 
<a name="l00245"></a>00245 } <span class="comment">// End of namespace</span>
<a name="l00246"></a>00246 
<a name="l00247"></a>00247 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<br><hr><br> <table border="0" width="100%"> <tr> <td> Page generated by <a href="http://www.doxygen.org" target="_blank">Doxygen 1.7.5</a> for MRPT 0.9.5 SVN: at Sun Sep 25 17:20:18 UTC 2011</td><td></td> <td width="100"> </td> <td width="150">  </td></tr> </table>  </body></html>