This document contains framework, style, and check-in guidelines.
See the current documentation here.
Follow these guidelines to ensure consistency across our code.
- Initialize all private instance variables in constructors in roughly the same order they were declared in the header file.
- All header files should have
#define
guards
#ifndef FILE_NAME_H
#define FILE_NAME_H
...
#endif // SRC_FOLDER_FILE_NAME_H
#include
the header files in this order (if applicable):WPILib.h
, external libraries specific to robotics (likenavx/AHRS.h
), other header files in the order they appear in your source tree, and libraries specific to C++ (like<iostream>
)- Only
#include
the header files you need
- Declare pointers like
type *ptrName;
. If you're declaring more than one pointer, dotype *ptrName1, *ptrName2;
.
- Put the starting curly brace on the same line (like
Method() {
) - Try to group similar methods and variables together. Separate the groups with empty lines.
- In header files, generally methods go before variables
- Methods should be written in this order: Get, Set, Reset
Format:
switch (condition) {
case ABC:
statements;
break;
case DEF:
statements;
break;
default:
statements;
break;
}
-
Instance variables:
lowerCamelCase
-
Member instance variable: 'lowerCaseCamel_'. Don't forget the underscore!
-
Macros, consts (like ports):
CAPITAL_LETTERS
-
Methods and classes:
UpperCamelCase
-
Enum-list:
kInit
,kIdle
, etc. -
Abbreviate only when necessary
-
Class names should be nouns.
-
Accessor methods typically start with
Get
, mutator methods typically start withSet
.
All distances are in feet, all angles are in degrees. +x is forward, +y is left. This means that positive degrees are counterclockwise.
- Use
double
(notfloat
) for decimal values - Always use curly braces for if statements, for loops, etc.
Follow these guidelines for clarity and quality control.
Checklist:
- Are you only checking in the files you changed? Make sure to check the diffs between your code and the code in the repo.
- Does the code compile?
- Have you added descriptive and concise comments to your code?
- Does the code comply with our style guidelines?
- Has a leader and/or mentor checked your code?
- Have you written a descriptive commit message with the following details?:
- The changes you made
- Whether you tested the code and how it ran on the robot
- Next steps / what needs to be done on the code
- Sign your name, the names of people working with you, and the person/people who checked your code.
- ssh into roboRIO.
- cd /home/lvuser
- ls ---> lists files
- vi robot.ini ---> you can modify this file by typing "i" (for insert). When you're done, hit escape and then ":wq" (saves and quits)