WPILib 2012
WPILibRoboticsLibraryforFRC
Vision2009/BaeUtilities.h
00001 /********************************************************************************
00002 *  Project              : FIRST Motor Controller
00003 *  File Name            : BaeUtilities.h          
00004 *  Contributors         : JDG, ELF
00005 *  Creation Date        : August 12, 2008
00006 *  Revision History     : Source code & revision history maintained at sourceforge.WPI.edu      
00007 *  File Description     : Globally defined values for utilities
00008 */
00009 /*----------------------------------------------------------------------------*/
00010 /*        Copyright (c) FIRST 2008.  All Rights Reserved.                     */
00011 /*     Open Source Software - may be modified and shared by FRC teams.        */
00012 /*   Must be accompanied by the BSD license file in $(WIND_BASE)/WPILib.      */
00013 /*----------------------------------------------------------------------------*/
00014 
00015 #ifndef __BAEUTILITIES_H__
00016 #define __BAEUTILITIES_H__
00017 
00018 /*  Constants */
00019 #define LOG_DEBUG    __FILE__,__FUNCTION__,__LINE__,DEBUG_TYPE
00020 #define LOG_INFO     __FILE__,__FUNCTION__,__LINE__,INFO_TYPE
00021 #define LOG_ERROR    __FILE__,__FUNCTION__,__LINE__,ERROR_TYPE
00022 #define LOG_CRITICAL __FILE__,__FUNCTION__,__LINE__,CRITICAL_TYPE
00023 #define LOG_FATAL    __FILE__,__FUNCTION__,__LINE__,FATAL_TYPE
00024 #define LOG_DEBUG    __FILE__,__FUNCTION__,__LINE__,DEBUG_TYPE
00025 
00026 /*   Enumerated Types */
00027 
00029 enum dprint_type {DEBUG_TYPE, INFO_TYPE, ERROR_TYPE, CRITICAL_TYPE, FATAL_TYPE};
00030 
00032 typedef enum DebugOutputType_enum { 
00033         DEBUG_OFF, DEBUG_MOSTLY_OFF, DEBUG_SCREEN_ONLY, DEBUG_FILE_ONLY, DEBUG_SCREEN_AND_FILE
00034 }DebugOutputType;
00035 
00036 /*  Enumerated Types */
00037 
00038 /* Utility functions */
00039 
00040 /* debug */
00041 void SetDebugFlag ( DebugOutputType flag  ); 
00042 void dprintf ( char * tempString, ...  );  /* Variable argument list */
00043 
00044 /* set FRC ranges for drive */
00045 double RangeToNormalized(double pixel, int range);
00046 /* change normalized value to any range - used for servo */
00047 float NormalizeToRange(float normalizedValue, float minRange, float maxRange);
00048 float NormalizeToRange(float normalizedValue);
00049 
00050 /* system utilities */
00051 void ShowActivity (char *fmt, ...);
00052 double ElapsedTime (double startTime);
00053 
00054 /* servo panning utilities */
00055 class Servo;
00056 double SinPosition (double *period, double sinStart);
00057 void panInit();
00058 void panInit(double period);
00059 void panForTarget(Servo *panServo);
00060 void panForTarget(Servo *panServo, double sinStart);
00061 
00062 /* config file read utilities */
00063 int processFile(char *inputFile, char *outputString, int lineNumber);
00064 int emptyString(char *string);
00065 void stripString(char *string);
00066 
00067 #endif
00068 
 All Classes Functions Variables