chronos/gallery/plantuml_test.typ

271 lines
4.5 KiB
Plaintext
Raw Permalink Normal View History

2024-10-08 09:46:44 +00:00
#import "../src/lib.typ": from-plantuml
#set page(width: auto, height: auto)
/*
#from-plantuml(```
@startuml
actor User as usr
participant can_message as can
control kartculator as kc
queue XF as xf
entity Drive as drive
entity Steering as steering
usr -\ xf : set message "move"
xf -> can : new value on joystick
== If X axis change value ==
can -> kc : calculate new position
kc -> can : build message
can -> steering : set new position
== If Y axis change value ==
can -> kc : calculate new torque
kc -> can : build message
can -> xf : set message "torque"
xf -> drive : set new torque
@enduml
```)
#pagebreak(weak: true)
#from-plantuml(```
@startuml
actor CAN_BUS as bus
participant interrupt as ISR
queue XF as xf
participant ecan as ecan
participant canInterface as can
control canMessageController as msg
bus -\\ ISR ++ : can message
ISR -> can : newMsg
can -> ecan : read
ecan --> can : message
can -> xf : POST XF
destroy ISR
group TICK XF
xf o-> can : receiveCan()
can -> msg : processIncoming()
msg -> can : create message
can -> xf : POST XF
end
group TICK XF
xf o-> can : sendCan()
can -> ecan : write
ecan -\\ bus : can message
end
@enduml
```)
#pagebreak(weak: true)
*/
/*
#from-plantuml(```
@startuml
participant "Behavior::StateMachine" as sm
participant Dispatcher as d
participant TimeoutManager as tm
entity "Event::Timeout" as t
queue "TimeoutManager::timeouts_" as timeouts
autoactivate off
|||
|||
== Schedule timeout ==
|||
sm -> sm++ : scheduleTimeout
sm -> d ++: getDispatcher
d --> sm --: dispatcher
sm -> d --++ : scheduleTimeout
d -> tm ++: getTimeoutManager
tm --> d --: timeoutManager
d -> tm --++ : scheduleTimeout
tm -> t ** : new
t --> tm
tm -> timeouts --++: insert
|||
|||
== Decrement timeout (and dispatch) ==
|||
loop every tickInterval
?->> tm ++: tick
tm -> timeouts : getFront
timeouts -> t ++
t --> timeouts
timeouts --> tm : timeout
tm -> t --: decrement
end
|||
note left t
When timeout is 0,
dispatch event
end note
t -> timeouts : pop
deactivate timeouts
t ->? --: pushEvent
|||
|||
== Unschedule timeout ==
|||
sm -> sm++ : unscheduleTimeout
sm -> d ++: getDispatcher
d --> sm --: dispatcher
sm -> d --++ : unscheduleTimeout
d -> tm ++: getTimeoutManager
tm --> d --: timeoutManager
d -> tm --++ : unscheduleTimeout
tm -> timeouts --: erase
timeouts -> t !!
@enduml
```)
*/
#pagebreak(weak: true)
#from-plantuml(```
@startuml
participant Behavior as b
participant Dispatcher as d
entity Event as e
participant EventQueue as eq
queue "EventQueue::queue_" as q
== Create an Event ==
|||
?->> b ++ : GEN
b -> e ** : new
b -> b --++ : pushEvent
e -> b : getBehavior
b --> e ++: setBehavior
e --> b --
b -> d ++ : getDispatcher
d --> b
b -> d -- : pushEvent
d ->? -- : push
|||
|||
== Push Event ==
|||
?->> d ++: pushEvent
d -> eq--++: push
eq -> q ++
q --> eq
eq -> q -- : pushEndQueue
|||
|||
== Dispatch ==
|||
?->> d ++: executeOnce
d -> q : getFront
q -> e ++
e --> q
q --> d : event
d -> q : pop
deactivate q
d -> d --++ : dispatchEvent
d -> b ++ : getBehavior
b --> d
d -> b -- : process
b -> b--: processEvent
destroy e
@enduml
```)
#pagebreak(weak: true)
#from-plantuml(```
@startuml
'https://plantuml.com/sequence-diagram
actor User as usr
participant "Pb L" as pbL
participant "Pb R" as pbR
participant "LED L" as ledL
participant "LED R" as ledR
== Single click ==
group Single click left
usr -\ pbL ++: pressButton
usr -\ pbL : releaseButton
pbL -> ledL --++ : blink
usr -\ pbL ++: pressButton
usr -\ pbL : releaseButton
pbL -> ledL -- : endBlink
deactivate ledL
end
group Single click right
usr -\ pbR ++: pressButton
usr -\ pbR : releaseButton
pbR -> ledR --++ : blink
usr -\ pbR ++: pressButton
usr -\ pbR : releaseButton
pbR -> ledR -- : endBlink
deactivate ledR
end
== Double click ==
group Double click left
usr -\ pbL ++: pressButton
usr -\ pbL : releaseButton
usr -\ pbL : pressButton
pbL -> ledL --++ : blink
note right ledL: blink 3x
ledL ->x ledL -- : finished
end
group Double click right
usr -\ pbR ++: pressButton
usr -\ pbR : releaseButton
usr -\ pbR : pressButton
pbR -> ledR --++ : blink
note right ledR: blink 3x
ledR ->x ledR -- : finished
end
== Long click ==
group Long click left
usr -\ pbL ++: pressButton
pbL -> ledR--: blink
activate ledL
activate ledR
usr -\ pbL ++: pressButton
pbL -> ledR -- : endBlink
deactivate ledL
deactivate ledR
end
group Long click right
usr -\ pbR ++: pressButton
pbR -> ledR--: blink
activate ledL
activate ledR
usr -\ pbL ++: pressButton
pbL -> ledR -- : endBlink
deactivate ledL
deactivate ledR
end
@enduml
```)