-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppSequence.puml
131 lines (107 loc) · 3.38 KB
/
AppSequence.puml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
@startuml LeaderAppSequenceDiagram
autoactivate on
Title Leader App Sequence Diagram
participant "App" as App
participant "State Machine" as SM
participant "SMP Server" as Smp
participant "V2V Client" as Mqtt
participant "Remote Command Response Handler" as RCRH
participant "Startup State" as StartupState
participant "Driving State" as DrivingState
participant "Safety Monitor" as SafetyMonitor
entity "RadonUlzer" as RU
== State Machine: Startup State ==
group Startup Commands [Repeats for each pending command]
App -> SM : process()
SM -> StartupState : process()
return
return
App -> StartupState : getPendingCommand(Command& cmd) : bool
StartupState -> SM: inCorrectState()
return true
return pending command is valid
App -> Smp : sendCommand(cmd) : bool
Smp -> RU : send
deactivate
return command sent
RU -->> Smp : response
App -> Smp : process()
Smp -> App : CMD_RSP callback
App -> RCRH : handleCommandResponse(rsp)
RCRH -> StartupState : notify(Event event)
return
RCRH -> DrivingState : setMaxSpeed(speed)
return
return
return
return
end group
App -> SM : process()
SM -> StartupState : process()
StartupState -> SM : setState(IdleState)
return
return
return
== State Machine: Idle State ==
group Wait for release
App -> Mqtt : process()
Mqtt -> App : cmdCallback(releaseCmd)
App -> Smp : sendCommand(releaseCmd)
Smp -> RU : send
deactivate
return
return
return
RU -->> Smp : response
App -> Smp : process()
Smp -> App : CMD_RSP callback
App -> RCRH : handleCommandResponse(OK)
RCRH -> SM : setState(DrivingState)
return
return
return
return
end group
== State Machine: Driving State ==
group Driving
App -> Smp : process()
Smp -> App : currentVehicleDataCallback(CurrentVehicleData data)
App -> DrivingState : calculateTopMotorSpeed(const Waypoint& currentVehicleData): int16_t
DrivingState -> SM : inCorrectState()
return true
return top speed
App -> Smp : sendSpeed(topSpeed)
Smp -> RU : send
deactivate
return
return
return
App -> Mqtt : process()
Mqtt -> App : lastFollowerFeedbackCallback()
App -> DrivingState : setLastFollowerFeedback(const Waypoint& feedback)
return
return
return
App -> DrivingState : getLatestVehicleData(Waypoint& vehicleData)
DrivingState -> SM : inCorrectState()
return true
return vehicle data is valid
App -> Mqtt : sendWaypoint(const Waypoint& vehicleData)
return
end group
== Stateless ==
loop
App -> Smp : process()
Smp -> App : Heartbeat callback
App -> SafetyMonitor : heartbeatCallback()
return
return
return
App -> SafetyMonitor : process()
SafetyMonitor -> SafetyMonitor : checkHeartbeat()
return false
SafetyMonitor -> SM : setState(ErrorState)
return
return
end loop
@enduml