Skip to content

Requirements

Ishan Khatri edited this page Jan 27, 2018 · 1 revision

Requirements

These requirements have changed slightly and this document is simply for reference. For proper documentation please see the home page of the wiki.

  1. Configuration files shall consist of sets of Lua files that allow for the definition of typed configuration parameters
  2. The configuration files should allow for parameters to be defined across multiple files and allow for multiple sub trees within a table
    • Importing one config file into another config file is part of that goal
  3. The parameters must be typed. The types currently in use within our C++ Constants file are:
    • int
    • unsigned int
    • float
    • double
    • string
    • Eigen::Vector2f
  4. Macros shall be defined in C++ that allow for the declaration of new parameters
    • This should have the rough macro signature of: DeclareConfigValue(key, subtree_name, bounds)
    • bounds are the lower and upper bounds of a parameter and should be optional. We should be able to define parameters with no bounds, with only a lower bound, only an upper bound or with both bounds
  5. A Configration Reader class shall be defined in C++
    • This class shall take a vector of file names in its constructor, representing a set of configuration files
    • This class shall load the configuration parameters from the files and store them
  6. A configuration file should be able to be passed into the program as a command line parameter
    • There should be a default filename as well
    • This may need to wait to be finalized until the command line reader system has been updated, but the current system does provide the base functionality
  7. There should be an error thrown at runtime if a parameter is not present within the configuration files.
  8. The parameters should update during runtime when a configuration file has been modified
    • A "dirty" flag should be added to the configuration reader such that a main function can know when it needs to be read again
    • When this flag is set to true, the main function will then update its local copy of the parameters

Example Lua config file:

-- Attacker sub-tree
Attacker = {
  aim_width = DegToRad(1.4);
  drive_offset = Vector2(0.1, 0.2);
};

if RobotID == 1 then
  drive_offset = Vector2(0.02, 0.03);
end

Lua API starting points:

Clone this wiki locally