Skip to content

Commit d463044

Browse files
Initial commit.
0 parents  commit d463044

25 files changed

+982
-0
lines changed

.gitignore

+160
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
# Created by https://www.gitignore.io/api/c++,java,linux,macos,gradle,windows,visualstudiocode
2+
3+
### C++ ###
4+
# Prerequisites
5+
*.d
6+
7+
# Compiled Object files
8+
*.slo
9+
*.lo
10+
*.o
11+
*.obj
12+
13+
# Precompiled Headers
14+
*.gch
15+
*.pch
16+
17+
# Compiled Dynamic libraries
18+
*.so
19+
*.dylib
20+
*.dll
21+
22+
# Fortran module files
23+
*.mod
24+
*.smod
25+
26+
# Compiled Static libraries
27+
*.lai
28+
*.la
29+
*.a
30+
*.lib
31+
32+
# Executables
33+
*.exe
34+
*.out
35+
*.app
36+
37+
### Java ###
38+
# Compiled class file
39+
*.class
40+
41+
# Log file
42+
*.log
43+
44+
# BlueJ files
45+
*.ctxt
46+
47+
# Mobile Tools for Java (J2ME)
48+
.mtj.tmp/
49+
50+
# Package Files #
51+
*.jar
52+
*.war
53+
*.nar
54+
*.ear
55+
*.zip
56+
*.tar.gz
57+
*.rar
58+
59+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
60+
hs_err_pid*
61+
62+
### Linux ###
63+
*~
64+
65+
# temporary files which can be created if a process still has a handle open of a deleted file
66+
.fuse_hidden*
67+
68+
# KDE directory preferences
69+
.directory
70+
71+
# Linux trash folder which might appear on any partition or disk
72+
.Trash-*
73+
74+
# .nfs files are created when an open file is removed but is still being accessed
75+
.nfs*
76+
77+
### macOS ###
78+
# General
79+
.DS_Store
80+
.AppleDouble
81+
.LSOverride
82+
83+
# Icon must end with two \r
84+
Icon
85+
86+
# Thumbnails
87+
._*
88+
89+
# Files that might appear in the root of a volume
90+
.DocumentRevisions-V100
91+
.fseventsd
92+
.Spotlight-V100
93+
.TemporaryItems
94+
.Trashes
95+
.VolumeIcon.icns
96+
.com.apple.timemachine.donotpresent
97+
98+
# Directories potentially created on remote AFP share
99+
.AppleDB
100+
.AppleDesktop
101+
Network Trash Folder
102+
Temporary Items
103+
.apdisk
104+
105+
### VisualStudioCode ###
106+
.vscode/*
107+
!.vscode/settings.json
108+
!.vscode/tasks.json
109+
!.vscode/launch.json
110+
!.vscode/extensions.json
111+
112+
### Windows ###
113+
# Windows thumbnail cache files
114+
Thumbs.db
115+
ehthumbs.db
116+
ehthumbs_vista.db
117+
118+
# Dump file
119+
*.stackdump
120+
121+
# Folder config file
122+
[Dd]esktop.ini
123+
124+
# Recycle Bin used on file shares
125+
$RECYCLE.BIN/
126+
127+
# Windows Installer files
128+
*.cab
129+
*.msi
130+
*.msix
131+
*.msm
132+
*.msp
133+
134+
# Windows shortcuts
135+
*.lnk
136+
137+
### Gradle ###
138+
.gradle
139+
/build/
140+
141+
# Ignore Gradle GUI config
142+
gradle-app.setting
143+
144+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
145+
!gradle-wrapper.jar
146+
147+
# Cache of project
148+
.gradletasknamecache
149+
150+
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
151+
# gradle/wrapper/gradle-wrapper.properties
152+
153+
# # VS Code Specific Java Settings
154+
.classpath
155+
.project
156+
.settings/
157+
bin/
158+
159+
160+
# End of https://www.gitignore.io/api/c++,java,linux,macos,gradle,windows,visualstudiocode

.vscode/launch.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
8+
{
9+
"type": "wpilib",
10+
"name": "WPILib Desktop Debug",
11+
"request": "launch",
12+
"desktop": true,
13+
},
14+
{
15+
"type": "wpilib",
16+
"name": "WPILib roboRIO Debug",
17+
"request": "launch",
18+
"desktop": false,
19+
}
20+
]
21+
}

.vscode/settings.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"java.configuration.updateBuildConfiguration": "disabled",
3+
"java.import.gradle.enabled": false,
4+
"files.exclude": {
5+
"**/.git": true,
6+
"**/.svn": true,
7+
"**/.hg": true,
8+
"**/CVS": true,
9+
"**/.DS_Store": true,
10+
"bin/": true,
11+
".classpath": true,
12+
".project": true
13+
},
14+
"C_Cpp.default.configurationProvider": "vscode-wpilib"
15+
}

.wpilib/wpilib_preferences.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"enableCppIntellisense": true,
3+
"currentLanguage": "cpp",
4+
"projectYear": "2019",
5+
"teamNumber": 1721
6+
}

CODESTYLE.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
2+
# PhyxtGears 2019 Codestyle Standards
3+
All programmers for First Robotics Competition Team 1720 (a.k.a. PhyxtGears) must adhere to this style of programming for the 2019 FRC competition season.
4+
5+
### Terms
6+
Useful terms to understand while reading.
7+
* Declaration: telling the compiler that a variable exists, but not giving it an associated value.
8+
* Definition: declaring a variable and initializing it.
9+
* DEFINITION = DECLARATION + VALUE
10+
* Be careful, some data types get default initialization values when declared.
11+
12+
# C++
13+
### General rules
14+
* 4 Space indentation. Spaces, no tabs.
15+
* Function declaration and definition has a space between the name and open parentheses.
16+
* Example: `void Robot::RobotInit();` or
17+
```cpp
18+
void Robot::RobotInit() {
19+
cout << "Hello World!" << endl;
20+
}
21+
```
22+
* This is to distinguish between using a function from a function declaration/definition.
23+
* Use the C++ standard "iostream" library for output.
24+
* `using namespace std;` is required.
25+
* Example: `cout << "stuff" << endl;`.
26+
* Do not use `cin`.
27+
* 80 character line limit.
28+
* Line up associated variables by equal sign when declaring.
29+
* See reference [1].
30+
31+
### Shuffleboard
32+
Shuffleboard is the C++ and Java equivalent of LabView's Dashboard functionality, it sends data back to the Driver Station for programmers and drivers to make use of by visualizing it in various ways. Due to how Shuffleboard functions inside code compared to Dashboard, there are rules that must be followed in order to effectively use it.
33+
* Layouts must be saved inside the project code folder in its root directory.
34+
* This is so that if we ever need to rollback changes, the layouts were the ones used during testing.
35+
* All widgets must be defined in `Robot::RobotInit()`, any widgets that require interaction between the robot and the dashboard must have a member variable reserved in "Robot.h" and defined in `Robot::RobotInit()`. Shuffleboard member variables should have the prefix `m_sbNameOfWidget`.
36+
* See reference [2].
37+
* All widgets created must go to either the "Autonomous" tab or the "TeleOperated" tab.
38+
* This does not automatically add the widgets to the offline layout, but to a temporary, unorganized dashboard under the same name. New widgets should be added to their appropriate tabs.
39+
40+
### Reference
41+
[1] Line up associated variables by equal sign:
42+
```cpp
43+
m_B_abcde = false;
44+
m_B_everything = 42;
45+
m_B_short = "Short!";
46+
```
47+
[2] Define and use Shuffleboard data.
48+
```cpp
49+
void Robot::RobotInit() {
50+
/* Autonomous Dashboard Stuffs */
51+
frc::ShuffleboardTab& autoboard = frc::Shuffleboard::GetTab("Autonomous");
52+
autoboard.Add("TestBool", false);
53+
autoboard.Add("TestString", "foo bar baz qux");
54+
m_sbFloater = autoboard.Add("Floater", 42.0).GetEntry(); // type = nt::NetworkTableEntry
55+
56+
/* TeleOperated Dashboard Stuffs */
57+
frc::ShuffleboardTab& teleboard = frc::Shuffleboard::GetTab("TeleOperated");
58+
m_sbWoot = teleboard.Add("woot", 42).GetEntry();
59+
m_sbSintest = teleboard.Add("SinTest", 0.0).GetEntry();
60+
}
61+
62+
float rads = 0;
63+
void Robot::TeleopPeriodic() {
64+
rads += 0.01;
65+
m_sbSintest.SetDouble(sin(rads));
66+
}
67+
```

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# PhyxtGears1720 - Robot Code for 2019
2+
Copyright (c) PhyxtGears1720 2019
3+
4+
## Please read CODESTYLE.md

build.gradle

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
plugins {
2+
id "cpp"
3+
id "google-test-test-suite"
4+
id "edu.wpi.first.GradleRIO" version "2019.2.1"
5+
}
6+
7+
// Define my targets (RoboRIO) and artifacts (deployable files)
8+
// This is added by GradleRIO's backing project EmbeddedTools.
9+
deploy {
10+
targets {
11+
roboRIO("roborio") {
12+
// Team number is loaded either from the .wpilib/wpilib_preferences.json
13+
// or from command line. If not found an exception will be thrown.
14+
// You can use getTeamOrDefault(team) instead of getTeamNumber if you
15+
// want to store a team number in this file.
16+
team = frc.getTeamNumber()
17+
}
18+
}
19+
artifacts {
20+
frcNativeArtifact('frcCpp') {
21+
targets << "roborio"
22+
component = 'frcUserProgram'
23+
// Debug can be overridden by command line, for use with VSCode
24+
debug = frc.getDebugOrDefault(false)
25+
}
26+
// Built in artifact to deploy arbitrary files to the roboRIO.
27+
fileTreeArtifact('frcStaticFileDeploy') {
28+
// The directory below is the local directory to deploy
29+
files = fileTree(dir: 'src/main/deploy')
30+
// Deploy to RoboRIO target, into /home/lvuser/deploy
31+
targets << "roborio"
32+
directory = '/home/lvuser/deploy'
33+
}
34+
}
35+
}
36+
37+
// Set this to true to include the src folder in the include directories passed
38+
// to the compiler. Some eclipse project imports depend on this behavior.
39+
// We recommend leaving this disabled if possible. Note for eclipse project
40+
// imports this is enabled by default. For new projects, its disabled
41+
def includeSrcInIncludeRoot = false
42+
43+
// Set this to true to enable desktop support.
44+
def includeDesktopSupport = false
45+
46+
model {
47+
components {
48+
frcUserProgram(NativeExecutableSpec) {
49+
targetPlatform wpi.platforms.roborio
50+
if (includeDesktopSupport) {
51+
targetPlatform wpi.platforms.desktop
52+
}
53+
54+
sources.cpp {
55+
source {
56+
srcDir 'src/main/cpp'
57+
include '**/*.cpp', '**/*.cc'
58+
}
59+
exportedHeaders {
60+
srcDir 'src/main/include'
61+
if (includeSrcInIncludeRoot) {
62+
srcDir 'src/main/cpp'
63+
}
64+
}
65+
}
66+
67+
// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
68+
useLibrary(it, "wpilib")
69+
wpi.deps.vendor.cpp(it)
70+
}
71+
}
72+
testSuites {
73+
frcUserProgramTest(GoogleTestTestSuiteSpec) {
74+
testing $.components.frcUserProgram
75+
76+
sources.cpp {
77+
source {
78+
srcDir 'src/test/cpp'
79+
include '**/*.cpp'
80+
}
81+
}
82+
83+
useLibrary(it, "wpilib", "googletest")
84+
wpi.deps.vendor.cpp(it)
85+
}
86+
}
87+
}

gradle/wrapper/gradle-wrapper.jar

54.4 KB
Binary file not shown.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=permwrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=permwrapper/dists

0 commit comments

Comments
 (0)