Skip to content
Snippets Groups Projects
Commit 8cb5c801 authored by Adrien Lescourt's avatar Adrien Lescourt
Browse files

Add piece state machine doc

parent 511498a6
No related branches found
No related tags found
No related merge requests found
<mxfile host="app.diagrams.net" modified="2021-10-01T17:00:24.120Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.83 Safari/537.36" etag="X7S_uXiCLWks2JBqEszE" version="15.4.1" type="device"><diagram name="Page-1" id="58cdce13-f638-feb5-8d6f-7d28b1aa9fa0">5Vxbk6I4FP41/dhW7sBja7czW7W9M1Xu7OURJSo1KDbSt/n1GyQRSQRp5SK989ADJ8khnMuXc06CN3i0evsSuZvlY+jx4AYB7+0G398gZBMi/iaE95RACU0Ji8j3UhLMCBP/F5dEIKnPvse3uY5xGAaxv8kTZ+F6zWdxjuZGUfia7zYPg/xTN+6CG4TJzA1M6t++Fy8lFQKQNXzl/mIpH21T2TB1Zz8XUfi8ls9bh2uetqxcxUZ23S5dL3w9IOGHGzyKwjBOr1ZvIx4kUlUSS8eNC1r3U474Oq4yANto6sAppRBOPTC3biWHFzd4lmKQE43flVwEB6ECcTNcxqtA0KC4FC+ySdq3sRvFk9iNk/a5HwSjMAij3UAMdv+SznEU/uQHLfO5bNlJjXsZ01Q6SdMsXPkzeR24Ux4M92JWnHaCFo8N1/HYXflBYnh/8chz164kSyuDSN4fm50b+Iu1oM2EDLloHHp+JOzLDxPiNnxOVDg0Ba0kx6OYvx2QpOC/8HDF4+hddFGtWBrBu7qX/vGaWZvqsjywM0VzpX0v9pwzRYsLqevjep9/f3wcbYI/wfDp9unx7uurH97fsgq6X3t3iWsl4gnc7TbRyKEZZPpLJMk94VBycBjFy3ARrt3gIaNKMSb9Cg1YkoTgoxkvmT1UGOFGCx6XdUTH1RLxwI39l/xMjglZDv0e+mKOe3ViS1Mn1fSUvoEcdeiTGiMGTjBK39BgtNP5/n3ONwPLMIMfph0Ijf2eOGGic771f7nTXRPIm4PhSol3+AJi72T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QSa3TPQ61quJQt6EWIccd9OIjbkbdsa7ETj+nA8oRyDij2QYCsWupKBV94Fo/KLGCncoMlGyojhBcbyTEKnz8fN24U7mS3W38QwkYMAKEfUFgMUy1kwhAtCJIbIsxizBbO4xZPf0jAwthAmw7+TDEInmEcmwRq9sUQowwogxoT6kLsODHQiZil/ZvCLDQEbu/IDfMDnEYyeH4yMbbZ0oQWfk2XhKdOfbV17pYszX2qwLCbivrGA4YEwjo2IQ4CCisU0hosQFAlApfgxayLPUDER+GQoIHNrMoEPETZUhLDzCkAxtARAV/MQ31DWLDSNhK1YuZNfZLkO3H/7LoxU6X82sueimzzfF08sPPQT9xm/20Tto9++Ui/PAf</diagram></mxfile>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- Do not edit this file with editors other than diagrams.net -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="501px" height="362px" viewBox="-0.5 -0.5 501 362" content="&lt;mxfile host=&quot;app.diagrams.net&quot; modified=&quot;2021-10-01T17:01:49.302Z&quot; agent=&quot;5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.83 Safari/537.36&quot; etag=&quot;2gnUP50G2iihb7g0QLF6&quot; version=&quot;15.4.1&quot; type=&quot;device&quot;&gt;&lt;diagram name=&quot;Page-1&quot; id=&quot;58cdce13-f638-feb5-8d6f-7d28b1aa9fa0&quot;&gt;5Vxbk6I4FP41/dhW7sBja7czW7W9M1Xu7OURJSo1KDbSt/n1GyQRSQRp5SK989ADJ8khnMuXc06CN3i0evsSuZvlY+jx4AYB7+0G398gZBMi/iaE95RACU0Ji8j3UhLMCBP/F5dEIKnPvse3uY5xGAaxv8kTZ+F6zWdxjuZGUfia7zYPg/xTN+6CG4TJzA1M6t++Fy8lFQKQNXzl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IVgXEhAw0YKy8ywRPsmrYB3FBXMqCWO7O7nxFJW/s6TnZFR9m28UHJLZI/x9DNV5cpyxUU/98GzcU7mqJq17bas63SYUd5tlz9LI/APApQt+CiKhimeBCZRubyfDMFVvfVIMVS6JCf+77QbdN0mFbPGGqxfQ2KJ8WKesuLtLn12vGH90hPwtPdFCSghPM6fCG3pcVsYpA6CTikIJlSyEHGFhEbYCr0ABeZqctoI65kT6Bpr6uutiob/91XsGlFQoXfYFyZSBnJ1XtQDl2akq+MDsv+foolO9fXBmtVY7len8MWgBzeqT0Up4J9gbNaUHk0Ws0pxXKM30BnurppNUl8BBaE/AYjPSjrDUBD9H2OwkpBx6iAyJpA3jMEtQniSJpQU2q37jTbO6qHUYfj+Vh9C7QpuMwRy8Nn5uxYj2c0E8D1YQ2WCuKq+dWnhduA23MnLVKpU1+FGFU2pIQ6eN1toYQrNx3akW20/kxUGVNFfRePbBVOGfem4CKVYS4ovp8S0U5yxk4+QVwv5X94Tq+yQs3lM8x/RjZiXxO799OPmcemt/tKow+S3BVsDg3GFypPcH8gOYQSa3TPQ61quJQt6EWIccd9OIjbkbdsa7ETj+nA8oRyDij2QYCsWupKBV94Fo/KLGCncoMlGyojhBcbyTEKnz8fN24U7mS3W38QwkYMAKEfUFgMUy1kwhAtCJIbIsxizBbO4xZPf0jAwthAmw7+TDEInmEcmwRq9sUQowwogxoT6kLsODHQiZil/ZvCLDQEbu/IDfMDnEYyeH4yMbbZ0oQWfk2XhKdOfbV17pYszX2qwLCbivrGA4YEwjo2IQ4CCisU0hosQFAlApfgxayLPUDER+GQoIHNrMoEPETZUhLDzCkAxtARAV/MQ31DWLDSNhK1YuZNfZLkO3H/7LoxU6X82sueimzzfF08sPPQT9xm/20Tto9++Ui/PAf&lt;/diagram&gt;&lt;/mxfile&gt;" style="background-color: rgb(255, 255, 255);"><defs/><g><ellipse cx="15" cy="70" rx="11" ry="11" fill="#000000" stroke="#ff0000" transform="rotate(90,15,70)" pointer-events="all"/><path d="M 215 70 L 393.63 70" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 398.88 70 L 391.88 73.5 L 393.63 70 L 391.88 66.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 70px; margin-left: 231px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">U</div></div></div></foreignObject><text x="231" y="74" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">U</text></switch></g><path d="M 30 70 L 158.63 70" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 163.88 70 L 156.88 73.5 L 158.63 70 L 156.88 66.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 70px; margin-left: 98px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">Init</div></div></div></foreignObject><text x="98" y="74" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">Init</text></switch></g><ellipse cx="190" cy="70" rx="25" ry="25" fill="#dae8fc" stroke="#6c8ebf" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 48px; height: 1px; padding-top: 70px; margin-left: 166px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">S0</div></div></div></foreignObject><text x="190" y="74" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">S0</text></switch></g><ellipse cx="425" cy="70" rx="25" ry="25" fill="#dae8fc" stroke="#6c8ebf" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 48px; height: 1px; padding-top: 70px; margin-left: 401px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">S2</div></div></div></foreignObject><text x="425" y="74" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">S2</text></switch></g><path d="M 190 95 L 190 173.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 190 178.88 L 186.5 171.88 L 190 173.63 L 193.5 171.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 110px; margin-left: 190px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">ON</div></div></div></foreignObject><text x="190" y="113" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">ON</text></switch></g><ellipse cx="425" cy="205" rx="25" ry="25" fill="#dae8fc" stroke="#6c8ebf" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 48px; height: 1px; padding-top: 205px; margin-left: 401px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">S4</div></div></div></foreignObject><text x="425" y="209" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">S4</text></switch></g><ellipse cx="315" cy="295" rx="25" ry="25" fill="#dae8fc" stroke="#6c8ebf" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 48px; height: 1px; padding-top: 295px; margin-left: 291px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">S3</div></div></div></foreignObject><text x="315" y="299" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">S3</text></switch></g><path d="M 207.68 87.68 L 397.39 190.1" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 402.01 192.6 L 394.19 192.35 L 397.39 190.1 L 397.52 186.19 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 105px; margin-left: 224px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">OFF</div></div></div></foreignObject><text x="224" y="108" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">OFF</text></switch></g><path d="M 425 95 L 425 173.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 425 178.88 L 421.5 171.88 L 425 173.63 L 428.5 171.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 110px; margin-left: 425px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">OFF</div></div></div></foreignObject><text x="425" y="113" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">OFF</text></switch></g><path d="M 403.33 82.46 L 217.2 189.38" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 212.65 192 L 216.98 185.48 L 217.2 189.38 L 220.46 191.55 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 96px; margin-left: 380px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">ON</div></div></div></foreignObject><text x="380" y="99" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">ON</text></switch></g><path d="M 334.37 279.2 L 400.72 224.87" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 404.79 221.54 L 401.59 228.68 L 400.72 224.87 L 397.15 223.27 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 270px; margin-left: 350px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">OFF<font color="#ff0000">/1</font></div></div></div></foreignObject><text x="350" y="273" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">OFF/1</text></switch></g><path d="M 440 50 Q 440 0 425 0 Q 410 0 410 43.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 410 48.88 L 406.5 41.88 L 410 43.63 L 413.5 41.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 34px; margin-left: 441px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">U</div></div></div></foreignObject><text x="441" y="37" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">U</text></switch></g><ellipse cx="190" cy="205" rx="25" ry="25" fill="#dae8fc" stroke="#6c8ebf" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 48px; height: 1px; padding-top: 205px; margin-left: 166px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">S1</div></div></div></foreignObject><text x="190" y="209" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">S1</text></switch></g><path d="M 170 190 Q 120 190 120 205 Q 120 220 163.63 220" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 168.88 220 L 161.88 223.5 L 163.63 220 L 161.88 216.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 189px; margin-left: 154px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">ON</div></div></div></foreignObject><text x="154" y="193" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">ON</text></switch></g><path d="M 300 315 Q 300 360 315 360 Q 330 360 330 321.37" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 330 316.12 L 333.5 323.12 L 330 321.37 L 326.5 323.12 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 330px; margin-left: 299px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">U</div></div></div></foreignObject><text x="299" y="334" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">U</text></switch></g><path d="M 291.65 286.07 Q 250 270 235 260 Q 220 250 207.44 231.07" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 204.54 226.7 L 211.32 230.6 L 207.44 231.07 L 205.49 234.47 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 282px; margin-left: 276px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;"><font color="#000000">ON</font></div></div></div></foreignObject><text x="276" y="286" fill="#FF0000" font-family="Helvetica" font-size="11px" text-anchor="middle">ON</text></switch></g><path d="M 445 190 Q 500 190 500 205 Q 500 220 451.37 220" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 446.12 220 L 453.12 216.5 L 451.37 220 L 453.12 223.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 191px; margin-left: 470px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">OFF,U</div></div></div></foreignObject><text x="470" y="195" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">OFF,U</text></switch></g><path d="M 400.63 210.56 Q 360 220 325 220 Q 290 220 221.03 209.6" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 215.84 208.82 L 223.28 206.4 L 221.03 209.6 L 222.24 213.32 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 215px; margin-left: 384px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">ON</div></div></div></foreignObject><text x="384" y="218" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">ON</text></switch></g><path d="M 214.67 200.95 Q 280 190 315 190 Q 350 190 394.23 198.9" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 399.38 199.94 L 391.82 201.99 L 394.23 198.9 L 393.21 195.12 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 198px; margin-left: 234px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;"><font color="#000000">OFF</font>/1</div></div></div></foreignObject><text x="234" y="201" fill="#FF0000" font-family="Helvetica" font-size="11px" text-anchor="middle">OFF/1</text></switch></g><path d="M 212.38 216.13 Q 280 250 295.75 270.23" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 298.98 274.37 L 291.92 271 L 295.75 270.23 L 297.44 266.7 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 231px; margin-left: 231px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;"><font color="#000000">U</font></div></div></div></foreignObject><text x="231" y="234" fill="#FF0000" font-family="Helvetica" font-size="11px" text-anchor="middle">U</text></switch></g></g><switch><g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/><a transform="translate(0,-5)" xlink:href="https://www.diagrams.net/doc/faq/svg-export-text-problems" target="_blank"><text text-anchor="middle" font-size="10px" x="50%" y="100%">Viewer does not support full SVG 1.1</text></a></switch></svg>
\ No newline at end of file
......@@ -604,6 +604,7 @@ class PieceTakenDetectionEdgesTriggerTestOnArucoFull:
self.fifo_size = 10
self.last_boards: List[Board] = []
self.last_state_change = [0]*16
self.last_state = [PieceState.UNKNOWN]*16
self.out_board: Optional[Board] = None
def add_board(self, board: Board) -> None:
......@@ -614,13 +615,23 @@ class PieceTakenDetectionEdgesTriggerTestOnArucoFull:
@staticmethod
def _average_state(states: List[PieceState]) -> PieceState:
"""Get the most present state in a list"""
u = states.count(PieceState.UNKNOWN), PieceState.UNKNOWN
on = states.count(PieceState.ON_BOARD), PieceState.ON_BOARD
off = states.count(PieceState.OFF_BOARD), PieceState.OFF_BOARD
return max(u, on, off, key=lambda t: t[0])[1]
def _states_by_pieces(self):
boards_pieces = [board.pieces for board in self.last_boards]
@staticmethod
def _states_by_pieces(boards: List[Board]) -> list[list[PieceState]]:
"""For every pieces, get the last X states
res = [
[...state_at_t-3, state_at_t-2, state_at_t-1], # piece 0
[...state_at_t-3, state_at_t-2, state_at_t-1], # piece 1
...
]
"""
boards_pieces = [board.pieces for board in boards]
transposed = [elem for elem in zip(*boards_pieces)]
res = []
for last_pieces_for_one_piece in transposed:
......@@ -632,7 +643,7 @@ class PieceTakenDetectionEdgesTriggerTestOnArucoFull:
def _average_board(self) -> Board:
next_out_board = Board.from_board(self.last_boards[-1])
states_by_pieces = self._states_by_pieces()
states_by_pieces = self._states_by_pieces(self.last_boards)
average_state_by_pieces = [self._average_state(states) for states in states_by_pieces]
for idx, piece in enumerate(next_out_board.pieces):
......
from abc import ABC, abstractmethod
from enum import Enum
from memory_lib.model import PieceState
class StateMachineInput(ABC):
def __init__(self, enum: Enum) -> None:
self.enum = enum
class State(ABC):
@abstractmethod
def next(self, sm_input: StateMachineInput) -> "State":
...
class StateMachine:
def __init__(self, inital_state: State) -> None:
self.current_state = inital_state
def next(self, sm_input: StateMachineInput) -> State:
return self.current_state.next(sm_input)
class StateMachineInputPiece(StateMachineInput):
def __init__(self, piece_state: PieceState):
super().__init__(piece_state)
class State0(State):
def next(self, sm_input: StateMachineInputPiece) -> State:
return state_1
class State1(State):
def next(self, sm_input: StateMachineInput) -> State:
if sm_input.enum == PieceState.UNKNOWN:
return state_2
if sm_input.enum == PieceState.ON_BOARD:
return state_1
if sm_input.enum == PieceState.OFF_BOARD:
return state_3 # TODO: output = 1
class State2(State):
def next(self, sm_input: StateMachineInput) -> State:
if sm_input.enum == PieceState.UNKNOWN:
return state_2
if sm_input.enum == PieceState.ON_BOARD:
return state_1
if sm_input.enum == PieceState.OFF_BOARD:
return state_3 # TODO: output = 1
class State3(State):
def next(self, sm_input: StateMachineInput) -> State:
if sm_input.enum == PieceState.UNKNOWN:
return state_2
if sm_input.enum == PieceState.ON_BOARD:
return state_1
if sm_input.enum == PieceState.OFF_BOARD:
return state_3 # TODO: output = 1
state_0 = State0()
state_1 = State1()
state_2 = State2()
state_3 = State3()
......@@ -35,8 +35,8 @@ def main():
# memory = memory_lib.MemoryABM(cap)
# cap = cv.VideoCapture("res/webcam_05_aruco.avi")
cap = cv.VideoCapture(0)
# cap = cv.VideoCapture("res/webcam_11_aruco.avi")
# cap = cv.VideoCapture(0)
cap = cv.VideoCapture("res/webcam_12_aruco_full.avi")
memory = memory_lib.MemoryArucoFull(cap)
memory.bind_pieces(hello_piece)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment