MOOS 0.2375
|
00001 00002 // 00003 // MOOS - Mission Oriented Operating Suite 00004 // 00005 // A suit of Applications and Libraries for Mobile Robotics Research 00006 // Copyright (C) 2001-2005 Massachusetts Institute of Technology and 00007 // Oxford University. 00008 // 00009 // This software was written by Paul Newman and others 00010 // at MIT 2001-2002 and Oxford University 2003-2005. 00011 // email: pnewman@robots.ox.ac.uk. 00012 // 00013 // This file is part of a MOOS Instrument. 00014 // 00015 // This program is free software; you can redistribute it and/or 00016 // modify it under the terms of the GNU General Public License as 00017 // published by the Free Software Foundation; either version 2 of the 00018 // License, or (at your option) any later version. 00019 // 00020 // This program is distributed in the hope that it will be useful, 00021 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00023 // General Public License for more details. 00024 // 00025 // You should have received a copy of the GNU General Public License 00026 // along with this program; if not, write to the Free Software 00027 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00028 // 02111-1307, USA. 00029 // 00031 // MOOSActuation.h: interface for the CMOOSActuation class. 00032 // 00034 00035 #if !defined(AFX_MOOSACTUATION_H__326BACD6_5396_4326_8991_B5B71E6C49AD__INCLUDED_) 00036 #define AFX_MOOSACTUATION_H__326BACD6_5396_4326_8991_B5B71E6C49AD__INCLUDED_ 00037 00038 #if _MSC_VER > 1000 00039 #pragma once 00040 #endif // _MSC_VER > 1000 00041 00042 class CMOOSActuationDriver; 00043 class CMOOSActuation : public CMOOSInstrument 00044 { 00045 public: 00046 00047 enum MotorName{RUDDER,ELEVATOR,THRUST}; 00048 00049 CMOOSActuation(); 00050 virtual ~CMOOSActuation(); 00051 00052 protected: 00053 bool OnActuationSet(); 00054 bool Reset(); 00055 bool HandleHWWatchDog(); 00056 bool DoIO(MotorName Name); 00057 00059 bool Iterate(); 00060 00063 bool OnConnectToServer(); 00064 00065 bool OnStartUp(); 00066 00067 bool OnNewMail(MOOSMSG_LIST &NewMail); 00068 00069 00070 00071 class ActuatorDOF 00072 { 00073 public: 00074 double GetTimeSet(); 00075 bool SetValue(double dfVal,double dfTime); 00076 double GetDesired(); 00077 bool SetDesired(double dfVal,double m_dfTime); 00078 bool HasExpired(); 00079 ActuatorDOF(); 00080 bool IsUpdateRequired(); 00081 00082 protected: 00083 double m_dfVal; 00084 double m_dfDesired; 00085 double m_dfTimeSet; 00086 double m_dfRefreshPeriod; 00087 double m_dfTimeRequested; 00088 00089 00090 00091 }; 00092 00093 00094 class RollTransform:public ActuatorDOF 00095 { 00096 public: 00097 RollTransform(); 00098 //method to transform the input rudder + elevator 00099 //to a desired rudder and elevator 00100 bool Transform(double &dfRudder, double &dfElevator); 00101 bool IsTransformRequired(); 00102 void SetTransformRequired(bool bTForm); 00103 private: 00104 bool m_bTransform; 00105 00106 }; 00107 00108 00109 ActuatorDOF m_Motors[3]; 00110 RollTransform m_RollTransform; 00111 00112 CMOOSActuationDriver * m_pDriver; 00113 00114 double m_dfLastRPMTime; 00115 00116 std::string m_sDriverType; 00117 00118 00119 00120 }; 00121 00122 #endif // !defined(AFX_MOOSACTUATION_H__326BACD6_5396_4326_8991_B5B71E6C49AD__INCLUDED_)