- We use ClangFormat for S2E.
- We selected
Google
base style with small modifications. - Details are written in .clang-format.
- We selected
-
Now discussing
- The following rules are follows until the new naming rule is decided.
- Several old files do not follow the rules.
- We are discussing follow the Google C++ Style Guide with small modifications.
-
File and directory Name
snake_case
- C++ files should end in
.cpp
, and header files should end in.hpp
.
-
Macro (define)
- Snake case with capital case
SNAKE_CASE
-
Name of the class
CamelCase
-
Variable name
- Snake case with lower case
snake_case
-
Constant name (not a define but a constant)
- Add k at the beginning and the rest is CamelCase
kCamelCase
-
Member variables in the class
- Snake case with lower case end with
_
snake_case_
- Snake case with lower case end with
-
Methods (functions) in the class
CamelCase
-
The #define Guard
- Apply Google C++ Style Guide.
#pragma once
is prohibited
- Use Doxygen
- Use Markdown for Doxygen
- Examples:
- Comments
- Use //
- Basically, we follows the Naming Rules in the Google Style Guide
- Single character abbreviations are prohibited.
- Examples:
q = quaternion
,v = velocity
are prohibited.
- Examples:
- We do not recommend to use abbreviations for one word cutting the word.
- Examples:
pos = position
,quat = quaternion
are not recommended. - The following abbreviations are available as exceptions since they are widely used in the math, science, and technology field.
max
: maximummin
: minimuminit
: initial, initializecalc
: calculate, calculation
- Examples:
- Abbreviation only file name is not recommended.
- Examples
ode.hpp
should be written asordinary_differential_equation.hpp
gnssr.hpp
is not recommended, butgnss_receiver.hpp
is available since we can guess the abbreviation meaning from the context.
- Examples
- Write the full words in the comment when you use abbreviations.
- Available abbreviations are decided during review processes.
- Examples of available abbreviations with comments
EKF
: Extended Kalman FilterGNSS
: Global Navigation Satellite System
- Examples of available abbreviations with comments
- Abbreviations to show the frame and the unit are available.
- Examples of frame
i
: Inertial frameb
: Body fixed framec
: Component fixed frameecef
: Earth Centered Earth Fixed framelvlh
: Local Vertical Local Horizontalrtn
: Radial-Transverse-Normal
- Examples of unit:
Nm
,rad/s
,m/s2
,degC
- Examples of frame
- Available abbreviations
S2E
: Spacecraft Simulation EnvironmentAOCS
: Attitude and Orbit Control SystemCDH
: Command and Data Handling