blob: 898c9e70d7e2933dd56555f02338678e68186036 [file] [log] [blame]
jerrymf1579332013-02-07 01:56:28 +00001/********************************************************************************
2* Project : FIRST Motor Controller
3* File Name : BaeUtilities.h
4* Contributors : JDG, ELF
5* Creation Date : August 12, 2008
6* Revision History : Source code & revision history maintained at sourceforge.WPI.edu
7* File Description : Globally defined values for utilities
8*/
9/*----------------------------------------------------------------------------*/
10/* Copyright (c) FIRST 2008. All Rights Reserved. */
11/* Open Source Software - may be modified and shared by FRC teams. */
12/* Must be accompanied by the BSD license file in $(WIND_BASE)/WPILib. */
13/*----------------------------------------------------------------------------*/
14
15#ifndef __BAEUTILITIES_H__
16#define __BAEUTILITIES_H__
17
18/* Constants */
19#define LOG_DEBUG __FILE__,__FUNCTION__,__LINE__,DEBUG_TYPE
20#define LOG_INFO __FILE__,__FUNCTION__,__LINE__,INFO_TYPE
21#define LOG_ERROR __FILE__,__FUNCTION__,__LINE__,ERROR_TYPE
22#define LOG_CRITICAL __FILE__,__FUNCTION__,__LINE__,CRITICAL_TYPE
23#define LOG_FATAL __FILE__,__FUNCTION__,__LINE__,FATAL_TYPE
24#define LOG_DEBUG __FILE__,__FUNCTION__,__LINE__,DEBUG_TYPE
25
26/* Enumerated Types */
27
28/** debug levels */
29enum dprint_type {DEBUG_TYPE, INFO_TYPE, ERROR_TYPE, CRITICAL_TYPE, FATAL_TYPE};
30
31/** debug output setting */
32typedef enum DebugOutputType_enum {
33 DEBUG_OFF, DEBUG_MOSTLY_OFF, DEBUG_SCREEN_ONLY, DEBUG_FILE_ONLY, DEBUG_SCREEN_AND_FILE
34}DebugOutputType;
35
36/* Enumerated Types */
37
38/* Utility functions */
39
40/* debug */
41void SetDebugFlag ( DebugOutputType flag );
42void dprintf ( char * tempString, ... ); /* Variable argument list */
43
44/* set FRC ranges for drive */
45double RangeToNormalized(double pixel, int range);
46/* change normalized value to any range - used for servo */
47float NormalizeToRange(float normalizedValue, float minRange, float maxRange);
48float NormalizeToRange(float normalizedValue);
49
50/* system utilities */
51void ShowActivity (char *fmt, ...);
52double ElapsedTime (double startTime);
53
54/* servo panning utilities */
55class Servo;
56double SinPosition (double *period, double sinStart);
57void panInit();
58void panInit(double period);
59void panForTarget(Servo *panServo);
60void panForTarget(Servo *panServo, double sinStart);
61
62/* config file read utilities */
63int processFile(char *inputFile, char *outputString, int lineNumber);
64int emptyString(char *string);
65void stripString(char *string);
66
67#endif
68