📄 real.h
字号:
/* YAKS, a Khepera simulator including a separate GA and ANN (Genetic Algoritm, Artificial Neural Net). Copyright (C) 2000 Johan Carlsson (johanc@ida.his.se) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/#ifndef REAL_H#define REAL_H#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <signal.h>#include <fcntl.h>#include <termio.h>#include <string.h>#include <time.h>#include <ctype.h>#include "param.h"#define KHEP_DEFAULT_TIMEOUT 5 /* 1/10 seconds */#define KHEP_NB_RETRY 3typedef unsigned char boolean;#ifndef TRUE#define TRUE 1#endif#ifndef FALSE#define FALSE 0#endif#define clear(var, mask) var &= (~(mask))#define set(var, mask) var |= (mask)class Real{ public: Real(); ~Real(); boolean init(); void setInput(int robotNr); void runStep(double mot1,double mot2,int robotNr); void nextIndivid(); private: boolean khepTalk(int fd,char *send,char *receive,int recv_len); boolean khepSendRecv(int fd, char *send, char *recieve, int recv); void serialDrain(int fd, boolean verbose); static int order(int whichRobot, char *command, char *answear, int aSize); static int readline(int fd, char *buffer, int bsize); static int serialLine[50];};#endif /* REAL_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -