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 #ifndef SFCONSTANTS_H
00037 #define SFCONSTANTS_H
00038
00039 #ifdef WIN32
00040 #define MS_WINDOWS
00041 #else
00042 #define IS_UNIX
00043 #endif
00044
00045 #undef SFEXPORT
00046 #if defined(MS_WINDOWS) && !defined(SF_STATIC)
00047 #ifdef MAKE_LIBRARY
00048 #define _declspec( dllexport )
00049 #else
00050 #define _declspec( dllimport )
00051 #endif
00052 #else
00053 #define SFEXPORT
00054 #endif
00055
00056
00057 #include <math.h>
00058 #ifdef NOSYS_TYPES
00059 #include <types.h>
00060 #else
00061 #include <sys/types.h>
00062 #endif
00063
00064
00065
00066
00067
00068
00069 #define sfColorDarkTurquoise 10
00070 #define sfColorDarkOliveGreen 11
00071 #define sfColorOrangeRed 12
00072 #define sfColorMagenta 5
00073 #define sfColorSteelBlue 4
00074 #define sfColorBrickRed 1
00075 #define sfColorRed 1
00076 #define sfColorLightRed 1
00077 #define sfColorYellow 3
00078 #define sfColorLightYellow 3
00079 #define sfColorBlack 0
00080 #define sfColorWhite 7
00081 #define sfColorGray 49
00082 #define sfColorMediumGray 45
00083 #define sfColorLightGray 52
00084 #define sfColorGreen 2
00085 #define sfColorCyan 6
00086
00087 #define sfLineSolid 0
00088 #define sfLineDashed 1
00089
00090
00091
00092 #define sfLEFT 0
00093 #define sfRIGHT 1
00094
00095 #define DEG_TO_RAD (M_PI / 180.0)
00096 #define RAD_TO_DEG (180.0 / M_PI)
00097
00098
00099
00100 #ifdef WIN32
00101 #define M_PI_2 (M_PI / 2.0)
00102 #endif
00103 #define ANG30 (M_PI * 30.0 / 180.0)
00104 #define ANG45 M_PI_4
00105 #define ANG60 (M_PI * 60.0 / 180.0)
00106 #define ANG70 (M_PI * 70.0 / 180.0)
00107 #define ANG180 M_PI
00108 #define ANG240 (M_PI * 240.0 / 180.0)
00109 #define ANG270 (M_PI + M_PI_2)
00110 #define ANG360 (M_PI + M_PI)
00111
00112
00113 #define ANG90 M_PI_2
00114 #define ANG100 (M_PI * 100.0 / 180.0)
00115 #define ANG120 (M_PI * 120.0 / 180.0)
00116 #define ANG135 (ANG90 + ANG45)
00117
00118 #ifndef MAX
00119 #define MAX(a,b) (((a)>(b))?(a):(b))
00120 #endif
00121 #ifndef MIN
00122 #define MIN(a,b) (((a)<(b))?(a):(b))
00123 #endif
00124 #define ABS(x) ((x) > 0.0 ? (x) : (- (x)))
00125 #define SIGNUM(x) ((x) > 0.0 ? 1 : ((x) < 0.0 ? -1 : 0))
00126 #define FSIGNUM(x) ((x) > 0.0 ? 1.0 : ((x) < 0.0 ? -1.0 : 0.0))
00127
00128
00129
00130 #define ROUNDPOS(x) ((int)(x + 0.5))
00131 #define ROUNDUP(x) ((int)ceil(x))
00132 #ifndef ROUND
00133 #ifdef LINUX
00134 #define ROUND(x) ((int)rint(x))
00135 #else
00136 #define ROUND(x) ((int)floor((x) + 0.5))
00137 #endif
00138 #endif
00139
00140
00141
00142 #ifdef WIN32
00143 extern "C" {
00144 void *dlopen(char *fname, int flag);
00145 void dlclose(void *h);
00146 void *dlsym(void *handle, char *sym);
00147 char *dlerror(void);
00148 }
00149 #define RTLD_NOW 0
00150 #define RTLD_GLOBAL 0
00151 #else
00152 #include <dlfcn.h>
00153 #endif
00154 #define RTLD_FLAGS RTLD_NOW | RTLD_GLOBAL
00155
00156
00157 #ifdef WIN32
00158 #define bigint __int64
00159 #define PARAMSTR "%s\\params\\"
00160 #define MAPSTR "%s\\worlds"
00161 #define DIRSEPSTR "\\"
00162 #define DIRSEPCHAR '\\'
00163 #else
00164 #define PARAMSTR "%s/params/"
00165 #define MAPSTR "%s/worlds"
00166 #define DIRSEPSTR "/"
00167 #define DIRSEPCHAR '/'
00168 #endif
00169 #define DIRSEPCHARUNIX '/'
00170
00171
00172
00173
00174
00175 extern char *sfParamDir;
00176 extern char *sfMapDirectory;
00177 extern char *sfLoadDirectory;
00178 extern char *sfTopDirectory;
00179
00180 extern char *sfComSerial;
00181 extern int sfSerialBaud;
00182 extern char *sfComServer;
00183 extern char *sfComPipe;
00184 extern int sfComServerPort;
00185 extern int sfComPortType;
00186
00187 void shorten(char *name);
00188 extern char namebuf[];
00189
00190
00191 #define TROBOT_PORT 8101
00192 #define UROBOT_PORT 8102
00193 #define TCP 0
00194
00195 #define TCPPORT 0
00196 #define UDP 1
00197
00198 #define UNIXPORT 4
00199 #define TTYPORT 5
00200 #define CHILDPORT 6
00201 #define LOCALPORT 6
00202 #define NOPORT 7
00203
00204 #ifdef WIN32
00205 #define SERIAL_COM_1 "COM1"
00206 #define SERIAL_COM_2 "COM2"
00207 #else
00208 #define SERIAL_COM_1 "/dev/ttyS0"
00209 #define SERIAL_COM_2 "/dev/ttyS1"
00210 #endif
00211
00212 #define sfTTYPORT TTYPORT
00213 #define sfLOCALPORT CHILDPORT
00214 #define sfTCPPORT TCPPORT
00215 #define sfCOM1 SERIAL_COM_1
00216 #define sfCOM2 SERIAL_COM_2
00217 #define sfCOMLOCAL ROBOT_SOCKET
00218
00219 #endif // SFCONSTANT.H
00220
00221