You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/code-style-guide.md
+2-18Lines changed: 2 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ If you want to know more about our coding style you can take a look at our [clan
44
44
* All variable names are `lowercase_with_underscores`
45
45
```cpp
46
46
// Incorrect
47
-
floatcalculatedDistnace;
47
+
floatcalculatedDistance;
48
48
49
49
// Correct
50
50
float calculated_distance;
@@ -179,7 +179,7 @@ If you think some ASCII art will help explain something better, go for it! [asci
179
179
180
180
### Includes
181
181
182
-
* Use `#include` sparingly and only include the necessary sources to build the file. Do not include headers whos class or implementation is not used.
182
+
* Use `#include` sparingly and only include the necessary sources to build the file. Do not include headers whose class or implementation is not used.
183
183
* Often `.cpp` files include its corresponding header `.h` file, it means the `.cpp` file include everything included in the header. Do not have duplicate `#include`'s in both `.h` and `.cpp` files.
184
184
* `#include`s are generally preferred written on the `.cpp` side; use minimum `#include` in the header file. Use _forward declarations_ in headers if necessary.
185
185
* Specify full path of the include file on the file system, relative to the top-level project directory or _WORKSPACE_ file. Do not use relative paths.
@@ -273,22 +273,6 @@ private functions for a class/file that should not be exposed to users. impl can
273
273
// Correct
274
274
using PointsArray = std::vector<std::pair<int, int>>;
275
275
```
276
-
* Avoid initializing multiple variables on the same line.
277
-
```cpp
278
-
// Incorrect
279
-
int x, y, z = 0;
280
-
281
-
// Correct
282
-
int x;
283
-
int y;
284
-
int z = 0;
285
-
286
-
// However, the author may have intended the following
287
-
// or a code reader may have assumed the following
288
-
int x = 0;
289
-
int y = 0;
290
-
int z = 0;
291
-
```
292
276
* Avoid ternary operators. Clarity is more important than line count.
Copy file name to clipboardExpand all lines: docs/getting-started.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -357,15 +357,17 @@ Tracy also samples call stacks. If the profiled binary is run with root permissi
357
357
358
358
## Building for the robot
359
359
360
-
To build for the robot computer, build the target with the `--platforms=//cc_toolchain:robot` flag and the toolchain will automatically build using the ARM toolchain. For example, `bazel build --platforms=//cc_toolchain:robot //software/geom/...`.
360
+
To build for the robot computer, build the target with the `--platforms=//toolchains/cc:robot` flag and the toolchain will automatically build using the ARM toolchain. For example, `bazel build --platforms=//toolchains/cc:robot //software/geom/...`.
361
361
362
362
## Deploying Robot Software to the robot
363
363
364
364
We use Ansible to automatically update software running on the robot. [More info here.](useful-robot-commands.md#flashing-the-robots-compute-module)
365
365
366
366
To update binaries on a working robot, you can run:
Where `<platform>` is the robot platform you are deploying to (`PI` or `NANO`), and `<robot_ip>` is the IP address of the robot you are deploying to. The `robot_password` is the password used to login to the `robot` user on the robot.
371
373
@@ -388,7 +390,7 @@ It is possible to run Thunderloop without having a fully-working robot. Using th
388
390
389
391
2. If you have a robot PC that doesn't have proper communication with the power or motor board, you can still run Thunderloop in a limited capacity to test software features (eg. networking).
2. Find the `<robot_ip>` of the robot you want to run Thunderloop on. This guide may help you find the IP address of the robot: [Useful Robot Commands](useful-robot-commands.md#Wifi-Disclaimer).
Copy file name to clipboardExpand all lines: docs/software-architecture-and-design.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,7 +78,9 @@
78
78
79
79
# Architecture Overview
80
80
81
-
At a high-level, our system is split into several independent processes that [communicate with each other](#inter-process-communication). Our architecture is designed in this manner to promote decoupling of different features, making our system easier to expand, maintain, and test.
At a high-level, our system is split into several independent processes that [communicate with each other](#inter-process-communication). Our architecture is designed in this manner to promote decoupling of different features, making our software easier to expand, maintain, and test.
82
84
83
85
-[**Fullsystem**](#fullsystem) is the program that processes data and makes decisions for a [team](#team) of [robots](#robot). It manages [**Sensor Fusion**](#sensor-fusion), which is responsible for processing and filtering raw data, and the [**AI**](#ai) that makes gameplay decisions.
84
86
@@ -519,7 +521,7 @@ Once it is time to start the pass, the condition for the loop will become false
519
521
Once we have entered the second stage, we know we don't have to look at the first stage again. Because the coroutine "remembers" where the execution is each time the function is called, we will resume inside the second stage and therefore never execute the first stage again! This makes it much easier to write and read this strategy code, because we can clearly see the 2 stages of the strategy, and we know they will be executed in order.
520
522
521
523
### Coroutine Best Practices
522
-
Coroutines are a complex feature, and the boost coroutines we use don't always behave in was we expect. We have done extensive testing on how coroutines are safe (or not safe) to us, and derived some best practices from these examples. See [coroutine_test_exmaples.cpp](coroutine_test_examples.cpp) for the full code and more detailed explanantions.
524
+
Coroutines are a complex feature, and the boost coroutines we use don't always behave in was we expect. We have done extensive testing on how coroutines are safe (or not safe) to us, and derived some best practices from these examples. See [coroutine_test_examples.cpp](coroutine_test_examples.cpp) for the full code and more detailed explanantions.
523
525
524
526
To summarize, the best practices are as follows:
525
527
1. Avoid moving coroutines. If the absolutely must be moved, make sure they are not moved between the stack and heap.
@@ -550,7 +552,7 @@ Trajectories are generated by sampling intermediate *sub-destinations* around th
550
552
551
553
# Thunderscope
552
554
553
-
**Thunderscope**chiefly refers to the [GUI application](#thunderscope-gui) we use to visualize and interact with our robots and software. Some non-UI related functionality (namely, Robot Communication) is implemented as part of Thunderscope since it acts as a central point in our architecture, making it convenient for coordinating activities between different modules.
555
+
**Thunderscope** refers to the [GUI application](#thunderscope-gui) we use to visualize and interact with our robots and software. Some non-UI related functionality (namely, Robot Communication) is implemented as part of Thunderscope since it acts as a central point in our architecture, making it convenient for coordinating activities between different modules.
554
556
555
557
[`thunderscope_main.py`](/src/software/thunderscope/thunderscope_main.py) serves as the main entry point ("launcher") for our entire system. You can run the script to start up the [Thunderscope GUI](#thunderscope-gui) and a number of other optional processes, such as a [Fullsystem](#fullsystem) for each [AI](#ai) team, the [Simulator](#simulator), and [SSL Gamecontroller](#ssl-gamecontroller).
556
558
@@ -617,7 +619,7 @@ Our simulator is what we use for physics simulation to do testing when we don't
617
619
*[SSL-Vision](#ssl-vision) by publishing new vision data
618
620
* the robots by accepting new [Primitives](#primitives)
619
621
620
-
Using the current state of the simulated world, the simulator simulates the new [Primitives](#primitives) over some time step and publishes new SSL vision data based on the updated simulated world. Since the simulator interfaces with the our software over the network, it is essentially indistinguishible from robots receiving [Primitives](#primitives) and an [SSL-Vision](#ssl-vision) client publishing data over the network.
622
+
Using the current state of the simulated world, the simulator simulates the new [Primitives](#primitives) over some time step and publishes new SSL vision data based on the updated simulated world. Since the simulator interfaces with the our software over the network, it is essentially indistinguishable from robots receiving [Primitives](#primitives) and an [SSL-Vision](#ssl-vision) client publishing data over the network.
621
623
622
624
The simulation can also be configured with "realism" parameters that control the amount of noise added to vision detections, simulate missed vision detections and packet loss, and add artificial vision/processing delay, all with some degree of randomness.
623
625
@@ -650,7 +652,7 @@ A `Validation Function` comes in two types:
650
652
2. Non-terminating: Some condition that must be met for the entire duration of the test, i.e. "for all time". (*Eg. The ball never leaves the field or all friendly robots follows SSL rules*).
651
653
652
654
Benefits of `Validation Functions`:
653
-
1. They are reuseable. We can write a function that validates the ball never leaves the field, and use it for multiple tests.
655
+
1. They are reusable. We can write a function that validates the ball never leaves the field, and use it for multiple tests.
654
656
2. They can represent assertions for more complex behaviour. For example, we can build up simpler `Validation Functions` until we have a single `Validation` function for a specific [Tactic](#tactics).
655
657
3. They let us validate independent sequences of behaviour. For example, we create a different `ValidationFunction` for each [Robot](#robot) in the test. This makes it easy to validate each [Robot](#robot) is doing the right thing, regardless if they are dependent or independent actions.
0 commit comments