Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members  

SfConstant.h

00001 //
00002 // SfConstant.h -- Constants used in the handler
00003 //
00004 
00005 
00006 //
00007 // SfConstants.h
00008 //
00009 // Copyright 2001 by Kurt Konolige
00010 //
00011 // The author hereby grants to SRI permission to use this software.
00012 // The author also grants to SRI permission to distribute this software
00013 // to schools for non-commercial educational use only.
00014 //
00015 // The author hereby grants to other individuals or organizations
00016 // permission to use this software for non-commercial
00017 // educational use only.  This software may not be distributed to others
00018 // except by SRI, under the conditions above.
00019 //
00020 // Other than these cases, no part of this software may be used or
00021 // distributed without written permission of the author.
00022 //
00023 // Neither the author nor SRI make any representations about the 
00024 // suitability of this software for any purpose.  It is provided 
00025 // "as is" without express or implied warranty.
00026 //
00027 // Kurt Konolige
00028 // Senior Computer Scientist
00029 // SRI International
00030 // 333 Ravenswood Avenue
00031 // Menlo Park, CA 94025
00032 // E-mail:  konolige@ai.sri.com
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 // some color definitions, from FLTK
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 // left and right are useful constants
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 // angular units are rads 
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 // max and min and abs 
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 // rounding
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 // shared object fns 
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 // some directory definitions 
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 // default directories 
00173 // need to make these into a static class
00174 
00175 extern char *sfParamDir;
00176 extern char *sfMapDirectory;
00177 extern char *sfLoadDirectory;
00178 extern char *sfTopDirectory; // top level Saphira directory 
00179 
00180 extern char *sfComSerial; // tty port name 
00181 extern int   sfSerialBaud; // tty port baud rate 
00182 extern char *sfComServer; // TCP/IP server name 
00183 extern char *sfComPipe; // local transport name 
00184 extern int   sfComServerPort;   // port number for TCP connection 
00185 extern int   sfComPortType;     // default connection type 
00186 
00187 void shorten(char *name);       /* shorten the file name into outbuf */
00188 extern char namebuf[];
00189 
00190 // channels
00191 #define TROBOT_PORT 8101        /* port number by default */
00192 #define UROBOT_PORT 8102        /* port number by default */
00193 #define TCP 0                   /* protocol number */
00194 //enum { TCP=0 };
00195 #define TCPPORT 0               /* protocol number */
00196 #define UDP 1                   /* protocol number */
00197 //enum   { UDP=1 };
00198 #define UNIXPORT 4              /* protocol number */
00199 #define TTYPORT 5               /* protocol number */
00200 #define CHILDPORT 6             /* child stdin/stdout */
00201 #define LOCALPORT 6
00202 #define NOPORT 7                /* no port, just open */
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       /* channel types */
00213 #define sfLOCALPORT CHILDPORT
00214 #define sfTCPPORT TCPPORT
00215 #define sfCOM1 SERIAL_COM_1     /* channel names */
00216 #define sfCOM2 SERIAL_COM_2
00217 #define sfCOMLOCAL ROBOT_SOCKET
00218 
00219 #endif  // SFCONSTANT.H
00220 
00221 

Generated on Tue Nov 12 17:49:33 2002 for Saphira by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001