Skip to content

Commit

Permalink
Update THEORY.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MUmarShahbaz authored Aug 12, 2024
1 parent 4056f8d commit 8fe98b8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions THEORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

Now let's get into the theory of the code

### Difference between turn and rotate
## Difference between turn and rotate

First of all I need to clarify to you the difference between rotating and turning.<br> When turning you are moving forward and going either left or right. When rotating you are standing still and changing your direction.

![Difference between Turning and Rotating](/images/Turn%20&%20Rotate.png)

This is a very common rookie mistake, they rotate every time the car leaves the track. It is in fact true that the car will still follow the track but it will take more time and power. For small deviations it is best to turn instead of rotating which will save us time and momentum.

### Function-like behavior
## Function-like behavior
This code was written in such a way so that you can modify the accuracy based on two parameters, ```TurnSensitivity``` which can have any value from ```1 to 0```, and ```Max``` which can have any value from ```0 to 255```.

```TurnSensitivity``` is directly proportional to how much your car wobbles and inversely proportional to how much speed it has overall.<br>
By utilizing a very simple mathematical based approach it will modify the speed at which your car turns most of the time. The exception to this is when your car has offshooted. In that case you want your car to rotate at full speed instead so that it may find the track again instantly.

```Max``` is the maximum speed your car can have at any time. The value you give it will not be exceeded throughout the execution. 0 is no speed at all and 255 is full speed.
### Optimized control flow
## Optimized control flow
Let's take a look at the standard flow of code that you can find everywhere on YouTube<br>

![Standard control flow diagram](/images/Standard%20Control%20Flow.png)<br><br><br>
Expand Down

0 comments on commit 8fe98b8

Please sign in to comment.