add activity diagrams

This commit is contained in:
Yohan Simard 2021-03-12 13:50:16 +01:00
parent c2662209c4
commit be3d1a588f
8 changed files with 147 additions and 0 deletions

View file

@ -0,0 +1,33 @@
@startuml
skinparam monochrome true
start
while ()
:startRobot?;
:err = robot.Open();
if (err) then (robot_ok)
:msgSend = new Message(MESSAGE_ANSWER_ACK);
else
:msgSend = new Message(MESSAGE_ANSWER_NACK);
endif
:messageToMon!msgSend;
if (watchdogMode) then (WITH_WATCHDOG)
:msgSend = robot.Write(new Message(MESSAGE_ROBOT_START_WITH_WD));
else (WITHOUT_WATCHDOG)
:msgSend = robot.Write(new Message(MESSAGE_ROBOT_START_WITHOUT_WD));
endif
if (msgSend->getId()) then (MESSAGE_ANSWER_ACK)
:robotStarted = true;
endif
:messageToMon!msgSend;
:stopRobot?
:ordre = STOP_MOVE;
:robot.Close();
endwhile
stop
@enduml

24
conception/th_move.txt Normal file
View file

@ -0,0 +1,24 @@
@startuml
skinparam monochrome true
start
:counter = 0;
:start_period(100 ms);
while ()
:wait_next_period();
if (robotStarted) then (true)
:msgSend = robot.Write(new Message(move));
if (msgSend->getId()) then (MESSAGE_ANSWER_ACK)
:counter = 0;
:robotStarted = true;
else (MESSAGE_ANSWER_ROBOT_TIMEOUT || \nMESSAGE_ANSWER_ROBOT_UNKNOWN_COMMAND || \nMESSAGE_ANSWER_ROBOT_ERROR)
:counter++;
if (counter) then (3)
:stopRobot!;
:monitor.write(Message(MESSAGE_ANSWER_COM_ERROR));
else ()
endif
endif
endif
endwhile
stop
@enduml

View file

@ -0,0 +1,52 @@
@startuml
skinparam monochrome true
start
:serverOk?;
while ()
:msgRcv = monitor.Read();
if (msgRcv.CompareID(MESSAGE_MONITOR_LOST)) then (true)
:printf("Connection avec le moniteur perdue");
:stopCamera!;
:stopRobot!;
:stopServer!;
endif
if (msgRcv.CompareID(MESSAGE_ROBOT_COM_OPEN)) then (true)
:openComRobot!;
endif
if (msgRcv.CompareID(MESSAGE_ROBOT_START_WITHOUT_WD)) then (true)
:startRobotWithoutWd!;
endif
if (msgRcv.CompareID(MESSAGE_ROBOT_START_WITH_WD)) then (true)
:startRobotWithWd!;
endif
if (msgRcv.CompareID(MESSAGE_ROBOT_GO_FORWARD
|| msgRcv.CompareID(MESSAGE_ROBOT_GO_BACKWARD
|| msgRcv.CompareID(MESSAGE_ROBOT_GO_LEFT
|| msgRcv.CompareID(MESSAGE_ROBOT_GO_RIGHT
|| msgRcv.CompareID(MESSAGE_ROBOT_STOP)) then (true)
:move = msg.GetId();
endif
if (msgRcv.CompareID(MESSAGE_CAM_OPEN)) then (true)
:startCamera!;
endif
if (msgRcv.CompareID(MESSAGE_CAM_CLOSE)) then (true)
:stopCamera!;
endif
if (msgRcv.CompareID(MESSAGE_CAM_ASK_ARENA)) then (true)
:searchArena!;
endif
if (msgRcv.CompareID(MESSAGE_CAM_ARENA_CONFIRM)) then (true)
:validateArena!;
endif
if (msgRcv.CompareID(MESSAGE_CAM_ARENA_INFIRM)) then (true)
:cancelArena!;
endif
if (msgRcv.CompareID(MESSAGE_CAM_POSITION_COMPUTE_START)) then (true)
:startPosition!;
endif
if (msgRcv.CompareID(MESSAGE_CAM_POSITION_COMPUTE_STOP)) then (true)
:stopPosition!;
endif
endwhile
stop
@enduml

View file

View file

@ -0,0 +1,15 @@
@startuml
skinparam monochrome true
start
:start_period(500 ms);
while ()
:wait_next_period();
if(robotStarted)then(true)
:msgSend=robot.Write(robot.getBattery());
:messageToMon!msgSend;
endif
endwhile
stop
@enduml

View file

View file

@ -0,0 +1,10 @@
@startuml
skinparam monochrome true
start
:serverOK?;
while ()
:messageToMon?msg;
:monitor.Write(msg);
endwhile
stop
@enduml

13
conception/th_server.txt Normal file
View file

@ -0,0 +1,13 @@
@startuml
skinparam monochrome true
start
:status = monitor.Open();
if (status) then (failed)
:print("Unable to start server");
stop
else (succeed)
:monitor.AcceptClient();
:serverOk!;
stop
endif
@enduml