Create Utilities.c

Utilities.c

Similar to “Subsystem_Functions.c”, “Utilities.c” contains encapsulated functions called in other functions or in Pre-Auton, Autonomous, or User Control.  The difference is that while the subsystem functions are specific to our robot design, the utilities can be applied to any robot.  There are generic deadband and clipping functions, and all the building blocks of the PID logic.  The PID logic would have been written more simply as an object, but unfortunately RobotC is not object oriented.  Using one set of functions and a global struct for each PID controller simulates the functionality of OOP.  This file also contains a function for displaying the robot’s battery voltage on the LCD screen (as this can be accessed remotely through the RobotC debugger and is thus robot-independent).