Table of Contents
Here are some notes on the various libraries used by the TCB firmware. This may help you know where to start looking if you want to make a modification/addition.
“Extended” version of the Arduino EEPROM library, offers some very useful functions for reading and writing to EEPROM. Here is the GitHub page for the project, and this page shows some useful examples. This is not the only EEPROM library used by the TCB, see also OP_EEPROM below.
This library is included but not presently implemented. The library is for interfacing with the Adafruit BNO055 9-DOF IMU. The idea is to use this IMU for barrel stabilization features. Adafruit provides their own library but it relies on the standard Arduino Wire library, which is a “blocking” I2C library that causes serious code interruptions. We have attempted to create our own “non-blocking” I2C library (OP_I2C) but there are still unresolved issues with it. For now this library is not crucial.
An unmodified copy of Jack Christensen's Button library, renamed with an OP_ prefix to avoid conflicts. This library provides some useful functions for reading a button, such as the INPUT button on the TCB.
Controls all acceleration/deceleration (inertia/momentum) constraints and their presets; calculates drive mode and the brake flag; mixes throttle and steering commands to produce individual track speeds; and provides functions for starting/stopping the engine and engaging/disengaging the “transmission.”
TCB specific EEPROM functions (for generic EEPROM reading/writing functions see EEPROMx above). The TCB stores approximately 300 variables in EEPROM, these are defined in OP_EEPROM_Struct.h. Information about each variable (unique variable ID, its offset in the struct, and its data type) are stored in an array in OP_EEPROM_VarInfo.h. This array (and a similar one used by OP_Config) are auto-generated using an Excel workbook called OP_EEPROM_Vars.xls. The cpp file includes functions for reading/writing EEPROM variables, not generically, but as members of the struct in which they reside. These functions are primarily implemented when the TCB is sending data to or having its data updated by the OP Config program running on a PC. There is also a function to initialize all EEPROM variables to default values, for example the first time the board is booted after creation, or when doing a system reset.
FT stands for “Functions and Triggers.” A single h file defines all the available special functions and their names, whether they are “digital” (discrete) or “analog” (variable); it also defines the turret stick as a 9-position function trigger.
The only library presently not complete, this is our attempt at a non-blocking I2C library, which however is not yet working correctly. If it were, barrel stabilization implementation would be complete when used with the OP_BNO055 library. It would also pave the way for integration of future I2C peripherals.
Decodes FlySky iBus radio data on Serial port 3.
A single h file defines some structs that represent the general purpose input/outputs called A & B on the TCB board. See the IO tab in the Arduino sketch for the implementation. Because there are only two ports we haven't bothered creating a whole C++ class to deal with them.
All functions related to decoding and sending IR signals.
Motor control class - provides standard functions for interfacing with multiple different “motor” types, such as serial controllers, onboard motor drivers, servos, etc… Specific motor objects (such as “left tread” or “smoker”) are instantiations of these objects made in the sketch (primarily in the ObjectSetup tab).
PCCommm stands for “PC communication.” All functions for communicating with the OP_Config program.
A class for interfacing with Pololu Qik serial motor controllers.
Decodes PPM radio data.
All functions for detecting and reading the RC radio signal, managing failsafe, etc… Relies on OP_IBusDecode, OP_SBusDecode or OP_PPMDecode to do the decoding, depending on which type of signal it detects.
A class for interfacing with Dimension Engineering Sabertooth serial motor controllers.
Decodes FrSky SBus radio data on Serial port 3.
Low-level handling of the 8 servo outputs and the generation of their signals.
A single h file with various important low level definitions such as those for pin mapping and timers. Also in this folder resides a “Version_History.txt” file with notes about each release.
A modified and corrected version of the SimpleTimer library originally written by Marcello Romani. Provides invaluable timing functions which are used extensively throughout the project and by many of the other libraries.
Wrapper class for interfacing with external sound cards. This is where you will also find the experimental OP_SoundCard class to be used with a future Open Panzer sound card that is still under development. For specific functions related to the Benedini sound card see OP_TBS below.
Here are many functions specific to the operation of a tank, mostly related to battling. Weight class, firing the cannon including control of the airsoft or mechanical recoil unit, sending IR, handling incoming hits, blinking the IR indicator lights in the apple, applying battle “damage” (speed reductions), the machine gun, repairs and more are all handled in the Tank class.
Class for interfacing with the Benedini TBS Mini sound card using three servo signals.