00001 // ---------------------------------------------------------------------------- 00002 // 00003 // $Id$ 00004 // 00005 // Copyright 2008, 2009, 2010, 2011, 2012 Antonio Franchi and Paolo Stegagno 00006 // 00007 // This file is part of MIP. 00008 // 00009 // MIP is free software: you can redistribute it and/or modify 00010 // it under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation, either version 3 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // MIP is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>. 00021 // 00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it 00023 // 00024 // ---------------------------------------------------------------------------- 00025 00026 00030 00031 00035 00036 00038 /* @{ */ 00039 00040 00041 #ifndef __LAS_NAV_H 00042 #define __LAS_NAV_H 00043 00044 #include <Spaces.h> 00045 #include <Scan.h> 00046 00047 using namespace MipBaselib; 00048 00052 class LaserNavigationIn{ 00053 public: 00054 Scan scan; 00055 bool laserNotResp; 00056 00057 LaserNavigationIn(Scan sc, bool noResp){ 00058 scan = sc; 00059 laserNotResp = noResp; 00060 } 00061 00062 inline void assignMinReadings(Scan sc){ 00063 scan = sc; 00064 } 00065 00066 inline void assignlaserNotResp(bool notResp){ 00067 laserNotResp = notResp; 00068 } 00069 }; 00070 00074 class LaserNavigationParams { 00075 public: 00076 Decimal freeDist; // 1 m distanza a cui voglio la velocità massima 00077 Decimal safeDistFree; // 00078 Decimal safeDistLocked; 00079 Decimal scaleV; 00080 Decimal scaleW; 00081 /* int minCmdOn; // minimo comando per fermarsi 00082 int maxCmd; // max cmd da dare ai motori 00083 int minCmd; // minimo comando per ripartire*/ 00084 Decimal maxAccel; 00085 Decimal maxJogAccelRatio; 00086 00087 LaserNavigationParams(); 00088 }; 00089 00093 class LaserNavigationVars { 00094 public: 00095 00096 bool deadlock; 00097 Decimal oldTurnrate; 00098 Decimal oldSpeed; 00099 00100 LaserNavigationVars(){ 00101 deadlock = false; 00102 oldTurnrate = 0.0; 00103 oldSpeed = 0.0; 00104 /*init vars*/ 00105 } 00106 }; 00107 00108 00112 class LaserNavigation { 00113 private: 00114 LaserNavigationVars vars; 00115 LaserNavigationParams params; 00116 public: 00117 LaserNavigation(){ 00118 vars.deadlock = false; 00119 vars.oldTurnrate = 0.0; 00120 vars.oldSpeed = 0.0; 00121 } 00122 00123 LaserNavigation(LaserNavigationParams inParams){ 00124 params = inParams; 00125 } 00126 00127 Position step(LaserNavigationIn); 00128 }; 00129 00130 00131 00132 00133 00134 #endif 00135 00136 00137 /* @} */ 00138 00139 00140 00141 00142