team401 / 2024-Robot-Code

Competition code for our 2024 robot
Other
7 stars 0 forks source link

Document Control Flows with Mermaid #34

Open PChild opened 9 months ago

PChild commented 9 months ago

Having control flow diagrams in the readme is really cool, could we use Mermaid to make them interactive / a little fancier instead of just screenshots?

Here are a couple of references:

And an example of a simple flow chart:

graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
honzikschenk commented 9 months ago

Can we transfer draw.io diagrams to mermaid?

jkleiber commented 9 months ago

@aidnem we can use this ticket for any documentation beyond the shooter

aidnem commented 9 months ago

@jkleiber Quick question about the preferred style for a logical or (||) to be drawn in. There are two options (as far as I can see):

  1. Displaying it in parallel (the previous step leads to both or conditions, which would lead to the 'yes'/'true' condition from both of them or back to the original state for the 'no'/'false') condition.
  2. Display it sequentially: The starting state leads to the first condition. The first condition, if true, leads to the true result. If false, the first condition leads to the second condition, which, if true, leads to the true result as well. If false, the second condition leads back to the original state. I am currently leaning toward option 2 (sequential), as it seems to more accurately represent the actual flow of the code. Both examples are demonstrated below:
    
    flowchart LR

subgraph parallel someState or1 or2 orResult someState --> or1 someState --> or2 or1{some_variable == SOME_VALUE} or1 -->|yes| orResult or1 -->|no| someState or2{something_else >= 2} or2 -->|yes| orResult or2 -->|no| someState orResult[Result of 'or' operation is true] end

subgraph sequential someState or1 or2 orResult someState --> or1 or1_{some_variable == SOMEVALUE} or1 -->|yes| orResult or1 -->|no| or2 or2{somethingelse >= 2} or2 -->|yes| orResult or2 -->|no| someState orResult[Result of 'or' operation is true] end

jkleiber commented 9 months ago

I'm going to leave this open for now so we can fix the small defects in the automatic text generated in files like https://github.com/team401/2024-Robot-Code/blob/main/doc/Scoring.md