Code standards - NUbots/robocup GitHub Wiki

Units

The metric units used in the code are as follows.

Measurement Units Symbol
Distance Centimeter cm
Velocity Centimeters per second cm·s-1
Acceleration Centimeters per second2 cm·s-2
Angle Radians rad
Anglular Velocity Radians per second rad·s-1
Anglular Acceleration Radians per second2 rad·s-2
Force Newtons N
Temperature Degrees Celcius °C
Gain Percentage %
Voltage Volts V
Current Amperes A
Power Watts W
Energy Joules J

Doxygen

Single line brief Doxygen comments for variable have the form:
//!< A brief description for variable

Longer Doxygen comments have the form:
/*! My longer comment */

A function should be documented:

/*! @brief Description of function

    Long description of the function.
 
    @param variable description of input
    @return description of return value
 */

Every file should have the following Doxygen header:

/*! @file filename.h
    @brief A brief description of file
 
    @class ClassName
    @brief A brief description of ClassName
 
    A longer description of the class. This is optional, but should be included.

    @author Jason Kulk
 
  Copyright (c) 2009 Jason Kulk
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This file is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with NUbot.  If not, see <http://www.gnu.org/licenses/>.
*/
⚠️ **GitHub.com Fallback** ⚠️