diff --git a/conception/th_manageRobot.txt b/conception/th_manageRobot.txt new file mode 100644 index 0000000..40bde76 --- /dev/null +++ b/conception/th_manageRobot.txt @@ -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 diff --git a/conception/th_move.txt b/conception/th_move.txt new file mode 100644 index 0000000..569f665 --- /dev/null +++ b/conception/th_move.txt @@ -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 diff --git a/conception/th_receiveFromMon.txt b/conception/th_receiveFromMon.txt new file mode 100644 index 0000000..c7bb9bf --- /dev/null +++ b/conception/th_receiveFromMon.txt @@ -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 diff --git a/conception/th_searchArena.txt b/conception/th_searchArena.txt new file mode 100644 index 0000000..e69de29 diff --git a/conception/th_sendBatteryLevel.txt b/conception/th_sendBatteryLevel.txt new file mode 100644 index 0000000..2cc6768 --- /dev/null +++ b/conception/th_sendBatteryLevel.txt @@ -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 diff --git a/conception/th_sendImage.txt b/conception/th_sendImage.txt new file mode 100644 index 0000000..e69de29 diff --git a/conception/th_sendToMon.txt b/conception/th_sendToMon.txt new file mode 100644 index 0000000..80f0634 --- /dev/null +++ b/conception/th_sendToMon.txt @@ -0,0 +1,10 @@ +@startuml +skinparam monochrome true +start +:serverOK?; +while () + :messageToMon?msg; + :monitor.Write(msg); +endwhile +stop +@enduml diff --git a/conception/th_server.txt b/conception/th_server.txt new file mode 100644 index 0000000..c3e8850 --- /dev/null +++ b/conception/th_server.txt @@ -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