FDCL Param Class
|
This library provides a C++ tool to read parameters from a text file, or save them to a text file.
The format of the compatible text file is illustrated by the following sample file saved as fdcl.cfg
The name of the parameter is composed of the group name, and the variable name. For example, in the above file, UAV
is the group name and m
is the variable name.
More precisely, if the new line begins with letters without any space, the letters before :
are considered as the group. Or, if the new line begins with space
(tab
works too), the the letters between space
and :
are considered as the variable.
The parameter name is constructed by concatenating group and variable. Note that the variable names can be repeated if they do not belong to the same group.
The followig types are suppored for the parameter value:
Note the string parameter should be nested in " "
. For an eigen matrix, each row is concetanted in a single line, where each element is separated by ,
For example, in the above configuration file, the 3x3 matrix J is defined as
in the Matlab notation.
The usuage of the library is illustrated by the following sample code.
The package supports Eigen matrices for save and read functions, which are declared as template functions. Therefore, those functions must be explicitly instantiated according to the particular type of the Eigen matrices used.
For example, the above example uses the Eigen marix type Eigen::Matrix<double, 3, 3>
, and at the end of fdcl_param.cpp
the following explicit istantiattion are included:
When using other types or sizes of Eigen matrices, the corresponding instantiations must be included at the end of param.cpp
To add this to class to your code, using CMake and cloning it as a git submodule is recommended. This instructions assumes that you are going to add your submodules to a directory named libraries
in the main project directory. If your submodule directory is different, make sure to change the path wherever it says libraries
. First, add this as a submodule in git.
NOTE: Whenever you clone your main project, you must recursively update the submodules:
Now, in the main project's CMake file (CMakeLists.txt), do the followings:
Also, whenever you make a file that uses fdcl_param class, add fdcl_param
to the linker:
Then, you can simply call #include "fdcl/param.hpp"
in your source/header files in the main directory.
Document generation is done with Doxygen If you do not have Doxygen, install it first
Use Doxygen to generate the documentation
This will generate the documentation. Commit and push to update the online documentation. back to contents