1
+ @startuml DcsClassDiagram
2
+
3
+ Title DCS Class Diagram
4
+
5
+ class "Application" as app {
6
+ + setup () : void
7
+ + loop () : void
8
+ + release () : void
9
+ - m_serialMuxProtServer : SMPServer
10
+ - m_systemStateMachine : StateMachine
11
+ - m_remoteControlHandler : RemoteControlHandler
12
+ - m_safetyMonitor : SafetyMonitor
13
+ }
14
+
15
+ note right of app
16
+ Callbacks for SerialMuxProtServer and MqttClient are defined here.
17
+ Uses the setters of each class or state to forward the data.
18
+ Uses the getters of each class or state to get the data that shall be sent to the RU or the V2V controller.
19
+ end note
20
+
21
+ class "V2V Controller" as v2v {
22
+ - m_mqttClient : MqttClient
23
+ - m_rxWaypointQueue : Queue
24
+ + init(MqttConfig) : bool
25
+ + process () : bool
26
+ + sendWaypoint(const Waypoint&) : bool
27
+ + getWaypoint(Waypoint&) : bool
28
+ }
29
+
30
+ class StateMachine <<control>> {
31
+ + setState(state : IState*) : void
32
+ + getState() : IState*
33
+ + process () : void
34
+ }
35
+
36
+ class "RemoteCommandResponseHandler" as smpHandler {
37
+ + processResponse(const CommandResponse&) : void
38
+ }
39
+
40
+ note right of smpHandler
41
+ This class is responsible for handling
42
+ the response from the remote command
43
+ sent to RU.
44
+ - Notifies StartupState of successful commands.
45
+ - Sets max speed in DrivingState.
46
+ end note
47
+
48
+ class "SafetyMonitor" as safety {
49
+ + process(StateMachine& sm) : void
50
+ + getPendingHeartbeat(const Hearbeat& hb) : bool
51
+ + heartbeatCallback(const Hearbeat& hb) : void
52
+ }
53
+
54
+ interface IState {
55
+ + {abstract } entry () : void
56
+ + {abstract } process (sm : StateMachine &) : void
57
+ + {abstract } exit () : void
58
+ }
59
+
60
+ class StartupState <<Singleton >>
61
+ {
62
+ + getPendingCommand (Command & cmd ) : bool
63
+ + notify (Event event ) : void
64
+ }
65
+
66
+ class IdleState <<Singleton >>
67
+
68
+ class DrivingState <<Singleton>> {
69
+ - m_longitudinalController : LongitudinalController
70
+ + setMaxMotorSpeed(int16_t maxMotorSpeed) : void
71
+ + calculateTopMotorSpeed(const Waypoint& currentVehicleData): int16_t
72
+ + setLastFollowerFeedback(const Waypoint& feedback) : void
73
+ + getLatestVehicleData(Waypoint& vehicleData) : bool
74
+ }
75
+
76
+ protocol "SerialMuxChannels" as smpch {
77
+ + typedef SerialMuxProtServer <MAX_CHANNELS > SMPServer
78
+ + struct Command
79
+ + struct CommandReponse
80
+ + struct SpeedData
81
+ + struct VehicleData
82
+ }
83
+
84
+ app *--> v2v
85
+ app *--> StateMachine
86
+ app *--> smpHandler
87
+ app *--> safety
88
+ app ..> DrivingState : <<use>>
89
+ app ..> StartupState : <<use>>
90
+ app ..> smpch : <<use>>
91
+
92
+ StateMachine o--> "0.. 1 " IState
93
+
94
+ IState <|.. StartupState : <<realize>>
95
+ IState <|.. IdleState : <<realize>>
96
+ IState <|.. DrivingState : <<realize>>
97
+ IState <|.. ErrorState : <<realize>>
98
+
99
+ smpHandler ..> StartupState : <<use>>
100
+ smpHandler ..> DrivingState : <<use>>
101
+
102
+ @enduml
0 commit comments