-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathREADME.html
174 lines (163 loc) · 29.8 KB
/
README.html
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<div style="visibility: hidden; overflow: hidden; position: absolute; top: 0px; height: 1px; width: auto; padding: 0px; border: 0px; margin: 0px; text-align: left; text-indent: 0px; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal;"><div id="MathJax_SVG_Hidden"></div><svg><defs id="MathJax_SVG_glyphs"><path stroke-width="1" id="MJMATHI-7A" d="M347 338Q337 338 294 349T231 360Q211 360 197 356T174 346T162 335T155 324L153 320Q150 317 138 317Q117 317 117 325Q117 330 120 339Q133 378 163 406T229 440Q241 442 246 442Q271 442 291 425T329 392T367 375Q389 375 411 408T434 441Q435 442 449 442H462Q468 436 468 434Q468 430 463 420T449 399T432 377T418 358L411 349Q368 298 275 214T160 106L148 94L163 93Q185 93 227 82T290 71Q328 71 360 90T402 140Q406 149 409 151T424 153Q443 153 443 143Q443 138 442 134Q425 72 376 31T278 -11Q252 -11 232 6T193 40T155 57Q111 57 76 -3Q70 -11 59 -11H54H41Q35 -5 35 -2Q35 13 93 84Q132 129 225 214T340 322Q352 338 347 338Z"></path><path stroke-width="1" id="MJMAIN-31" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path><path stroke-width="1" id="MJMAIN-32" d="M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z"></path><path stroke-width="1" id="MJMAIN-2208" d="M84 250Q84 372 166 450T360 539Q361 539 377 539T419 540T469 540H568Q583 532 583 520Q583 511 570 501L466 500Q355 499 329 494Q280 482 242 458T183 409T147 354T129 306T124 272V270H568Q583 262 583 250T568 230H124V228Q124 207 134 177T167 112T231 48T328 7Q355 1 466 0H570Q583 -10 583 -20Q583 -32 568 -40H471Q464 -40 446 -40T417 -41Q262 -41 172 45Q84 127 84 250Z"></path><path stroke-width="1" id="MJMAIN-7B" d="M434 -231Q434 -244 428 -250H410Q281 -250 230 -184Q225 -177 222 -172T217 -161T213 -148T211 -133T210 -111T209 -84T209 -47T209 0Q209 21 209 53Q208 142 204 153Q203 154 203 155Q189 191 153 211T82 231Q71 231 68 234T65 250T68 266T82 269Q116 269 152 289T203 345Q208 356 208 377T209 529V579Q209 634 215 656T244 698Q270 724 324 740Q361 748 377 749Q379 749 390 749T408 750H428Q434 744 434 732Q434 719 431 716Q429 713 415 713Q362 710 332 689T296 647Q291 634 291 499V417Q291 370 288 353T271 314Q240 271 184 255L170 250L184 245Q202 239 220 230T262 196T290 137Q291 131 291 1Q291 -134 296 -147Q306 -174 339 -192T415 -213Q429 -213 431 -216Q434 -219 434 -231Z"></path><path stroke-width="1" id="MJMAIN-30" d="M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z"></path><path stroke-width="1" id="MJMAIN-2C" d="M78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17Z"></path><path stroke-width="1" id="MJMAIN-34" d="M462 0Q444 3 333 3Q217 3 199 0H190V46H221Q241 46 248 46T265 48T279 53T286 61Q287 63 287 115V165H28V211L179 442Q332 674 334 675Q336 677 355 677H373L379 671V211H471V165H379V114Q379 73 379 66T385 54Q393 47 442 46H471V0H462ZM293 211V545L74 212L183 211H293Z"></path><path stroke-width="1" id="MJMAIN-36" d="M42 313Q42 476 123 571T303 666Q372 666 402 630T432 550Q432 525 418 510T379 495Q356 495 341 509T326 548Q326 592 373 601Q351 623 311 626Q240 626 194 566Q147 500 147 364L148 360Q153 366 156 373Q197 433 263 433H267Q313 433 348 414Q372 400 396 374T435 317Q456 268 456 210V192Q456 169 451 149Q440 90 387 34T253 -22Q225 -22 199 -14T143 16T92 75T56 172T42 313ZM257 397Q227 397 205 380T171 335T154 278T148 216Q148 133 160 97T198 39Q222 21 251 21Q302 21 329 59Q342 77 347 104T352 209Q352 289 347 316T329 361Q302 397 257 397Z"></path><path stroke-width="1" id="MJMAIN-38" d="M70 417T70 494T124 618T248 666Q319 666 374 624T429 515Q429 485 418 459T392 417T361 389T335 371T324 363L338 354Q352 344 366 334T382 323Q457 264 457 174Q457 95 399 37T249 -22Q159 -22 101 29T43 155Q43 263 172 335L154 348Q133 361 127 368Q70 417 70 494ZM286 386L292 390Q298 394 301 396T311 403T323 413T334 425T345 438T355 454T364 471T369 491T371 513Q371 556 342 586T275 624Q268 625 242 625Q201 625 165 599T128 534Q128 511 141 492T167 463T217 431Q224 426 228 424L286 386ZM250 21Q308 21 350 55T392 137Q392 154 387 169T375 194T353 216T330 234T301 253T274 270Q260 279 244 289T218 306L210 311Q204 311 181 294T133 239T107 157Q107 98 150 60T250 21Z"></path><path stroke-width="1" id="MJMAIN-7D" d="M65 731Q65 745 68 747T88 750Q171 750 216 725T279 670Q288 649 289 635T291 501Q292 362 293 357Q306 312 345 291T417 269Q428 269 431 266T434 250T431 234T417 231Q380 231 345 210T298 157Q293 143 292 121T291 -28V-79Q291 -134 285 -156T256 -198Q202 -250 89 -250Q71 -250 68 -247T65 -230Q65 -224 65 -223T66 -218T69 -214T77 -213Q91 -213 108 -210T146 -200T183 -177T207 -139Q208 -134 209 3L210 139Q223 196 280 230Q315 247 330 250Q305 257 280 270Q225 304 212 352L210 362L209 498Q208 635 207 640Q195 680 154 696T77 713Q68 713 67 716T65 731Z"></path><path stroke-width="1" id="MJMAIN-67" d="M329 409Q373 453 429 453Q459 453 472 434T485 396Q485 382 476 371T449 360Q416 360 412 390Q410 404 415 411Q415 412 416 414V415Q388 412 363 393Q355 388 355 386Q355 385 359 381T368 369T379 351T388 325T392 292Q392 230 343 187T222 143Q172 143 123 171Q112 153 112 133Q112 98 138 81Q147 75 155 75T227 73Q311 72 335 67Q396 58 431 26Q470 -13 470 -72Q470 -139 392 -175Q332 -206 250 -206Q167 -206 107 -175Q29 -140 29 -75Q29 -39 50 -15T92 18L103 24Q67 55 67 108Q67 155 96 193Q52 237 52 292Q52 355 102 398T223 442Q274 442 318 416L329 409ZM299 343Q294 371 273 387T221 404Q192 404 171 388T145 343Q142 326 142 292Q142 248 149 227T179 192Q196 182 222 182Q244 182 260 189T283 207T294 227T299 242Q302 258 302 292T299 343ZM403 -75Q403 -50 389 -34T348 -11T299 -2T245 0H218Q151 0 138 -6Q118 -15 107 -34T95 -74Q95 -84 101 -97T122 -127T170 -155T250 -167Q319 -167 361 -139T403 -75Z"></path><path stroke-width="1" id="MJMAIN-33" d="M127 463Q100 463 85 480T69 524Q69 579 117 622T233 665Q268 665 277 664Q351 652 390 611T430 522Q430 470 396 421T302 350L299 348Q299 347 308 345T337 336T375 315Q457 262 457 175Q457 96 395 37T238 -22Q158 -22 100 21T42 130Q42 158 60 175T105 193Q133 193 151 175T169 130Q169 119 166 110T159 94T148 82T136 74T126 70T118 67L114 66Q165 21 238 21Q293 21 321 74Q338 107 338 175V195Q338 290 274 322Q259 328 213 329L171 330L168 332Q166 335 166 348Q166 366 174 366Q202 366 232 371Q266 376 294 413T322 525V533Q322 590 287 612Q265 626 240 626Q208 626 181 615T143 592T132 580H135Q138 579 143 578T153 573T165 566T175 555T183 540T186 520Q186 498 172 481T127 463Z"></path><path stroke-width="1" id="MJAMS-52" d="M17 665Q17 672 28 683H221Q415 681 439 677Q461 673 481 667T516 654T544 639T566 623T584 607T597 592T607 578T614 565T618 554L621 548Q626 530 626 497Q626 447 613 419Q578 348 473 326L455 321Q462 310 473 292T517 226T578 141T637 72T686 35Q705 30 705 16Q705 7 693 -1H510Q503 6 404 159L306 310H268V183Q270 67 271 59Q274 42 291 38Q295 37 319 35Q344 35 353 28Q362 17 353 3L346 -1H28Q16 5 16 16Q16 35 55 35Q96 38 101 52Q106 60 106 341T101 632Q95 645 55 648Q17 648 17 665ZM241 35Q238 42 237 45T235 78T233 163T233 337V621L237 635L244 648H133Q136 641 137 638T139 603T141 517T141 341Q141 131 140 89T134 37Q133 36 133 35H241ZM457 496Q457 540 449 570T425 615T400 634T377 643Q374 643 339 648Q300 648 281 635Q271 628 270 610T268 481V346H284Q327 346 375 352Q421 364 439 392T457 496ZM492 537T492 496T488 427T478 389T469 371T464 361Q464 360 465 360Q469 360 497 370Q593 400 593 495Q593 592 477 630L457 637L461 626Q474 611 488 561Q492 537 492 496ZM464 243Q411 317 410 317Q404 317 401 315Q384 315 370 312H346L526 35H619L606 50Q553 109 464 243Z"></path><path stroke-width="1" id="MJMAIN-2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path></defs></svg></div><h1>UAV Digital Twin via Probabilistic Graphical Models and ROS</h1>
<hr>
<h1>Table of Contents</h1>
<!-- TOC depthFrom:2 depthTo:4 withLinks:1 updateOnSave:1 orderedList:0 -->
<ul>
<li><a href="#Description">Description</a></li>
<li><a href="#Overview">Overview</a></li>
<li><a href="#Installation">Installation</a></li>
<li><a href="#Usage">Usage</a></li>
<li><a href="#Contact">Contact</a></li>
</ul>
<h2><!-- /TOC --></h2>
<h1>Description</h1>
<p>This repository contains ROS 2 packages that implement dynamic structural health monitoring for a UAV via a digital twin imbued with a probabilistic graphical model.</p>
<p>This code is a companion to an academic research paper. If you use this work in an academic context, please cite the following publication(s):</p>
<p>Kapteyn, Michael G., Jacob V.R. Pretorius, and Karen E. Willcox. <strong>A Probabilistic Graphical Model Foundation for Enabling Predictive Digital Twins at Scale.</strong> arXiv preprint arXiv:2012.05841 (2020). <a href="https://arxiv.org/abs/2012.05841">https://arxiv.org/abs/2012.05841</a></p>
<pre class="editor-colors lang-text"><span><span class="syntax--text syntax--plain"><span class="hard-tab leading-whitespace"> </span><span class="syntax--meta syntax--paragraph syntax--text">@article{kapteyn2020probabilistic,</span></span></span>
<span><span class="syntax--text syntax--plain"><span class="hard-tab leading-whitespace"> </span><span class="leading-whitespace"> </span><span class="syntax--meta syntax--paragraph syntax--text">title={A Probabilistic Graphical Model Foundation for Enabling Predictive Digital Twins at Scale},</span></span></span>
<span><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text"><span class="hard-tab leading-whitespace"> </span><span class="leading-whitespace"> </span>author={Kapteyn, Michael G and Pretorius, Jacob VR and Willcox, Karen E},</span></span></span>
<span><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text"><span class="hard-tab leading-whitespace"> </span><span class="leading-whitespace"> </span>journal={arXiv preprint arXiv:2012.05841},</span></span></span>
<span><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text"><span class="hard-tab leading-whitespace"> </span><span class="leading-whitespace"> </span>year={2020}</span></span></span>
<span><span class="syntax--text syntax--plain"><span class="hard-tab leading-whitespace"> </span><span class="syntax--meta syntax--paragraph syntax--text">}</span></span></span></pre>
<p><strong>Keywords:</strong> UAV, digital twin, graphical model, Dynamic Bayesian Network</p>
<!-- ### License -->
<!-- The source code is released under a [BSD 3-Clause license](ros_package_template/LICENSE). -->
<p><strong>Author & Maintainer:</strong> Michael Kapteyn, <a href="mailto:mkapteyn@mit.edu">mkapteyn@mit.edu</a></p>
<p>This is research code, any fitness for a particular purpose is disclaimed.</p>
<!-- [](http://rsl-ci.ethz.ch/job/ros_best_practices/) -->
<h1>Overview</h1>
<h2>digitaltwin package</h2>
<p>This repository contains a ROS2 package called <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">digitaltwin</code>. This package implements all the core functionality of the dynamic in-flight health-monitoring demonstration.</p>
<p>This package is a demonstrative application that illustrates how a general purpose Bayesian Network software package (we here use <a href="https://pomegranate.readthedocs.io/en/latest/BayesianNetwork.html">Pomegranate</a>) can be used to implement our proposed graphical model for digital twins. We use ROS in order to dynamically build and leverage the graphical model, and illustrate how information is transferred between an asset and its digital twin.</p>
<p>At its core, the code is a simple two node ROS architecture:
<img src="/doc/rosgraph_simple.png" alt="ROS architecture for the asset-twin system"></p>
<p>The <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">uav_asset</code> node is a simulated UAV asset. Its role is to acquire control inputs from the digital twin, progress the simulation one timestep, simulate sensor data accordingly, then pass this sensor data to the digital twin node.</p>
<ul>
<li>Functionality for the UAV is implemented in <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">src/digitaltwin/digitaltwin/UAV.py</code></li>
</ul>
<p>The <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">uav_twin</code> node is the UAV digital twin. Its role is to acquire sensor data from the UAV asset, decide which control input to issue, then pass this control input to the UAV asset. The digital twin does this by maintaining a probabilistic graphical model of the asset-twin system, as described in the accompanying paper.</p>
<ul>
<li>Functionality related to planning is in <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">src/digitaltwin/digitaltwin/planner.py</code></li>
<li>Functionality related to the probabilistic graphical model is in <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">src/digitaltwin/digitaltwin/graphicalmodel.py</code>. In order to better understand how the graphical model is constructed and utilized, it is greatly encouraged that you first read and understand the <a href="https://pomegranate.readthedocs.io/en/latest/BayesianNetwork.html">Pomegranate Bayesian Network documentation</a>.</li>
</ul>
<h2>Visualization packages</h2>
<p>In addition to the core functionality, this repository also contains six additional <a href="http://wiki.ros.org/rqt_gui">rqt_gui</a> plugins. These plugins allow you to visualize various quantities as the simulation progresses:</p>
<ul>
<li><strong>rqt_state</strong>: Plots the digital states, <span class="math inline-math"><span class="MathJax_SVG" id="MathJax-Element-1-Frame" tabindex="0" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="2.135ex" height="1.703ex" viewBox="0 -522.8 919.4 733.2" role="img" focusable="false" style="vertical-align: -0.489ex;"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#MJMATHI-7A" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#MJMAIN-31" x="658" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-1">z_1</script></span> and <span class="math inline-math"><span class="MathJax_SVG" id="MathJax-Element-2-Frame" tabindex="0" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="2.135ex" height="1.703ex" viewBox="0 -522.8 919.4 733.2" role="img" focusable="false" style="vertical-align: -0.489ex;"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#MJMATHI-7A" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#MJMAIN-32" x="658" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-2">z_2</script></span>, versus time</li>
<li><strong>rqt_trajectory</strong>: Plots the digital states in state-space (i.e. <span class="math inline-math"><span class="MathJax_SVG" id="MathJax-Element-3-Frame" tabindex="0" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="2.135ex" height="1.703ex" viewBox="0 -522.8 919.4 733.2" role="img" focusable="false" style="vertical-align: -0.489ex;"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#MJMATHI-7A" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#MJMAIN-31" x="658" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-3">z_1</script></span> vs. <span class="math inline-math"><span class="MathJax_SVG" id="MathJax-Element-4-Frame" tabindex="0" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="2.135ex" height="1.703ex" viewBox="0 -522.8 919.4 733.2" role="img" focusable="false" style="vertical-align: -0.489ex;"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#MJMATHI-7A" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#MJMAIN-32" x="658" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-4">z_2</script></span>)</li>
<li><strong>rqt_sensor</strong>: Plots sensor data and quantity of interest (i.e. reference sensor data)</li>
<li><strong>rqt_control</strong>: Plots control inputs vs. time</li>
<li><strong>rqt_reward</strong>: Plots reward functions vs. time</li>
<li><strong>rqt_network</strong>: Plots the probabilistic graphical model nodes and edges</li>
</ul>
<h1>Installation</h1>
<h2>Building from Source</h2>
<h3>Dependencies</h3>
<p>These packages have been tested under <a href="https://index.ros.org/doc/ros2/">ROS2</a> Eloquent on Ubuntu 18.04.</p>
<p>Dependencies include:</p>
<ul>
<li><a href="http://wiki.ros.org">Robot Operating System 2 (ROS2)</a> (middleware for robotics),</li>
<li><a href="https://www.python.org/download/releases/3.0/">Python 3</a> (and standard packages such as <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">numpy</code>, <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">json</code>, <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">re</code>, etc.)</li>
<li><a href="https://pomegranate.readthedocs.io/en/latest/">Pomegranate 0.13.0</a> (Python library used for Bayesian Network back-end)</li>
</ul>
<h3>Building</h3>
<p>To build from source, clone the latest version from this repository (or unzip the file contents) into a ROS2 workspace (here called <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">digitaltwin_ws</code>) and compile the package using</p>
<pre class="editor-colors lang-text"><span><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text">cd digitaltwin_ws/src</span></span></span>
<span><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text"># [git clone/unzip file contents here]</span></span></span>
<span><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text">cd ../</span></span></span>
<span><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text">colcon build</span></span></span></pre>
<p>You should now have the directories <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">digitaltwin_ws/install</code> and <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">digitaltwin_ws/build</code></p>
<!-- ### Running in Docker
Docker is a great way to run an application with all dependencies and libraries bundles together.
Make sure to [install Docker](https://docs.docker.com/get-docker/) first.
First, spin up a simple container:
docker run -ti --rm --name ros-container ros:noetic bash
This downloads the `ros:noetic` image from the Docker Hub, indicates that it requires an interactive terminal (`-t, -i`), gives it a name (`--name`), removes it after you exit the container (`--rm`) and runs a command (`bash`).
Now, create a catkin workspace, clone the package, build it, done!
apt-get update && apt-get install -y git
mkdir -p /ws/src && cd /ws/src
git clone https://github.com/leggedrobotics/ros_best_practices.git
cd ..
rosdep install --from-path src
catkin_make
source devel/setup.bash
roslaunch ros_package_template ros_package_template.launch -->
<!-- ### Unit Tests
Run the unit tests with
catkin_make run_tests_ros_package_template
### Static code analysis
Run the static code analysis with
catkin_make roslint_ros_package_template -->
<h1>Usage</h1>
<p>Run the demonstration with</p>
<pre class="editor-colors lang-text"><span><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text">cd digitaltwin_ws</span></span></span>
<span><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text">. install/setup.bash</span></span></span>
<span><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text">ros2 launch digitaltwin digitaltwin_launch_gui.py</span></span></span></pre>
<p>To run the visualizations open <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">rqt_gui</code> while the <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">uav_asset</code> and <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">uav_twin</code> (should open automatically using the provided <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">*_gui*</code> launch file)</p>
<pre class="editor-colors lang-text"><span><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text">ros2 run rqt_gui rqt_gui</span></span></span></pre>
<p>You can load a provided GUI layout by going to <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">Perspectives->Import</code> and importing the file <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">src/digitaltwin/digitaltwin.perspective</code>. This perspective should show the probabilistic graphical model, sensor data, states, and reward functions.</p>
<p>Alternatively, you can build a custom GUI by going to the <code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">Plugins->Visualization</code> menu and selecting the plugins you wish to add to the GUI.</p>
<h2>Config files</h2>
<ul>
<li><strong>inputfiles/UAVconfig.json</strong> Contains information related to the UAV use-case.</li>
</ul>
<p>Note that this input file contains a series of pre-computed strain values computed using our structural model of the UAV, which is used under license and is unable to be shared publicly. Thus, reading strain values from this files should be viewed as a placeholder for a structural model evaluation. The strain values are stored in dictionary format as follows:</p>
<pre class="editor-colors lang-text"><span><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text">uav_config["observations"][z_1][z_2][control][e_value]</span></span></span></pre>
<p>where</p>
<ul>
<li><span class="math inline-math"><span class="MathJax_SVG" id="MathJax-Element-5-Frame" tabindex="0" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="21.899ex" height="2.671ex" viewBox="0 -835.3 9428.6 1149.8" role="img" focusable="false" style="vertical-align: -0.73ex;"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#MJMATHI-7A" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#MJMAIN-31" x="658" y="-213"></use><use xlink:href="#MJMAIN-2208" x="1197" y="0"></use><use xlink:href="#MJMAIN-7B" x="2142" y="0"></use><use xlink:href="#MJMAIN-30" x="2642" y="0"></use><use xlink:href="#MJMAIN-2C" x="3143" y="0"></use><g transform="translate(3588,0)"><use xlink:href="#MJMAIN-32"></use><use xlink:href="#MJMAIN-30" x="500" y="0"></use></g><use xlink:href="#MJMAIN-2C" x="4589" y="0"></use><g transform="translate(5034,0)"><use xlink:href="#MJMAIN-34"></use><use xlink:href="#MJMAIN-30" x="500" y="0"></use></g><use xlink:href="#MJMAIN-2C" x="6035" y="0"></use><g transform="translate(6480,0)"><use xlink:href="#MJMAIN-36"></use><use xlink:href="#MJMAIN-30" x="500" y="0"></use></g><use xlink:href="#MJMAIN-2C" x="7481" y="0"></use><g transform="translate(7927,0)"><use xlink:href="#MJMAIN-38"></use><use xlink:href="#MJMAIN-30" x="500" y="0"></use></g><use xlink:href="#MJMAIN-7D" x="8928" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-5">z_1\in\{0,20,40,60,80\}</script></span></li>
<li><span class="math inline-math"><span class="MathJax_SVG" id="MathJax-Element-6-Frame" tabindex="0" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="21.899ex" height="2.671ex" viewBox="0 -835.3 9428.6 1149.8" role="img" focusable="false" style="vertical-align: -0.73ex;"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#MJMATHI-7A" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#MJMAIN-32" x="658" y="-213"></use><use xlink:href="#MJMAIN-2208" x="1197" y="0"></use><use xlink:href="#MJMAIN-7B" x="2142" y="0"></use><use xlink:href="#MJMAIN-30" x="2642" y="0"></use><use xlink:href="#MJMAIN-2C" x="3143" y="0"></use><g transform="translate(3588,0)"><use xlink:href="#MJMAIN-32"></use><use xlink:href="#MJMAIN-30" x="500" y="0"></use></g><use xlink:href="#MJMAIN-2C" x="4589" y="0"></use><g transform="translate(5034,0)"><use xlink:href="#MJMAIN-34"></use><use xlink:href="#MJMAIN-30" x="500" y="0"></use></g><use xlink:href="#MJMAIN-2C" x="6035" y="0"></use><g transform="translate(6480,0)"><use xlink:href="#MJMAIN-36"></use><use xlink:href="#MJMAIN-30" x="500" y="0"></use></g><use xlink:href="#MJMAIN-2C" x="7481" y="0"></use><g transform="translate(7927,0)"><use xlink:href="#MJMAIN-38"></use><use xlink:href="#MJMAIN-30" x="500" y="0"></use></g><use xlink:href="#MJMAIN-7D" x="8928" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-6">z_2\in\{0,20,40,60,80\}</script></span></li>
<li>control <span class="math inline-math"><span class="MathJax_SVG" id="MathJax-Element-7-Frame" tabindex="0" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="10.204ex" height="2.671ex" viewBox="0 -835.3 4393.4 1149.8" role="img" focusable="false" style="vertical-align: -0.73ex;"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#MJMAIN-2208" x="0" y="0"></use><use xlink:href="#MJMAIN-7B" x="945" y="0"></use><use xlink:href="#MJMAIN-32" x="1445" y="0"></use><use xlink:href="#MJMAIN-67" x="1946" y="0"></use><use xlink:href="#MJMAIN-2C" x="2446" y="0"></use><use xlink:href="#MJMAIN-33" x="2891" y="0"></use><use xlink:href="#MJMAIN-67" x="3392" y="0"></use><use xlink:href="#MJMAIN-7D" x="3892" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-7">\in\{2\rm{g},3\rm{g}\}</script></span></li>
<li>e_value <span class="math inline-math"><span class="MathJax_SVG" id="MathJax-Element-8-Frame" tabindex="0" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="5.384ex" height="2.187ex" viewBox="0 -835.3 2318.3 941.5" role="img" focusable="false" style="vertical-align: -0.247ex;"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#MJMAIN-2208" x="0" y="0"></use><g transform="translate(945,0)"><use xlink:href="#MJAMS-52" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#MJMAIN-2B" x="1021" y="513"></use></g></g></svg></span><script type="math/tex" id="MathJax-Element-8">\in \mathbb{R^+}</script></span> (30 samples are drawn from the posterior distribution of e)</li>
</ul>
<h2>Launch files</h2>
<ul>
<li>
<p><strong>digitaltwin_launch.py:</strong> Standard simulation. Spis up asset and digital twin nodes.</p>
</li>
<li>
<p><strong>digitaltwin_launch_gui.py:</strong> Simulation + Visualization. Spins up asset, digital twin, and rqt_gui nodes.</p>
</li>
<li>
<p><strong>digitaltwin_launch_gui_logger.py:</strong> Simulation + Visualization + Logging. Spins up asset, digital twin, rqt_gui, and logger nodes.</p>
</li>
</ul>
<h2>Nodes</h2>
<h3>uav_asset</h3>
<p>Acquires control inputs from the digital twin, progresses the simulation one timestep, simulates sensor data accordingly, then passes this sensor data to the digital twin node.</p>
<h4>Subscribed Topics</h4>
<ul>
<li>
<p><strong><code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">/control_data</code></strong> ([digitaltwin/ControlA])</p>
<p>The control input issued by the digital twin.</p>
</li>
</ul>
<h4>Published Topics</h4>
<ul>
<li>
<p><strong><code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">/sensor_data</code></strong> ([digitaltwin/Sensor])</p>
<p>Simulated sensor data generated by the UAV asset simulator.</p>
</li>
</ul>
<h3>uav_twin</h3>
<p>Acquires sensor data from the UAV asset, decides which control input to issue, then passes this control input to the UAV asset.</p>
<h4>Subscribed Topics</h4>
<ul>
<li>
<p><strong><code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">/sensor_data</code></strong> ([digitaltwin/Sensor])</p>
<p>Sensor data received from the UAV asset.</p>
</li>
</ul>
<h4>Published Topics</h4>
<ul>
<li>
<p><strong><code style="font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;">/control_data</code></strong> ([digital_twin/ControlA])</p>
<p>The control input issued by the digital twin.</p>
</li>
</ul>
<hr>
<h2>Further Reading</h2>
<p>Kapteyn, Michael G., Jacob VR Pretorius, and Karen E. Willcox. “A Probabilistic Graphical Model Foundation for Enabling Predictive Digital Twins at Scale.” arXiv:2012.05841 (2021). <a href="https://arxiv.org/abs/2012.05841">https://arxiv.org/abs/2012.05841</a></p>
<h1>Contact</h1>
<p>Please report bugs to <strong>Michael Kapteyn, <a href="mailto:mkapteyn@mit.edu">mkapteyn@mit.edu</a></strong>.</p>