Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #ifndef SerRelayBoard_INCLUDEDEF_H
00055 #define SerRelayBoard_INCLUDEDEF_H
00056
00057
00058 #include <cob_relayboard/SerialIO.h>
00059 #include <cob_relayboard/Mutex.h>
00060 #include <cob_relayboard/CmdRelaisBoard.h>
00061
00062
00063
00068 class SerRelayBoard
00069 {
00070 public:
00071
00072 SerRelayBoard(std::string ComPort, int ProtocolVersion = 1);
00073
00074 ~SerRelayBoard();
00075
00076
00077 bool init();
00078 bool reset();
00079 bool shutdown();
00080
00081 int evalRxBuffer();
00082 int sendRequest();
00083
00084
00085 int setDigOut(int iChannel, bool bOn);
00086 int getAnalogIn(int* piAnalogIn);
00087 int getDigIn();
00088 bool isEMStop();
00089 bool isScannerStop();
00090 int getBatteryVoltage()
00091 {
00092 return m_iRelBoardBattVoltage;
00093 }
00094 int getChargeCurrent()
00095 {
00096 return m_iChargeCurrent;
00097 }
00098
00099
00100 enum RelBoardReturns
00101 {
00102 NO_ERROR = 0,
00103 NOT_INITIALIZED = 1,
00104 GENERAL_SENDING_ERROR = 2,
00105 TOO_LESS_BYTES_IN_QUEUE = 3,
00106 NO_MESSAGES = 4,
00107 CHECKSUM_ERROR = 5,
00108 };
00109
00110 enum RelBoardCmd
00111 {
00112 CMD_SET_CHARGE_RELAY = 1,
00113 CMD_RESET_POS_CNT = 2,
00114 CMD_QUICK_STOP = 4,
00115 CMD_SET_RELAY1 = 8,
00116 CMD_SET_RELAY2 = 16,
00117 CMD_SET_RELAY3 = 32,
00118 CMD_SET_RELAY4 = 64,
00119 CMD_SET_RELAY5 = 128,
00120 CMD_SET_RELAY6 = 256,
00121 CMD_ZERO_GYRO = 512
00122 };
00123
00124 enum RelBoardConfig
00125 {
00126 CONFIG_HAS_IOBOARD = 1,
00127 CONFIG_HAS_USBOARD = 2,
00128 CONFIG_HAS_GYROBOARD = 4,
00129 CONFIG_HAS_RADARBOARD1 = 8,
00130 CONFIG_HAS_RADARBOARD2 = 16,
00131 CONFIG_HAS_DRIVES = 32,
00132 };
00133
00134 enum TypeLCD
00135 {
00136 LCD_20CHAR_TEXT,
00137 LCD_60CHAR_TEXT,
00138 RELAY_BOARD_1_4
00139 };
00140
00141 protected:
00142
00143
00144 std::string m_sNumComPort;
00145
00146 void txCharArray();
00147 void rxCharArray();
00148
00149 void convDataToSendMsg(unsigned char cMsg[]);
00150 bool convRecMsgToData(unsigned char cMsg[]);
00151
00152 Mutex m_Mutex;
00153
00154 int m_iNumBytesSend;
00155 int m_iTypeLCD;
00156
00157 unsigned char m_cTextDisplay[60];
00158
00159
00160 int m_iVelCmdMotRearRightEncS;
00161 int m_iVelCmdMotRearLeftEncS;
00162 char m_cSoftEMStop;
00163 char m_cDebugRearRight[4];
00164 int m_iPosMeasMotRearRightEnc;
00165 int m_iVelMeasMotRearRightEncS;
00166 int m_iPosMeasMotRearLeftEnc;
00167 char m_cDebugRearLeft[4];
00168 int m_iVelMeasMotRearLeftEncS;
00169 int m_iMotRearRightStatus;
00170 int m_iMotRearLeftStatus;
00171 double m_dLastPosRearRight;
00172 double m_dLastPosRearLeft;
00173
00174
00175
00176
00177
00178 int m_iConfigRelayBoard;
00179 int m_iCmdRelayBoard;
00180
00181
00182 int m_iIOBoardDigOut;
00183
00184
00185 int m_iVelCmdMotRightEncS;
00186 int m_iVelCmdMotLeftEncS;
00187
00188
00189 int m_iUSBoardSensorActive;
00190
00191
00192
00193 int m_iRelBoardStatus;
00194 int m_iChargeCurrent;
00195 int m_iRelBoardBattVoltage;
00196 int m_iRelBoardKeyPad;
00197 int m_iRelBoardAnalogIn[4];
00198 int m_iRelBoardTempSensor;
00199
00200 int m_iDigIn;
00201 int m_iProtocolVersion;
00202 int m_NUM_BYTE_SEND;
00203
00204 SerialIO m_SerIO;
00205
00206 bool m_bComInit;
00207 };
00208
00209
00210
00211 #endif