-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb.json
More file actions
1 lines (1 loc) · 88.6 KB
/
db.json
File metadata and controls
1 lines (1 loc) · 88.6 KB
1
{"meta":{"version":1,"warehouse":"4.0.2"},"models":{"Asset":[{"_id":"themes/landscape/source/css/style.styl","path":"css/style.styl","modified":0,"renderable":1},{"_id":"themes/landscape/source/fancybox/blank.gif","path":"fancybox/blank.gif","modified":0,"renderable":1},{"_id":"themes/landscape/source/fancybox/fancybox_loading@2x.gif","path":"fancybox/fancybox_loading@2x.gif","modified":0,"renderable":1},{"_id":"themes/landscape/source/fancybox/fancybox_overlay.png","path":"fancybox/fancybox_overlay.png","modified":0,"renderable":1},{"_id":"themes/landscape/source/fancybox/fancybox_sprite.png","path":"fancybox/fancybox_sprite.png","modified":0,"renderable":1},{"_id":"themes/landscape/source/fancybox/fancybox_sprite@2x.png","path":"fancybox/fancybox_sprite@2x.png","modified":0,"renderable":1},{"_id":"themes/landscape/source/fancybox/jquery.fancybox.css","path":"fancybox/jquery.fancybox.css","modified":0,"renderable":1},{"_id":"themes/landscape/source/fancybox/fancybox_loading.gif","path":"fancybox/fancybox_loading.gif","modified":0,"renderable":1},{"_id":"themes/landscape/source/fancybox/jquery.fancybox.js","path":"fancybox/jquery.fancybox.js","modified":0,"renderable":1},{"_id":"themes/landscape/source/fancybox/jquery.fancybox.pack.js","path":"fancybox/jquery.fancybox.pack.js","modified":0,"renderable":1},{"_id":"themes/landscape/source/js/script.js","path":"js/script.js","modified":0,"renderable":1},{"_id":"themes/landscape/source/css/images/banner.jpg","path":"css/images/banner.jpg","modified":0,"renderable":1},{"_id":"themes/landscape/source/css/fonts/fontawesome-webfont.eot","path":"css/fonts/fontawesome-webfont.eot","modified":0,"renderable":1},{"_id":"themes/landscape/source/css/fonts/FontAwesome.otf","path":"css/fonts/FontAwesome.otf","modified":0,"renderable":1},{"_id":"themes/landscape/source/css/fonts/fontawesome-webfont.ttf","path":"css/fonts/fontawesome-webfont.ttf","modified":0,"renderable":1},{"_id":"themes/landscape/source/css/fonts/fontawesome-webfont.woff","path":"css/fonts/fontawesome-webfont.woff","modified":0,"renderable":1},{"_id":"themes/landscape/source/css/fonts/fontawesome-webfont.svg","path":"css/fonts/fontawesome-webfont.svg","modified":0,"renderable":1},{"_id":"themes/landscape/source/fancybox/helpers/fancybox_buttons.png","path":"fancybox/helpers/fancybox_buttons.png","modified":0,"renderable":1},{"_id":"themes/landscape/source/fancybox/helpers/jquery.fancybox-buttons.css","path":"fancybox/helpers/jquery.fancybox-buttons.css","modified":0,"renderable":1},{"_id":"themes/landscape/source/fancybox/helpers/jquery.fancybox-media.js","path":"fancybox/helpers/jquery.fancybox-media.js","modified":0,"renderable":1},{"_id":"themes/landscape/source/fancybox/helpers/jquery.fancybox-buttons.js","path":"fancybox/helpers/jquery.fancybox-buttons.js","modified":0,"renderable":1},{"_id":"themes/landscape/source/fancybox/helpers/jquery.fancybox-thumbs.js","path":"fancybox/helpers/jquery.fancybox-thumbs.js","modified":0,"renderable":1},{"_id":"themes/landscape/source/fancybox/helpers/jquery.fancybox-thumbs.css","path":"fancybox/helpers/jquery.fancybox-thumbs.css","modified":0,"renderable":1}],"Cache":[{"_id":"source/_posts/Test.md","hash":"bd8e8e28203e38ff6b518e72327cc1547583dbf8","modified":1664978709774},{"_id":"source/_posts/hello-world.md","hash":"7d98d6592de80fdcd2949bd7401cec12afd98cdf","modified":1664978364109},{"_id":"source/_posts/概率机器人-PART-I.md","hash":"354b5952c9c6a02185317fcd3f918df3ba93833d","modified":1665041369012},{"_id":"themes/landscape/.npmignore","hash":"58d26d4b5f2f94c2d02a4e4a448088e4a2527c77","modified":1664978363922},{"_id":"themes/landscape/LICENSE","hash":"c480fce396b23997ee23cc535518ffaaf7f458f8","modified":1664978363932},{"_id":"themes/landscape/Gruntfile.js","hash":"71adaeaac1f3cc56e36c49d549b8d8a72235c9b9","modified":1664978364076},{"_id":"themes/landscape/README.md","hash":"37fae88639ef60d63bd0de22314d7cc4c5d94b07","modified":1664978364112},{"_id":"themes/landscape/package.json","hash":"544f21a0b2c7034998b36ae94dba6e3e0f39f228","modified":1664978364105},{"_id":"themes/landscape/languages/de.yml","hash":"3ebf0775abbee928c8d7bda943c191d166ded0d3","modified":1664978364257},{"_id":"themes/landscape/_config.yml","hash":"321c1e68661bb4fc1a4fd071e083c0fbc05f6ca8","modified":1664982832451},{"_id":"themes/landscape/languages/es.yml","hash":"76edb1171b86532ef12cfd15f5f2c1ac3949f061","modified":1664978364278},{"_id":"themes/landscape/languages/nl.yml","hash":"12ed59faba1fc4e8cdd1d42ab55ef518dde8039c","modified":1664978364295},{"_id":"themes/landscape/languages/default.yml","hash":"3083f319b352d21d80fc5e20113ddf27889c9d11","modified":1664978364259},{"_id":"themes/landscape/languages/ko.yml","hash":"881d6a0a101706e0452af81c580218e0bfddd9cf","modified":1664978364291},{"_id":"themes/landscape/languages/fr.yml","hash":"415e1c580ced8e4ce20b3b0aeedc3610341c76fb","modified":1664978364287},{"_id":"themes/landscape/languages/ja.yml","hash":"a73e1b9c80fd6e930e2628b393bfe3fb716a21a9","modified":1664978364289},{"_id":"themes/landscape/languages/no.yml","hash":"965a171e70347215ec726952e63f5b47930931ef","modified":1664978364297},{"_id":"themes/landscape/languages/pt.yml","hash":"57d07b75d434fbfc33b0ddb543021cb5f53318a8","modified":1664978364300},{"_id":"themes/landscape/languages/ru.yml","hash":"4fda301bbd8b39f2c714e2c934eccc4b27c0a2b0","modified":1664978364301},{"_id":"themes/landscape/languages/zh-CN.yml","hash":"ca40697097ab0b3672a80b455d3f4081292d1eed","modified":1664978364303},{"_id":"themes/landscape/languages/zh-TW.yml","hash":"53ce3000c5f767759c7d2c4efcaa9049788599c3","modified":1664978364305},{"_id":"themes/landscape/layout/category.ejs","hash":"765426a9c8236828dc34759e604cc2c52292835a","modified":1664978363946},{"_id":"themes/landscape/layout/archive.ejs","hash":"2703b07cc8ac64ae46d1d263f4653013c7e1666b","modified":1664978363943},{"_id":"themes/landscape/layout/post.ejs","hash":"7d80e4e36b14d30a7cd2ac1f61376d9ebf264e8b","modified":1664978363954},{"_id":"themes/landscape/layout/page.ejs","hash":"7d80e4e36b14d30a7cd2ac1f61376d9ebf264e8b","modified":1664978363953},{"_id":"themes/landscape/layout/layout.ejs","hash":"f155824ca6130080bb057fa3e868a743c69c4cf5","modified":1664978363951},{"_id":"themes/landscape/layout/tag.ejs","hash":"eaa7b4ccb2ca7befb90142e4e68995fb1ea68b2e","modified":1664978363957},{"_id":"themes/landscape/layout/index.ejs","hash":"aa1b4456907bdb43e629be3931547e2d29ac58c8","modified":1664978363950},{"_id":"themes/landscape/scripts/fancybox.js","hash":"aa411cd072399df1ddc8e2181a3204678a5177d9","modified":1664978364074},{"_id":"themes/landscape/layout/_partial/archive-post.ejs","hash":"c7a71425a946d05414c069ec91811b5c09a92c47","modified":1664978363940},{"_id":"themes/landscape/layout/_partial/after-footer.ejs","hash":"d0d753d39038284d52b10e5075979cc97db9cd20","modified":1664978363939},{"_id":"themes/landscape/layout/_partial/archive.ejs","hash":"950ddd91db8718153b329b96dc14439ab8463ba5","modified":1664978363941},{"_id":"themes/landscape/layout/_partial/footer.ejs","hash":"93518893cf91287e797ebac543c560e2a63b8d0e","modified":1664978363947},{"_id":"themes/landscape/layout/_partial/gauges-analytics.ejs","hash":"aad6312ac197d6c5aaf2104ac863d7eba46b772a","modified":1664978363948},{"_id":"themes/landscape/layout/_partial/article.ejs","hash":"c4c835615d96a950d51fa2c3b5d64d0596534fed","modified":1664978363944},{"_id":"themes/landscape/layout/_partial/google-analytics.ejs","hash":"f921e7f9223d7c95165e0f835f353b2938e40c45","modified":1664978363948},{"_id":"themes/landscape/layout/_partial/head.ejs","hash":"5abf77aec957d9445fc71a8310252f0013c84578","modified":1664978363949},{"_id":"themes/landscape/layout/_partial/header.ejs","hash":"7e749050be126eadbc42decfbea75124ae430413","modified":1664978363950},{"_id":"themes/landscape/layout/_partial/mobile-nav.ejs","hash":"e952a532dfc583930a666b9d4479c32d4a84b44e","modified":1664978363951},{"_id":"themes/landscape/layout/_partial/sidebar.ejs","hash":"930da35cc2d447a92e5ee8f835735e6fd2232469","modified":1664978363955},{"_id":"themes/landscape/layout/_widget/archive.ejs","hash":"beb4a86fcc82a9bdda9289b59db5a1988918bec3","modified":1664978363942},{"_id":"themes/landscape/layout/_widget/recent_posts.ejs","hash":"0d4f064733f8b9e45c0ce131fe4a689d570c883a","modified":1664978363955},{"_id":"themes/landscape/layout/_widget/category.ejs","hash":"dd1e5af3c6af3f5d6c85dfd5ca1766faed6a0b05","modified":1664978363945},{"_id":"themes/landscape/layout/_widget/tag.ejs","hash":"2de380865df9ab5f577f7d3bcadf44261eb5faae","modified":1664978363956},{"_id":"themes/landscape/layout/_widget/tagcloud.ejs","hash":"b4a2079101643f63993dcdb32925c9b071763b46","modified":1664978363957},{"_id":"themes/landscape/source/css/_extend.styl","hash":"222fbe6d222531d61c1ef0f868c90f747b1c2ced","modified":1664978364133},{"_id":"themes/landscape/source/css/_variables.styl","hash":"628e307579ea46b5928424313993f17b8d729e92","modified":1664978364134},{"_id":"themes/landscape/source/css/style.styl","hash":"a70d9c44dac348d742702f6ba87e5bb3084d65db","modified":1664978364142},{"_id":"themes/landscape/source/fancybox/blank.gif","hash":"2daeaa8b5f19f0bc209d976c02bd6acb51b00b0a","modified":1664978363962},{"_id":"themes/landscape/source/fancybox/fancybox_loading@2x.gif","hash":"273b123496a42ba45c3416adb027cd99745058b0","modified":1664978363965},{"_id":"themes/landscape/source/fancybox/fancybox_overlay.png","hash":"b3a4ee645ba494f52840ef8412015ba0f465dbe0","modified":1664978364128},{"_id":"themes/landscape/source/fancybox/fancybox_sprite.png","hash":"17df19f97628e77be09c352bf27425faea248251","modified":1664978364130},{"_id":"themes/landscape/source/fancybox/fancybox_sprite@2x.png","hash":"30c58913f327e28f466a00f4c1ac8001b560aed8","modified":1664978364132},{"_id":"themes/landscape/source/fancybox/jquery.fancybox.css","hash":"aaa582fb9eb4b7092dc69fcb2d5b1c20cca58ab6","modified":1664978363938},{"_id":"themes/landscape/source/fancybox/fancybox_loading.gif","hash":"1a755fb2599f3a313cc6cfdb14df043f8c14a99c","modified":1664978363963},{"_id":"themes/landscape/source/fancybox/jquery.fancybox.js","hash":"d08b03a42d5c4ba456ef8ba33116fdbb7a9cabed","modified":1664978364092},{"_id":"themes/landscape/source/fancybox/jquery.fancybox.pack.js","hash":"9e0d51ca1dbe66f6c0c7aefd552dc8122e694a6e","modified":1664978364094},{"_id":"themes/landscape/source/js/script.js","hash":"2876e0b19ce557fca38d7c6f49ca55922ab666a1","modified":1664978364095},{"_id":"themes/landscape/layout/_partial/post/date.ejs","hash":"6197802873157656e3077c5099a7dda3d3b01c29","modified":1664978363946},{"_id":"themes/landscape/layout/_partial/post/category.ejs","hash":"c6bcd0e04271ffca81da25bcff5adf3d46f02fc0","modified":1664978363945},{"_id":"themes/landscape/layout/_partial/post/nav.ejs","hash":"16a904de7bceccbb36b4267565f2215704db2880","modified":1664978363952},{"_id":"themes/landscape/layout/_partial/post/gallery.ejs","hash":"3d9d81a3c693ff2378ef06ddb6810254e509de5b","modified":1664978363947},{"_id":"themes/landscape/layout/_partial/post/title.ejs","hash":"2f275739b6f1193c123646a5a31f37d48644c667","modified":1664978363958},{"_id":"themes/landscape/layout/_partial/post/tag.ejs","hash":"2fcb0bf9c8847a644167a27824c9bb19ac74dd14","modified":1664978363956},{"_id":"themes/landscape/source/css/_partial/archive.styl","hash":"db15f5677dc68f1730e82190bab69c24611ca292","modified":1664978364135},{"_id":"themes/landscape/source/css/_partial/article.styl","hash":"10685f8787a79f79c9a26c2f943253450c498e3e","modified":1664978364136},{"_id":"themes/landscape/source/css/_partial/comment.styl","hash":"79d280d8d203abb3bd933ca9b8e38c78ec684987","modified":1664978364136},{"_id":"themes/landscape/source/css/_partial/footer.styl","hash":"e35a060b8512031048919709a8e7b1ec0e40bc1b","modified":1664978364137},{"_id":"themes/landscape/source/css/_partial/highlight.styl","hash":"bf4e7be1968dad495b04e83c95eac14c4d0ad7c0","modified":1664978364139},{"_id":"themes/landscape/source/css/_partial/header.styl","hash":"85ab11e082f4dd86dde72bed653d57ec5381f30c","modified":1664978364139},{"_id":"themes/landscape/source/css/_partial/mobile.styl","hash":"a399cf9e1e1cec3e4269066e2948d7ae5854d745","modified":1664978364140},{"_id":"themes/landscape/source/css/_partial/sidebar-bottom.styl","hash":"8fd4f30d319542babfd31f087ddbac550f000a8a","modified":1664978364141},{"_id":"themes/landscape/source/css/_partial/sidebar.styl","hash":"404ec059dc674a48b9ab89cd83f258dec4dcb24d","modified":1664978364142},{"_id":"themes/landscape/source/css/_util/grid.styl","hash":"0bf55ee5d09f193e249083602ac5fcdb1e571aed","modified":1664978364138},{"_id":"themes/landscape/source/css/_partial/sidebar-aside.styl","hash":"890349df5145abf46ce7712010c89237900b3713","modified":1664978364141},{"_id":"themes/landscape/source/css/_util/mixin.styl","hash":"44f32767d9fd3c1c08a60d91f181ee53c8f0dbb3","modified":1664978364140},{"_id":"themes/landscape/source/css/fonts/fontawesome-webfont.eot","hash":"7619748fe34c64fb157a57f6d4ef3678f63a8f5e","modified":1664978363961},{"_id":"themes/landscape/source/css/fonts/FontAwesome.otf","hash":"b5b4f9be85f91f10799e87a083da1d050f842734","modified":1664978364125},{"_id":"themes/landscape/source/css/fonts/fontawesome-webfont.woff","hash":"04c3bf56d87a0828935bd6b4aee859995f321693","modified":1664978364251},{"_id":"themes/landscape/source/fancybox/helpers/fancybox_buttons.png","hash":"e385b139516c6813dcd64b8fc431c364ceafe5f3","modified":1664978364126},{"_id":"themes/landscape/source/fancybox/helpers/jquery.fancybox-buttons.css","hash":"1a9d8e5c22b371fcc69d4dbbb823d9c39f04c0c8","modified":1664978363936},{"_id":"themes/landscape/source/fancybox/helpers/jquery.fancybox-media.js","hash":"294420f9ff20f4e3584d212b0c262a00a96ecdb3","modified":1664978364087},{"_id":"themes/landscape/source/fancybox/helpers/jquery.fancybox-buttons.js","hash":"dc3645529a4bf72983a39fa34c1eb9146e082019","modified":1664978364083},{"_id":"themes/landscape/source/fancybox/helpers/jquery.fancybox-thumbs.js","hash":"47da1ae5401c24b5c17cc18e2730780f5c1a7a0c","modified":1664978364089},{"_id":"themes/landscape/source/fancybox/helpers/jquery.fancybox-thumbs.css","hash":"4ac329c16a5277592fc12a37cca3d72ca4ec292f","modified":1664978363937},{"_id":"themes/landscape/source/css/fonts/fontawesome-webfont.ttf","hash":"7f09c97f333917034ad08fa7295e916c9f72fd3f","modified":1664978364148},{"_id":"themes/landscape/source/css/images/banner.jpg","hash":"f44aa591089fcb3ec79770a1e102fd3289a7c6a6","modified":1664978364070},{"_id":"themes/landscape/source/css/fonts/fontawesome-webfont.svg","hash":"46fcc0194d75a0ddac0a038aee41b23456784814","modified":1664978364146},{"_id":"public/2022/10/05/概率机器人-PART-I/index.html","hash":"03be8760dcf5c4ef0f5a0d5e475b1895e0b30e4e","modified":1665041566318},{"_id":"public/2022/10/05/Test/index.html","hash":"6df1153e6ed33242ac540ade16eff84c6d0911c1","modified":1664989808050},{"_id":"public/2022/10/05/hello-world/index.html","hash":"0b7247f1f28318aa80d6d09b340ef8a6741ed684","modified":1664989808050},{"_id":"public/archives/index.html","hash":"181f38f103868a6cf5c6395a90acba60290f8804","modified":1664989808050},{"_id":"public/archives/2022/index.html","hash":"c520ffe88632687197a88d7c3fe3b9ec98d0c9a6","modified":1664989808050},{"_id":"public/archives/2022/10/index.html","hash":"2ea2ba78b67f20aa9641db72ad0dd171b789698d","modified":1664989808050},{"_id":"public/index.html","hash":"e22228e73d4d1ca201246c035a1ef244ff8c0ef3","modified":1665041566318},{"_id":"public/tags/SLAM/index.html","hash":"49d5f21dc43b871cd8009d0fd11972ad881b15ea","modified":1664989808050},{"_id":"public/fancybox/fancybox_loading@2x.gif","hash":"273b123496a42ba45c3416adb027cd99745058b0","modified":1664982851823},{"_id":"public/fancybox/blank.gif","hash":"2daeaa8b5f19f0bc209d976c02bd6acb51b00b0a","modified":1664982851823},{"_id":"public/fancybox/fancybox_sprite.png","hash":"17df19f97628e77be09c352bf27425faea248251","modified":1664982851823},{"_id":"public/fancybox/fancybox_overlay.png","hash":"b3a4ee645ba494f52840ef8412015ba0f465dbe0","modified":1664982851823},{"_id":"public/fancybox/fancybox_loading.gif","hash":"1a755fb2599f3a313cc6cfdb14df043f8c14a99c","modified":1664982851823},{"_id":"public/fancybox/fancybox_sprite@2x.png","hash":"30c58913f327e28f466a00f4c1ac8001b560aed8","modified":1664982851823},{"_id":"public/css/fonts/FontAwesome.otf","hash":"b5b4f9be85f91f10799e87a083da1d050f842734","modified":1664982851823},{"_id":"public/css/fonts/fontawesome-webfont.eot","hash":"7619748fe34c64fb157a57f6d4ef3678f63a8f5e","modified":1664982851823},{"_id":"public/css/fonts/fontawesome-webfont.woff","hash":"04c3bf56d87a0828935bd6b4aee859995f321693","modified":1664982851823},{"_id":"public/fancybox/helpers/fancybox_buttons.png","hash":"e385b139516c6813dcd64b8fc431c364ceafe5f3","modified":1664982851823},{"_id":"public/fancybox/jquery.fancybox.css","hash":"aaa582fb9eb4b7092dc69fcb2d5b1c20cca58ab6","modified":1664982851823},{"_id":"public/fancybox/helpers/jquery.fancybox-buttons.css","hash":"1a9d8e5c22b371fcc69d4dbbb823d9c39f04c0c8","modified":1664982851823},{"_id":"public/fancybox/helpers/jquery.fancybox-thumbs.js","hash":"47da1ae5401c24b5c17cc18e2730780f5c1a7a0c","modified":1664982851823},{"_id":"public/fancybox/helpers/jquery.fancybox-media.js","hash":"294420f9ff20f4e3584d212b0c262a00a96ecdb3","modified":1664982851823},{"_id":"public/js/script.js","hash":"2876e0b19ce557fca38d7c6f49ca55922ab666a1","modified":1664982851823},{"_id":"public/fancybox/helpers/jquery.fancybox-buttons.js","hash":"dc3645529a4bf72983a39fa34c1eb9146e082019","modified":1664982851823},{"_id":"public/fancybox/helpers/jquery.fancybox-thumbs.css","hash":"4ac329c16a5277592fc12a37cca3d72ca4ec292f","modified":1664982851823},{"_id":"public/css/style.css","hash":"3986ef4b1f56bf0ac3bc45aab261e0278794c3f1","modified":1664982851823},{"_id":"public/fancybox/jquery.fancybox.js","hash":"d08b03a42d5c4ba456ef8ba33116fdbb7a9cabed","modified":1664982851823},{"_id":"public/fancybox/jquery.fancybox.pack.js","hash":"9e0d51ca1dbe66f6c0c7aefd552dc8122e694a6e","modified":1664982851823},{"_id":"public/css/fonts/fontawesome-webfont.ttf","hash":"7f09c97f333917034ad08fa7295e916c9f72fd3f","modified":1664982851823},{"_id":"public/css/images/banner.jpg","hash":"f44aa591089fcb3ec79770a1e102fd3289a7c6a6","modified":1664982851823},{"_id":"public/css/fonts/fontawesome-webfont.svg","hash":"46fcc0194d75a0ddac0a038aee41b23456784814","modified":1664982851823}],"Category":[],"Data":[],"Page":[],"Post":[{"title":"Test","date":"2022-10-05T14:04:14.000Z","_content":"\nHelloworld","source":"_posts/Test.md","raw":"---\ntitle: Test\ndate: 2022-10-05 22:04:14\ntags:\n---\n\nHelloworld","slug":"Test","published":1,"updated":"2022-10-05T14:05:09.774Z","comments":1,"layout":"post","photos":[],"link":"","_id":"cl8vrsuu800007ovq61uha7he","content":"<p>Helloworld</p>\n","site":{"data":{}},"excerpt":"","more":"<p>Helloworld</p>\n"},{"title":"Hello World","_content":"Welcome to [Hexo](https://hexo.io/)! This is your very first post. Check [documentation](https://hexo.io/docs/) for more info. If you get any problems when using Hexo, you can find the answer in [troubleshooting](https://hexo.io/docs/troubleshooting.html) or you can ask me on [GitHub](https://github.com/hexojs/hexo/issues).\n\n## Quick Start\n\n### Create a new post\n\n``` bash\n$ hexo new \"My New Post\"\n```\n\nMore info: [Writing](https://hexo.io/docs/writing.html)\n\n### Run server\n\n``` bash\n$ hexo server\n```\n\nMore info: [Server](https://hexo.io/docs/server.html)\n\n### Generate static files\n\n``` bash\n$ hexo generate\n```\n\nMore info: [Generating](https://hexo.io/docs/generating.html)\n\n### Deploy to remote sites\n\n``` bash\n$ hexo deploy\n```\n\nMore info: [Deployment](https://hexo.io/docs/one-command-deployment.html)\n","source":"_posts/hello-world.md","raw":"---\ntitle: Hello World\n---\nWelcome to [Hexo](https://hexo.io/)! This is your very first post. Check [documentation](https://hexo.io/docs/) for more info. If you get any problems when using Hexo, you can find the answer in [troubleshooting](https://hexo.io/docs/troubleshooting.html) or you can ask me on [GitHub](https://github.com/hexojs/hexo/issues).\n\n## Quick Start\n\n### Create a new post\n\n``` bash\n$ hexo new \"My New Post\"\n```\n\nMore info: [Writing](https://hexo.io/docs/writing.html)\n\n### Run server\n\n``` bash\n$ hexo server\n```\n\nMore info: [Server](https://hexo.io/docs/server.html)\n\n### Generate static files\n\n``` bash\n$ hexo generate\n```\n\nMore info: [Generating](https://hexo.io/docs/generating.html)\n\n### Deploy to remote sites\n\n``` bash\n$ hexo deploy\n```\n\nMore info: [Deployment](https://hexo.io/docs/one-command-deployment.html)\n","slug":"hello-world","published":1,"date":"2022-10-05T14:01:55.307Z","updated":"2022-10-05T13:59:24.109Z","comments":1,"layout":"post","photos":[],"link":"","_id":"cl8vrsuud00017ovqgctnb09g","content":"<p>Welcome to <a href=\"https://hexo.io/\">Hexo</a>! This is your very first post. Check <a href=\"https://hexo.io/docs/\">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href=\"https://hexo.io/docs/troubleshooting.html\">troubleshooting</a> or you can ask me on <a href=\"https://github.com/hexojs/hexo/issues\">GitHub</a>.</p>\n<h2 id=\"Quick-Start\"><a href=\"#Quick-Start\" class=\"headerlink\" title=\"Quick Start\"></a>Quick Start</h2><h3 id=\"Create-a-new-post\"><a href=\"#Create-a-new-post\" class=\"headerlink\" title=\"Create a new post\"></a>Create a new post</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo new <span class=\"string\">"My New Post"</span></span><br></pre></td></tr></table></figure>\n<p>More info: <a href=\"https://hexo.io/docs/writing.html\">Writing</a></p>\n<h3 id=\"Run-server\"><a href=\"#Run-server\" class=\"headerlink\" title=\"Run server\"></a>Run server</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo server</span><br></pre></td></tr></table></figure>\n<p>More info: <a href=\"https://hexo.io/docs/server.html\">Server</a></p>\n<h3 id=\"Generate-static-files\"><a href=\"#Generate-static-files\" class=\"headerlink\" title=\"Generate static files\"></a>Generate static files</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo generate</span><br></pre></td></tr></table></figure>\n<p>More info: <a href=\"https://hexo.io/docs/generating.html\">Generating</a></p>\n<h3 id=\"Deploy-to-remote-sites\"><a href=\"#Deploy-to-remote-sites\" class=\"headerlink\" title=\"Deploy to remote sites\"></a>Deploy to remote sites</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo deploy</span><br></pre></td></tr></table></figure>\n<p>More info: <a href=\"https://hexo.io/docs/one-command-deployment.html\">Deployment</a></p>\n","site":{"data":{}},"excerpt":"","more":"<p>Welcome to <a href=\"https://hexo.io/\">Hexo</a>! This is your very first post. Check <a href=\"https://hexo.io/docs/\">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href=\"https://hexo.io/docs/troubleshooting.html\">troubleshooting</a> or you can ask me on <a href=\"https://github.com/hexojs/hexo/issues\">GitHub</a>.</p>\n<h2 id=\"Quick-Start\"><a href=\"#Quick-Start\" class=\"headerlink\" title=\"Quick Start\"></a>Quick Start</h2><h3 id=\"Create-a-new-post\"><a href=\"#Create-a-new-post\" class=\"headerlink\" title=\"Create a new post\"></a>Create a new post</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo new <span class=\"string\">"My New Post"</span></span><br></pre></td></tr></table></figure>\n<p>More info: <a href=\"https://hexo.io/docs/writing.html\">Writing</a></p>\n<h3 id=\"Run-server\"><a href=\"#Run-server\" class=\"headerlink\" title=\"Run server\"></a>Run server</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo server</span><br></pre></td></tr></table></figure>\n<p>More info: <a href=\"https://hexo.io/docs/server.html\">Server</a></p>\n<h3 id=\"Generate-static-files\"><a href=\"#Generate-static-files\" class=\"headerlink\" title=\"Generate static files\"></a>Generate static files</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo generate</span><br></pre></td></tr></table></figure>\n<p>More info: <a href=\"https://hexo.io/docs/generating.html\">Generating</a></p>\n<h3 id=\"Deploy-to-remote-sites\"><a href=\"#Deploy-to-remote-sites\" class=\"headerlink\" title=\"Deploy to remote sites\"></a>Deploy to remote sites</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo deploy</span><br></pre></td></tr></table></figure>\n<p>More info: <a href=\"https://hexo.io/docs/one-command-deployment.html\">Deployment</a></p>\n"},{"title":"概率机器人 PART I","date":"2022-10-05T14:57:59.000Z","mathjax":true,"_content":"\n## 第二章 递归状态估计\n### 2.2 概率的基本概念\n\n**高斯分布**\n$$\n\\begin{aligned}\n p(x) &= \\frac{1}{\\sqrt{2 \\pi} \\sigma} e^{-\\frac{(x - \\mu)^2}{2\\sigma^2}} \\\\\n p(\\mathbf{x}) &= \\frac{1}{\\det {\\sqrt{2 \\pi \\boldsymbol{\\Sigma}}}}e^{-\\frac{1}{2}{(\\mathbf{x} - \\boldsymbol{\\mu})^T}\\boldsymbol{\\Sigma}^{-1}(\\mathbf{x} - \\boldsymbol{\\mu})} \n\\end{aligned}\n$$\n\n**条件独立与绝对独立之间既不充分也不必要**\n$$\n\\begin{aligned}\n & p(x, y | z ) = p(x | z) p(y | z) \\nRightarrow p(x, y) = p(x) p(y) \\\\\n & p(x, y) = p(x) p(y) \\nRightarrow p(x, y | z ) = p(x | z) p(y | z) \n\\end{aligned}\n$$\n\n**期望与协方差**\n$$\nE[X] = \\int xp(x)dx \\\\\nE[aX + b] = a E[X] + b \\\\\nD[X] = E[(X - E[X])^2] = E[X^2] - E^2[X]\n$$\n\n**熵**\n$$\nH(x) = -E[\\log_2p(x)] \n$$\n\n### 2.3 机器人环境交互\n#### 2.3.1 状态\n机器人系统中典型状态:\n- 机器人位姿\n- 机器人运动学状态,一般指关节的转动角度\n- 机器人速度、角速度\n- 环境中物体的位置和特征\n- 移动的物体和人的位置和状态\n- 潜在的其他状态量,如传感器是否故障\n\n#### 2.3.2 环境交互\n两种交互类型: 机器人通过执行机构影响环境的状态与它通过传感器收集有关状态的信息\n\n#### 2.3.3 概率生成法则\n马尔可夫性,可以称为隐马尔可夫模型(HMM)或者动态贝叶斯网络(DBN)\n$$\n\\begin{aligned}\n p(x_t | x_{0:t-1}, z_{1:t-1}, u_{1:t}) &= p(x_t | x_{t - 1}, u_t) \\\\\n p(z_t | x_{0:t-1}, z_{1:t-1}, u_{1:t}) & = p(z_t | x_t)\n\\end{aligned}\n$$\n\n#### 2.3.4 置信分布\n置信分布可以理解为状态量的后验分布,有两种后验分布\n$$\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(x_t) &= p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n\\mathrm{bel}(x_t) &= p(x_t | z_{1:t}, u_{1:t})\n\\end{aligned}\n$$\n第一种后验计算过程被称为预测,而第二种后验被称为修正或者测量更新,这两个概率为卡尔曼滤波的核心\n\n### 2.4 贝叶斯滤波\n\n#### 2.4.1 贝叶斯滤波算法\n\n```\nAlgo Bayes_filter(bel(x(t-1)), u(t), z(t)):\n for all x(t) do:\n bel_overline(x(t)) = integrate(p(x(t) | u(t), x(t - 1)) bel(x(t - 1)) dx(t-1))\n bel_(x(t)) = eta p((z(t) | x(t))) bel_overline(x(t))\n endfor\n return bel_(x(t))\n```\n\n#### 2.4.2 实例\n\n假设有一个估计门开关的传感器,初始的门开关与否的先验相同,即\n$$\np(X_0 = \\mathrm{open}) = 0.5 \\\\\np(X_0 = \\mathrm{close}) = 0.5\n$$\n且有测量模型\n$$\np(Z_t = \\mathrm{sense\\_open} | X_t = \\mathrm{open}) = 0.6 \\\\ \np(Z_t = \\mathrm{sense\\_close} | X_t = \\mathrm{open}) = 0.4 \\\\\np(Z_t = \\mathrm{sense\\_open} | X_t = \\mathrm{close}) = 0.2 \\\\\np(Z_t = \\mathrm{sense\\_close} | X_t = \\mathrm{close}) = 0.8\n$$\n机器人有推门或者啥也不干的操作,有如下的状态转移概率\n$$\np(X_t = \\mathrm{open} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{open}) = 1 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{open}) = 0 \\\\\np(X_t = \\mathrm{open} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{close}) = 0.8 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{close}) = 0.2 \\\\\np(X_t = \\mathrm{open} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{open}) = 1 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{open}) = 0 \\\\\np(X_t = \\mathrm{open} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{close}) = 0 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{close}) = 1\n$$\n\n假设在$t_1$时刻,机器人没有采用任何控制动作,但传感器检测到门时开的,此时有贝叶斯滤波计算结果如下\n$$\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(x_1) = &p(x_1 | U_1 = \\mathrm{do \\ nothing}, X_0 = \\mathrm{open}) \\mathrm{bel}(x_0 = \\mathrm{open}) + \\\\ \n&p(x_1 | U_1 = \\mathrm{do \\ nothing}, X_0 = \\mathrm{close}) \\mathrm{bel}(x_0 = \\mathrm{close})\n\\end{aligned}\n$$\n\n那么有\n$$\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(X_1 = \\mathrm{open}) &= 1 \\times 0.5 + 0 \\times 0.5 = 0.5 \\\\\n\\overline{\\mathrm{bel}}(X_1 = \\mathrm{close}) & = 0 \\times 0.5 + 1 \\times 0.5 = 0.5\n\\end{aligned}\n$$\n\n接着计算更新后的后验概率\n$$\n\\mathrm{bel}(x_1) = \\eta p(Z_1 = \\mathrm{open} | x_1) \\overline{\\mathrm{bel}}(x_1)\n$$\n\n那么有\n$$\n\\begin{aligned}\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= \\eta 0.6 \\times 0.5 = 0.3 \\eta \\\\\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= \\eta 0.2 \\times 0.5 = 0.1 \\eta\n\\end{aligned}\n$$\n\n归一化因子$\\eta = (0.3 + 0.1)^-1 = 2.5$,所以有\n$$\n\\begin{aligned}\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= 0.75 \\\\\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= 0.25\n\\end{aligned}\n$$\n\n对于$u_2 = \\mathrm{push}$并且$Z_2 = \\mathrm{open}$的情况下,此时可以计算得到\n$$\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(X_2 = \\mathrm{open}) &= 1 \\times 0.75 + 0.8 \\times 0.25 = 0.95 \\\\\n\\overline{\\mathrm{bel}}(X_2 = \\mathrm{close}) & = 0 \\times 0.75 + 0.2 \\times 0.25 = 0.05 \\\\\n\\mathrm{bel}(X_2 = \\mathrm{open}) &= \\eta 0.6 \\times 0.95 \\approx 0.983 \\\\\n\\mathrm{bel}(X_2 = \\mathrm{open}) &= \\eta 0.4 \\times 0.05 \\approx 0.017\n\\end{aligned}\n$$\n\n#### 2.4.3 贝叶斯滤波的数学推导\n首先根据贝叶斯法则后验概率有\n$$\n\\begin{aligned}\np(x_t | z_{1:t}, u_{1:t}) &= \\frac{p(z_t| x_t, z_{1:t-1}, u_{1:t}) p(x_t | z_{1:t-1}, u_{1:t})}{p(z_t | z_{1:t-1}, u_{1:t})} \\\\\n& = \\eta p(z_t| x_t, z_{1:t-1}, u_{1:t}) p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n& = \\eta p(z_t| x_t) p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n& = \\eta p(z_t| x_t) \\overline{\\mathrm{bel}}(x_{t})\n\\end{aligned}\n$$\n\n接着计算$\\overline{\\mathrm{bel}}(x_{t})$:\n$$\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(x_{t}) &= p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n& = \\int p(x_t | x_{t-1}, z_{1:t-1}, u_{1:t}) p(x_{t-1} | z_{1:t-1}, u_{1:t}) dx_{t-1} \\\\\n& = \\int p(x_t | x_{t-1}, u_{t}) p(x_{t-1} | z_{1:t-1}, u_{1:t-1}) dx_{t-1} \\\\\n& = \\int p(x_t | x_{t-1}, u_{t}) \\mathrm{bel}(x_{t-1})\n\\end{aligned}\n$$\n\n\n### 2.8 习题\n1. \n 解:\n $$\n p(x_1 = 0) = \\frac{1}{34} \\approx 0.0294 \\\\\n p(x_2 = 0) = \\frac{1}{12} \\approx 0.0833 \\\\\n \\vdots\\\\\n p(x_N = 0) = \\frac{1}{1 + 99 \\frac{1}{3^N}}\n $$\n\n2. \n 解:\n (a) $p = 0.2 * 0.4 * 0.2 = 0.016$\n (b) Day 0: 随机出一个天气; Day 1: 按照状态转移表的概率进行随机转移\n (c) ...\n (d) 设\n $$\n \\begin{aligned}\n Y_t &= \\begin{bmatrix}\n P(X_t = 1) \\\\\n p(X_t = 2) \\\\\n p(X_t = 3)\n \\end{bmatrix} \\\\\n A &= \\begin{bmatrix}\n P(X_{t+1} = 1 | X_t = 1) & P(X_{t+1} = 1 | X_t = 2) & P(X_{t+1} = 1 | X_t = 3) \\\\\n P(X_{t+1} = 2 | X_t = 1) & P(X_{t+1} = 2 | X_t = 2) & P(X_{t+1} = 2 | X_t = 3) \\\\\n P(X_{t+1} = 3 | X_t = 1) & P(X_{t+1} = 3 | X_t = 2) & P(X_{t+1} = 3 | X_t = 3)\n \\end{bmatrix} \\\\\n & = \\begin{bmatrix}\n 0.8 & 0.4 & 0.2\\\\\n 0.2 & 0.4 & 0.6 \\\\\n 0.0 & 0.2 & 0.2\n \\end{bmatrix} \n \\end{aligned}\n $$\n 有 $Y_{t+1} = A Y_t$,那么$Y_{n} = A^n Y_0$,将$A$进行相似分解为对角阵$A = P D P^{-1}$,其中$D$为\n $$\n D = \\begin{bmatrix}\n 1 & 0 & 0 \\\\\n 0 & \\frac{1 + \\sqrt{2}}{5} & 0 \\\\\n 0 & 0& \\frac{1 - \\sqrt{2}}{5}\n \\end{bmatrix} \n $$\n 由于 $$\n \\lim_{n \\rightarrow \\infty} D^n = \\begin{bmatrix}\n 1 & 0 & 0 \\\\\n 0 & 0 & 0 \\\\\n 0 & 0& 0\n \\end{bmatrix} \n $$\n 所以最终\n $$\n \\begin{aligned}\n \\lim_{n \\rightarrow \\infty} Y^n &= P \\begin{bmatrix}\n 1 & 0 & 0 \\\\\n 0 & 0 & 0 \\\\\n 0 & 0& 0\n \\end{bmatrix} P^{-1} X_0 \\\\\n & = \\begin{bmatrix}\n \\frac{9}{14} \\\\\n \\frac{2}{7} \\\\\n \\frac{1}{14} \n \\end{bmatrix}\n \\end{aligned}\n $$\n (e) \n $$\n \\begin{aligned}\n H(x) = -(\\frac{9}{14} \\log_2\\frac{9}{14} + \\frac{2}{7} \\log_2\\frac{2}{7} + \\frac{1}{14} \\log_2\\frac{1}{14})\n \\end{aligned}\n $$\n (f) 根据贝叶斯法则,用稳态时候的概率,可以计算出概率为\n $$\n \\begin{aligned}\n p(Y_{t-1} | Y_t) &= \\frac{p(Y_t | Y_{t-1}) p(Y_{t-1})}{p(Y_t)} \\\\\n &=A \\cdot \\begin{bmatrix}\n 1 & 2.25 & 9 \\\\\n 0.444 & 1 & 4 \\\\\n 0.111 & 0.25 & 1\n \\end{bmatrix} \\\\\n & = \n \\begin{bmatrix}\n 0.8 & 0.45 & 0 \\\\\n 0.18 & 0.40 & 0.80 \\\\\n 0.02 & 0.15 & 0.20\n \\end{bmatrix} \n \\end{aligned}\n $$\n\n (g) 状态转移矩阵依赖季节的话会丧失马尔可夫性,需要将季节变量引入到状态变量中恢复马尔可夫性\n\n3. \n 解:\n (a)\n\n | | $z_t$ | $\\overline{\\mathrm{bel}}(x_t)$ | ${\\mathrm{bel}}(x_t)$ | $\\eta$ |\n | --- | ----- | ---------------------------------------------- | ------------------------------------------- | ------ |\n | 1 | | | $\\begin{bmatrix}1&0&0\\end{bmatrix}^T$ | 1 |\n | 2 | 多云 | $\\begin{bmatrix}0.8&0.2&0\\end{bmatrix}^T$ | $\\begin{bmatrix}0.32&0.14&0\\end{bmatrix}^T$ | 2.17 |\n | 3 | 多云 | $\\begin{bmatrix}0.67&0.26&0.06\\end{bmatrix}^T$ | $\\begin{bmatrix}0.26&0.18&0\\end{bmatrix}^T$ | 2.27 |\n 用同样的方法向后计算,第五天时晴天的后验概率为0.4\n (b) 如果只依据以往的数据,计算后验概率,2-4最有可能的天气为晴、晴、雨,概率分别为0.89、0.87、1。利用所有数据计算后验概率,2-4最有可能的天气为晴、多云、雨,概率分别为0.8, 1.0, 1.0\n\n4. \n 解:\n (a): $p(x)$ 为一个高斯分布,测量$p(z|x)$也为一个高斯分布\n (b): 后验也为一个高斯分布\n\n## 第三章 高斯滤波\n### 3.2 卡尔曼滤波\n#### 3.2.1 线性高斯系统\n状态转移概率以及测量概率均符合高斯分布\n#### 3.2.2 卡尔曼滤波算法\n\n```\nAlgorithm Kalman_filter(mu(t-1), Sigma(t-1), u(t), z(t)):\n overline_mu(t) = A(t) mu(t-1) + B(t) u(t)\n overline_Sigma(t) = A(t) Sigma(t-1) A(t).T + R(t)\n\n K(t) = overline_sigma(t) C(t).T (C(t) overline_sigma(t) C(t).T + Q(t)).inverse()\n mu(t) = overline_mu(t) + K(t) (z(t) - C(t) overline_mu(t))\n Sigma(t) = (I - K(t) C(t)) overline_Sigma(t)\n```\n#### 3.2.4 卡尔曼滤波的数学推导\n首先根据贝叶斯滤波的预测步骤可知\n$$\n\\begin{aligned}\n \\overline{\\mathrm{bel}}(x_t) &= \\int p(x_t | x_{t-1}, u_t) {\\mathrm{bel}}(x_t-1) dx_{t-1} \\\\\n &= \\int N(A_t x_{t-1} + B_t u _t, R_t) N(\\mu_{t-1}, \\Sigma_{t-1}) dx_{t-1} \\\\\n &= \\eta \\int \\exp \\left\\{ -\\frac{1}{2}(x_t - A_t x_{t-1} - B_t u_t)^T R_t^{-1}(x_t - A_t x_{t-1} - B_t u_t)\\right\\} \\\\\n & \\quad \\exp \\left\\{-\\frac{1}{2} (x_{t-1} - \\mu_{t-1})^T \\Sigma^{-1}_{t-1} (x_{t-1} - \\mu_{t-1})\\right\\} dx_{t-1} \\\\\n & = \\eta \\int \\exp \\left\\{ -L_t\\right\\} dx_{t-1}\n\\end{aligned}\n$$\n\n其中\n$$\n\\begin{aligned}\nL_t &= \\frac{1}{2}(x_t - A_t x_{t-1} - B_t u_t)^T R_t^{-1}(x_t - A_t x_{t-1} - B_t u_t) + \\\\\n & \\quad \\frac{1}{2} (x_{t-1} - \\mu_{t-1})^T \\Sigma^{-1}_{t-1} (x_{t-1} - \\mu_{t-1})\n\\end{aligned}\n$$\n该式子可以分解为仅包含$x_t$的部分以及剩余部分,经过推导可以得知 $\\overline{\\mathrm{bel}}(x_t)$ 也为一个高斯分布,其均值为 $\\overline{\\mu}_t = A_t \\mu_{t-1} + B_t u_t$,方差为 $\\overline{\\Sigma}_t = A_t \\Sigma_{t-1}^{-1} A_t^T + R_t$\n\n更新步骤有\n$$\n\\begin{aligned}\n{\\mathrm{bel}}(x_t) &= \\eta p(z_t | x_t) \\overline{\\mathrm{bel}}(x_t) \\\\\n& = N(C_tx_t, Q_t) N(\\overline{\\mu}_t, \\overline{\\Sigma}_t)\n\\end{aligned}\n$$\n该高斯的乘积也是一个高斯分布,且\n$$\n\\mu_t = \\overline{\\mu}_t + K_t(z_t - C_t \\overline{\\mu}_t) \\\\\n\\Sigma_t = (I - K_t C_t) \\overline{\\Sigma}_t\n$$\n\n### 3.3 扩展卡尔曼滤波\n#### 3.3.3 扩展卡尔曼滤波算法\n```\nAlgorithm Extended_Kalman_filter(mu(t-1), Sigma(t-1), u(t), z(t)):\n overline_mu(t) = g(u(t), mu(t-1))\n overline_Sigma(t) = G(t) Sigma(t-1) G(t).T + R(t)\n\n K(t) = overline_sigma(t) H(t).T (H(t) overline_sigma(t) H(t).T + Q(t)).inverse()\n mu(t) = overline_mu(t) + K(t) (z(t) - h(overline_mu(t)))\n Sigma(t) = (I - K(t) H(t)) overline_Sigma(t)\n```\n\n### 3.4 无迹卡尔曼滤波\nUKF采用一些采样点来计算高斯分布,避免求导\n\n### 3.5 信息滤波\n使用正则参数表达高斯分布,与KF是对偶关系","source":"_posts/概率机器人-PART-I.md","raw":"---\ntitle: 概率机器人 PART I\ndate: 2022-10-05 22:57:59\ntags:\n- SLAM\nmathjax: true\n---\n\n## 第二章 递归状态估计\n### 2.2 概率的基本概念\n\n**高斯分布**\n$$\n\\begin{aligned}\n p(x) &= \\frac{1}{\\sqrt{2 \\pi} \\sigma} e^{-\\frac{(x - \\mu)^2}{2\\sigma^2}} \\\\\n p(\\mathbf{x}) &= \\frac{1}{\\det {\\sqrt{2 \\pi \\boldsymbol{\\Sigma}}}}e^{-\\frac{1}{2}{(\\mathbf{x} - \\boldsymbol{\\mu})^T}\\boldsymbol{\\Sigma}^{-1}(\\mathbf{x} - \\boldsymbol{\\mu})} \n\\end{aligned}\n$$\n\n**条件独立与绝对独立之间既不充分也不必要**\n$$\n\\begin{aligned}\n & p(x, y | z ) = p(x | z) p(y | z) \\nRightarrow p(x, y) = p(x) p(y) \\\\\n & p(x, y) = p(x) p(y) \\nRightarrow p(x, y | z ) = p(x | z) p(y | z) \n\\end{aligned}\n$$\n\n**期望与协方差**\n$$\nE[X] = \\int xp(x)dx \\\\\nE[aX + b] = a E[X] + b \\\\\nD[X] = E[(X - E[X])^2] = E[X^2] - E^2[X]\n$$\n\n**熵**\n$$\nH(x) = -E[\\log_2p(x)] \n$$\n\n### 2.3 机器人环境交互\n#### 2.3.1 状态\n机器人系统中典型状态:\n- 机器人位姿\n- 机器人运动学状态,一般指关节的转动角度\n- 机器人速度、角速度\n- 环境中物体的位置和特征\n- 移动的物体和人的位置和状态\n- 潜在的其他状态量,如传感器是否故障\n\n#### 2.3.2 环境交互\n两种交互类型: 机器人通过执行机构影响环境的状态与它通过传感器收集有关状态的信息\n\n#### 2.3.3 概率生成法则\n马尔可夫性,可以称为隐马尔可夫模型(HMM)或者动态贝叶斯网络(DBN)\n$$\n\\begin{aligned}\n p(x_t | x_{0:t-1}, z_{1:t-1}, u_{1:t}) &= p(x_t | x_{t - 1}, u_t) \\\\\n p(z_t | x_{0:t-1}, z_{1:t-1}, u_{1:t}) & = p(z_t | x_t)\n\\end{aligned}\n$$\n\n#### 2.3.4 置信分布\n置信分布可以理解为状态量的后验分布,有两种后验分布\n$$\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(x_t) &= p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n\\mathrm{bel}(x_t) &= p(x_t | z_{1:t}, u_{1:t})\n\\end{aligned}\n$$\n第一种后验计算过程被称为预测,而第二种后验被称为修正或者测量更新,这两个概率为卡尔曼滤波的核心\n\n### 2.4 贝叶斯滤波\n\n#### 2.4.1 贝叶斯滤波算法\n\n```\nAlgo Bayes_filter(bel(x(t-1)), u(t), z(t)):\n for all x(t) do:\n bel_overline(x(t)) = integrate(p(x(t) | u(t), x(t - 1)) bel(x(t - 1)) dx(t-1))\n bel_(x(t)) = eta p((z(t) | x(t))) bel_overline(x(t))\n endfor\n return bel_(x(t))\n```\n\n#### 2.4.2 实例\n\n假设有一个估计门开关的传感器,初始的门开关与否的先验相同,即\n$$\np(X_0 = \\mathrm{open}) = 0.5 \\\\\np(X_0 = \\mathrm{close}) = 0.5\n$$\n且有测量模型\n$$\np(Z_t = \\mathrm{sense\\_open} | X_t = \\mathrm{open}) = 0.6 \\\\ \np(Z_t = \\mathrm{sense\\_close} | X_t = \\mathrm{open}) = 0.4 \\\\\np(Z_t = \\mathrm{sense\\_open} | X_t = \\mathrm{close}) = 0.2 \\\\\np(Z_t = \\mathrm{sense\\_close} | X_t = \\mathrm{close}) = 0.8\n$$\n机器人有推门或者啥也不干的操作,有如下的状态转移概率\n$$\np(X_t = \\mathrm{open} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{open}) = 1 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{open}) = 0 \\\\\np(X_t = \\mathrm{open} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{close}) = 0.8 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{close}) = 0.2 \\\\\np(X_t = \\mathrm{open} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{open}) = 1 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{open}) = 0 \\\\\np(X_t = \\mathrm{open} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{close}) = 0 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{close}) = 1\n$$\n\n假设在$t_1$时刻,机器人没有采用任何控制动作,但传感器检测到门时开的,此时有贝叶斯滤波计算结果如下\n$$\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(x_1) = &p(x_1 | U_1 = \\mathrm{do \\ nothing}, X_0 = \\mathrm{open}) \\mathrm{bel}(x_0 = \\mathrm{open}) + \\\\ \n&p(x_1 | U_1 = \\mathrm{do \\ nothing}, X_0 = \\mathrm{close}) \\mathrm{bel}(x_0 = \\mathrm{close})\n\\end{aligned}\n$$\n\n那么有\n$$\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(X_1 = \\mathrm{open}) &= 1 \\times 0.5 + 0 \\times 0.5 = 0.5 \\\\\n\\overline{\\mathrm{bel}}(X_1 = \\mathrm{close}) & = 0 \\times 0.5 + 1 \\times 0.5 = 0.5\n\\end{aligned}\n$$\n\n接着计算更新后的后验概率\n$$\n\\mathrm{bel}(x_1) = \\eta p(Z_1 = \\mathrm{open} | x_1) \\overline{\\mathrm{bel}}(x_1)\n$$\n\n那么有\n$$\n\\begin{aligned}\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= \\eta 0.6 \\times 0.5 = 0.3 \\eta \\\\\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= \\eta 0.2 \\times 0.5 = 0.1 \\eta\n\\end{aligned}\n$$\n\n归一化因子$\\eta = (0.3 + 0.1)^-1 = 2.5$,所以有\n$$\n\\begin{aligned}\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= 0.75 \\\\\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= 0.25\n\\end{aligned}\n$$\n\n对于$u_2 = \\mathrm{push}$并且$Z_2 = \\mathrm{open}$的情况下,此时可以计算得到\n$$\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(X_2 = \\mathrm{open}) &= 1 \\times 0.75 + 0.8 \\times 0.25 = 0.95 \\\\\n\\overline{\\mathrm{bel}}(X_2 = \\mathrm{close}) & = 0 \\times 0.75 + 0.2 \\times 0.25 = 0.05 \\\\\n\\mathrm{bel}(X_2 = \\mathrm{open}) &= \\eta 0.6 \\times 0.95 \\approx 0.983 \\\\\n\\mathrm{bel}(X_2 = \\mathrm{open}) &= \\eta 0.4 \\times 0.05 \\approx 0.017\n\\end{aligned}\n$$\n\n#### 2.4.3 贝叶斯滤波的数学推导\n首先根据贝叶斯法则后验概率有\n$$\n\\begin{aligned}\np(x_t | z_{1:t}, u_{1:t}) &= \\frac{p(z_t| x_t, z_{1:t-1}, u_{1:t}) p(x_t | z_{1:t-1}, u_{1:t})}{p(z_t | z_{1:t-1}, u_{1:t})} \\\\\n& = \\eta p(z_t| x_t, z_{1:t-1}, u_{1:t}) p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n& = \\eta p(z_t| x_t) p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n& = \\eta p(z_t| x_t) \\overline{\\mathrm{bel}}(x_{t})\n\\end{aligned}\n$$\n\n接着计算$\\overline{\\mathrm{bel}}(x_{t})$:\n$$\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(x_{t}) &= p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n& = \\int p(x_t | x_{t-1}, z_{1:t-1}, u_{1:t}) p(x_{t-1} | z_{1:t-1}, u_{1:t}) dx_{t-1} \\\\\n& = \\int p(x_t | x_{t-1}, u_{t}) p(x_{t-1} | z_{1:t-1}, u_{1:t-1}) dx_{t-1} \\\\\n& = \\int p(x_t | x_{t-1}, u_{t}) \\mathrm{bel}(x_{t-1})\n\\end{aligned}\n$$\n\n\n### 2.8 习题\n1. \n 解:\n $$\n p(x_1 = 0) = \\frac{1}{34} \\approx 0.0294 \\\\\n p(x_2 = 0) = \\frac{1}{12} \\approx 0.0833 \\\\\n \\vdots\\\\\n p(x_N = 0) = \\frac{1}{1 + 99 \\frac{1}{3^N}}\n $$\n\n2. \n 解:\n (a) $p = 0.2 * 0.4 * 0.2 = 0.016$\n (b) Day 0: 随机出一个天气; Day 1: 按照状态转移表的概率进行随机转移\n (c) ...\n (d) 设\n $$\n \\begin{aligned}\n Y_t &= \\begin{bmatrix}\n P(X_t = 1) \\\\\n p(X_t = 2) \\\\\n p(X_t = 3)\n \\end{bmatrix} \\\\\n A &= \\begin{bmatrix}\n P(X_{t+1} = 1 | X_t = 1) & P(X_{t+1} = 1 | X_t = 2) & P(X_{t+1} = 1 | X_t = 3) \\\\\n P(X_{t+1} = 2 | X_t = 1) & P(X_{t+1} = 2 | X_t = 2) & P(X_{t+1} = 2 | X_t = 3) \\\\\n P(X_{t+1} = 3 | X_t = 1) & P(X_{t+1} = 3 | X_t = 2) & P(X_{t+1} = 3 | X_t = 3)\n \\end{bmatrix} \\\\\n & = \\begin{bmatrix}\n 0.8 & 0.4 & 0.2\\\\\n 0.2 & 0.4 & 0.6 \\\\\n 0.0 & 0.2 & 0.2\n \\end{bmatrix} \n \\end{aligned}\n $$\n 有 $Y_{t+1} = A Y_t$,那么$Y_{n} = A^n Y_0$,将$A$进行相似分解为对角阵$A = P D P^{-1}$,其中$D$为\n $$\n D = \\begin{bmatrix}\n 1 & 0 & 0 \\\\\n 0 & \\frac{1 + \\sqrt{2}}{5} & 0 \\\\\n 0 & 0& \\frac{1 - \\sqrt{2}}{5}\n \\end{bmatrix} \n $$\n 由于 $$\n \\lim_{n \\rightarrow \\infty} D^n = \\begin{bmatrix}\n 1 & 0 & 0 \\\\\n 0 & 0 & 0 \\\\\n 0 & 0& 0\n \\end{bmatrix} \n $$\n 所以最终\n $$\n \\begin{aligned}\n \\lim_{n \\rightarrow \\infty} Y^n &= P \\begin{bmatrix}\n 1 & 0 & 0 \\\\\n 0 & 0 & 0 \\\\\n 0 & 0& 0\n \\end{bmatrix} P^{-1} X_0 \\\\\n & = \\begin{bmatrix}\n \\frac{9}{14} \\\\\n \\frac{2}{7} \\\\\n \\frac{1}{14} \n \\end{bmatrix}\n \\end{aligned}\n $$\n (e) \n $$\n \\begin{aligned}\n H(x) = -(\\frac{9}{14} \\log_2\\frac{9}{14} + \\frac{2}{7} \\log_2\\frac{2}{7} + \\frac{1}{14} \\log_2\\frac{1}{14})\n \\end{aligned}\n $$\n (f) 根据贝叶斯法则,用稳态时候的概率,可以计算出概率为\n $$\n \\begin{aligned}\n p(Y_{t-1} | Y_t) &= \\frac{p(Y_t | Y_{t-1}) p(Y_{t-1})}{p(Y_t)} \\\\\n &=A \\cdot \\begin{bmatrix}\n 1 & 2.25 & 9 \\\\\n 0.444 & 1 & 4 \\\\\n 0.111 & 0.25 & 1\n \\end{bmatrix} \\\\\n & = \n \\begin{bmatrix}\n 0.8 & 0.45 & 0 \\\\\n 0.18 & 0.40 & 0.80 \\\\\n 0.02 & 0.15 & 0.20\n \\end{bmatrix} \n \\end{aligned}\n $$\n\n (g) 状态转移矩阵依赖季节的话会丧失马尔可夫性,需要将季节变量引入到状态变量中恢复马尔可夫性\n\n3. \n 解:\n (a)\n\n | | $z_t$ | $\\overline{\\mathrm{bel}}(x_t)$ | ${\\mathrm{bel}}(x_t)$ | $\\eta$ |\n | --- | ----- | ---------------------------------------------- | ------------------------------------------- | ------ |\n | 1 | | | $\\begin{bmatrix}1&0&0\\end{bmatrix}^T$ | 1 |\n | 2 | 多云 | $\\begin{bmatrix}0.8&0.2&0\\end{bmatrix}^T$ | $\\begin{bmatrix}0.32&0.14&0\\end{bmatrix}^T$ | 2.17 |\n | 3 | 多云 | $\\begin{bmatrix}0.67&0.26&0.06\\end{bmatrix}^T$ | $\\begin{bmatrix}0.26&0.18&0\\end{bmatrix}^T$ | 2.27 |\n 用同样的方法向后计算,第五天时晴天的后验概率为0.4\n (b) 如果只依据以往的数据,计算后验概率,2-4最有可能的天气为晴、晴、雨,概率分别为0.89、0.87、1。利用所有数据计算后验概率,2-4最有可能的天气为晴、多云、雨,概率分别为0.8, 1.0, 1.0\n\n4. \n 解:\n (a): $p(x)$ 为一个高斯分布,测量$p(z|x)$也为一个高斯分布\n (b): 后验也为一个高斯分布\n\n## 第三章 高斯滤波\n### 3.2 卡尔曼滤波\n#### 3.2.1 线性高斯系统\n状态转移概率以及测量概率均符合高斯分布\n#### 3.2.2 卡尔曼滤波算法\n\n```\nAlgorithm Kalman_filter(mu(t-1), Sigma(t-1), u(t), z(t)):\n overline_mu(t) = A(t) mu(t-1) + B(t) u(t)\n overline_Sigma(t) = A(t) Sigma(t-1) A(t).T + R(t)\n\n K(t) = overline_sigma(t) C(t).T (C(t) overline_sigma(t) C(t).T + Q(t)).inverse()\n mu(t) = overline_mu(t) + K(t) (z(t) - C(t) overline_mu(t))\n Sigma(t) = (I - K(t) C(t)) overline_Sigma(t)\n```\n#### 3.2.4 卡尔曼滤波的数学推导\n首先根据贝叶斯滤波的预测步骤可知\n$$\n\\begin{aligned}\n \\overline{\\mathrm{bel}}(x_t) &= \\int p(x_t | x_{t-1}, u_t) {\\mathrm{bel}}(x_t-1) dx_{t-1} \\\\\n &= \\int N(A_t x_{t-1} + B_t u _t, R_t) N(\\mu_{t-1}, \\Sigma_{t-1}) dx_{t-1} \\\\\n &= \\eta \\int \\exp \\left\\{ -\\frac{1}{2}(x_t - A_t x_{t-1} - B_t u_t)^T R_t^{-1}(x_t - A_t x_{t-1} - B_t u_t)\\right\\} \\\\\n & \\quad \\exp \\left\\{-\\frac{1}{2} (x_{t-1} - \\mu_{t-1})^T \\Sigma^{-1}_{t-1} (x_{t-1} - \\mu_{t-1})\\right\\} dx_{t-1} \\\\\n & = \\eta \\int \\exp \\left\\{ -L_t\\right\\} dx_{t-1}\n\\end{aligned}\n$$\n\n其中\n$$\n\\begin{aligned}\nL_t &= \\frac{1}{2}(x_t - A_t x_{t-1} - B_t u_t)^T R_t^{-1}(x_t - A_t x_{t-1} - B_t u_t) + \\\\\n & \\quad \\frac{1}{2} (x_{t-1} - \\mu_{t-1})^T \\Sigma^{-1}_{t-1} (x_{t-1} - \\mu_{t-1})\n\\end{aligned}\n$$\n该式子可以分解为仅包含$x_t$的部分以及剩余部分,经过推导可以得知 $\\overline{\\mathrm{bel}}(x_t)$ 也为一个高斯分布,其均值为 $\\overline{\\mu}_t = A_t \\mu_{t-1} + B_t u_t$,方差为 $\\overline{\\Sigma}_t = A_t \\Sigma_{t-1}^{-1} A_t^T + R_t$\n\n更新步骤有\n$$\n\\begin{aligned}\n{\\mathrm{bel}}(x_t) &= \\eta p(z_t | x_t) \\overline{\\mathrm{bel}}(x_t) \\\\\n& = N(C_tx_t, Q_t) N(\\overline{\\mu}_t, \\overline{\\Sigma}_t)\n\\end{aligned}\n$$\n该高斯的乘积也是一个高斯分布,且\n$$\n\\mu_t = \\overline{\\mu}_t + K_t(z_t - C_t \\overline{\\mu}_t) \\\\\n\\Sigma_t = (I - K_t C_t) \\overline{\\Sigma}_t\n$$\n\n### 3.3 扩展卡尔曼滤波\n#### 3.3.3 扩展卡尔曼滤波算法\n```\nAlgorithm Extended_Kalman_filter(mu(t-1), Sigma(t-1), u(t), z(t)):\n overline_mu(t) = g(u(t), mu(t-1))\n overline_Sigma(t) = G(t) Sigma(t-1) G(t).T + R(t)\n\n K(t) = overline_sigma(t) H(t).T (H(t) overline_sigma(t) H(t).T + Q(t)).inverse()\n mu(t) = overline_mu(t) + K(t) (z(t) - h(overline_mu(t)))\n Sigma(t) = (I - K(t) H(t)) overline_Sigma(t)\n```\n\n### 3.4 无迹卡尔曼滤波\nUKF采用一些采样点来计算高斯分布,避免求导\n\n### 3.5 信息滤波\n使用正则参数表达高斯分布,与KF是对偶关系","slug":"概率机器人-PART-I","published":1,"updated":"2022-10-06T07:29:29.012Z","_id":"cl8vrsuue00027ovqadvqb3gz","comments":1,"layout":"post","photos":[],"link":"","content":"<h2 id=\"第二章-递归状态估计\"><a href=\"#第二章-递归状态估计\" class=\"headerlink\" title=\"第二章 递归状态估计\"></a>第二章 递归状态估计</h2><h3 id=\"2-2-概率的基本概念\"><a href=\"#2-2-概率的基本概念\" class=\"headerlink\" title=\"2.2 概率的基本概念\"></a>2.2 概率的基本概念</h3><p><strong>高斯分布</strong></p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n p(x) &= \\frac{1}{\\sqrt{2 \\pi} \\sigma} e^{-\\frac{(x - \\mu)^2}{2\\sigma^2}} \\\\\n p(\\mathbf{x}) &= \\frac{1}{\\det {\\sqrt{2 \\pi \\boldsymbol{\\Sigma}}}}e^{-\\frac{1}{2}{(\\mathbf{x} - \\boldsymbol{\\mu})^T}\\boldsymbol{\\Sigma}^{-1}(\\mathbf{x} - \\boldsymbol{\\mu})} \n\\end{aligned}</script><p><strong>条件独立与绝对独立之间既不充分也不必要</strong></p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n & p(x, y | z ) = p(x | z) p(y | z) \\nRightarrow p(x, y) = p(x) p(y) \\\\\n & p(x, y) = p(x) p(y) \\nRightarrow p(x, y | z ) = p(x | z) p(y | z) \n\\end{aligned}</script><p><strong>期望与协方差</strong></p>\n<script type=\"math/tex; mode=display\">\nE[X] = \\int xp(x)dx \\\\\nE[aX + b] = a E[X] + b \\\\\nD[X] = E[(X - E[X])^2] = E[X^2] - E^2[X]</script><p><strong>熵</strong></p>\n<script type=\"math/tex; mode=display\">\nH(x) = -E[\\log_2p(x)]</script><h3 id=\"2-3-机器人环境交互\"><a href=\"#2-3-机器人环境交互\" class=\"headerlink\" title=\"2.3 机器人环境交互\"></a>2.3 机器人环境交互</h3><h4 id=\"2-3-1-状态\"><a href=\"#2-3-1-状态\" class=\"headerlink\" title=\"2.3.1 状态\"></a>2.3.1 状态</h4><p>机器人系统中典型状态:</p>\n<ul>\n<li>机器人位姿</li>\n<li>机器人运动学状态,一般指关节的转动角度</li>\n<li>机器人速度、角速度</li>\n<li>环境中物体的位置和特征</li>\n<li>移动的物体和人的位置和状态</li>\n<li>潜在的其他状态量,如传感器是否故障</li>\n</ul>\n<h4 id=\"2-3-2-环境交互\"><a href=\"#2-3-2-环境交互\" class=\"headerlink\" title=\"2.3.2 环境交互\"></a>2.3.2 环境交互</h4><p>两种交互类型: 机器人通过执行机构影响环境的状态与它通过传感器收集有关状态的信息</p>\n<h4 id=\"2-3-3-概率生成法则\"><a href=\"#2-3-3-概率生成法则\" class=\"headerlink\" title=\"2.3.3 概率生成法则\"></a>2.3.3 概率生成法则</h4><p>马尔可夫性,可以称为隐马尔可夫模型(HMM)或者动态贝叶斯网络(DBN)</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n p(x_t | x_{0:t-1}, z_{1:t-1}, u_{1:t}) &= p(x_t | x_{t - 1}, u_t) \\\\\n p(z_t | x_{0:t-1}, z_{1:t-1}, u_{1:t}) & = p(z_t | x_t)\n\\end{aligned}</script><h4 id=\"2-3-4-置信分布\"><a href=\"#2-3-4-置信分布\" class=\"headerlink\" title=\"2.3.4 置信分布\"></a>2.3.4 置信分布</h4><p>置信分布可以理解为状态量的后验分布,有两种后验分布</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(x_t) &= p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n\\mathrm{bel}(x_t) &= p(x_t | z_{1:t}, u_{1:t})\n\\end{aligned}</script><p>第一种后验计算过程被称为预测,而第二种后验被称为修正或者测量更新,这两个概率为卡尔曼滤波的核心</p>\n<h3 id=\"2-4-贝叶斯滤波\"><a href=\"#2-4-贝叶斯滤波\" class=\"headerlink\" title=\"2.4 贝叶斯滤波\"></a>2.4 贝叶斯滤波</h3><h4 id=\"2-4-1-贝叶斯滤波算法\"><a href=\"#2-4-1-贝叶斯滤波算法\" class=\"headerlink\" title=\"2.4.1 贝叶斯滤波算法\"></a>2.4.1 贝叶斯滤波算法</h4><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">Algo Bayes_filter(bel(x(t-1)), u(t), z(t)):</span><br><span class=\"line\"> for all x(t) do:</span><br><span class=\"line\"> bel_overline(x(t)) = integrate(p(x(t) | u(t), x(t - 1)) bel(x(t - 1)) dx(t-1))</span><br><span class=\"line\"> bel_(x(t)) = eta p((z(t) | x(t))) bel_overline(x(t))</span><br><span class=\"line\"> endfor</span><br><span class=\"line\"> return bel_(x(t))</span><br></pre></td></tr></table></figure>\n<h4 id=\"2-4-2-实例\"><a href=\"#2-4-2-实例\" class=\"headerlink\" title=\"2.4.2 实例\"></a>2.4.2 实例</h4><p>假设有一个估计门开关的传感器,初始的门开关与否的先验相同,即</p>\n<script type=\"math/tex; mode=display\">\np(X_0 = \\mathrm{open}) = 0.5 \\\\\np(X_0 = \\mathrm{close}) = 0.5</script><p>且有测量模型</p>\n<script type=\"math/tex; mode=display\">\np(Z_t = \\mathrm{sense\\_open} | X_t = \\mathrm{open}) = 0.6 \\\\ \np(Z_t = \\mathrm{sense\\_close} | X_t = \\mathrm{open}) = 0.4 \\\\\np(Z_t = \\mathrm{sense\\_open} | X_t = \\mathrm{close}) = 0.2 \\\\\np(Z_t = \\mathrm{sense\\_close} | X_t = \\mathrm{close}) = 0.8</script><p>机器人有推门或者啥也不干的操作,有如下的状态转移概率</p>\n<script type=\"math/tex; mode=display\">\np(X_t = \\mathrm{open} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{open}) = 1 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{open}) = 0 \\\\\np(X_t = \\mathrm{open} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{close}) = 0.8 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{close}) = 0.2 \\\\\np(X_t = \\mathrm{open} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{open}) = 1 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{open}) = 0 \\\\\np(X_t = \\mathrm{open} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{close}) = 0 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{close}) = 1</script><p>假设在$t_1$时刻,机器人没有采用任何控制动作,但传感器检测到门时开的,此时有贝叶斯滤波计算结果如下</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(x_1) = &p(x_1 | U_1 = \\mathrm{do \\ nothing}, X_0 = \\mathrm{open}) \\mathrm{bel}(x_0 = \\mathrm{open}) + \\\\ \n&p(x_1 | U_1 = \\mathrm{do \\ nothing}, X_0 = \\mathrm{close}) \\mathrm{bel}(x_0 = \\mathrm{close})\n\\end{aligned}</script><p>那么有</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(X_1 = \\mathrm{open}) &= 1 \\times 0.5 + 0 \\times 0.5 = 0.5 \\\\\n\\overline{\\mathrm{bel}}(X_1 = \\mathrm{close}) & = 0 \\times 0.5 + 1 \\times 0.5 = 0.5\n\\end{aligned}</script><p>接着计算更新后的后验概率</p>\n<script type=\"math/tex; mode=display\">\n\\mathrm{bel}(x_1) = \\eta p(Z_1 = \\mathrm{open} | x_1) \\overline{\\mathrm{bel}}(x_1)</script><p>那么有</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= \\eta 0.6 \\times 0.5 = 0.3 \\eta \\\\\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= \\eta 0.2 \\times 0.5 = 0.1 \\eta\n\\end{aligned}</script><p>归一化因子$\\eta = (0.3 + 0.1)^-1 = 2.5$,所以有</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= 0.75 \\\\\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= 0.25\n\\end{aligned}</script><p>对于$u_2 = \\mathrm{push}$并且$Z_2 = \\mathrm{open}$的情况下,此时可以计算得到</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(X_2 = \\mathrm{open}) &= 1 \\times 0.75 + 0.8 \\times 0.25 = 0.95 \\\\\n\\overline{\\mathrm{bel}}(X_2 = \\mathrm{close}) & = 0 \\times 0.75 + 0.2 \\times 0.25 = 0.05 \\\\\n\\mathrm{bel}(X_2 = \\mathrm{open}) &= \\eta 0.6 \\times 0.95 \\approx 0.983 \\\\\n\\mathrm{bel}(X_2 = \\mathrm{open}) &= \\eta 0.4 \\times 0.05 \\approx 0.017\n\\end{aligned}</script><h4 id=\"2-4-3-贝叶斯滤波的数学推导\"><a href=\"#2-4-3-贝叶斯滤波的数学推导\" class=\"headerlink\" title=\"2.4.3 贝叶斯滤波的数学推导\"></a>2.4.3 贝叶斯滤波的数学推导</h4><p>首先根据贝叶斯法则后验概率有</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\np(x_t | z_{1:t}, u_{1:t}) &= \\frac{p(z_t| x_t, z_{1:t-1}, u_{1:t}) p(x_t | z_{1:t-1}, u_{1:t})}{p(z_t | z_{1:t-1}, u_{1:t})} \\\\\n& = \\eta p(z_t| x_t, z_{1:t-1}, u_{1:t}) p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n& = \\eta p(z_t| x_t) p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n& = \\eta p(z_t| x_t) \\overline{\\mathrm{bel}}(x_{t})\n\\end{aligned}</script><p>接着计算$\\overline{\\mathrm{bel}}(x_{t})$:</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(x_{t}) &= p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n& = \\int p(x_t | x_{t-1}, z_{1:t-1}, u_{1:t}) p(x_{t-1} | z_{1:t-1}, u_{1:t}) dx_{t-1} \\\\\n& = \\int p(x_t | x_{t-1}, u_{t}) p(x_{t-1} | z_{1:t-1}, u_{1:t-1}) dx_{t-1} \\\\\n& = \\int p(x_t | x_{t-1}, u_{t}) \\mathrm{bel}(x_{t-1})\n\\end{aligned}</script><h3 id=\"2-8-习题\"><a href=\"#2-8-习题\" class=\"headerlink\" title=\"2.8 习题\"></a>2.8 习题</h3><ol>\n<li><p>解:</p>\n<script type=\"math/tex; mode=display\">\np(x_1 = 0) = \\frac{1}{34} \\approx 0.0294 \\\\\np(x_2 = 0) = \\frac{1}{12} \\approx 0.0833 \\\\\n\\vdots\\\\\np(x_N = 0) = \\frac{1}{1 + 99 \\frac{1}{3^N}}</script></li>\n<li><p> 解:<br> (a) $p = 0.2 <em> 0.4 </em> 0.2 = 0.016$<br> (b) Day 0: 随机出一个天气; Day 1: 按照状态转移表的概率进行随机转移<br> (c) …<br> (d) 设</p>\n<pre><code> $$\n \\begin{aligned}\n Y_t &= \\begin{bmatrix}\n P(X_t = 1) \\\\\n p(X_t = 2) \\\\\n p(X_t = 3)\n \\end{bmatrix} \\\\\n A &= \\begin{bmatrix}\n P(X_{t+1} = 1 | X_t = 1) & P(X_{t+1} = 1 | X_t = 2) & P(X_{t+1} = 1 | X_t = 3) \\\\\n P(X_{t+1} = 2 | X_t = 1) & P(X_{t+1} = 2 | X_t = 2) & P(X_{t+1} = 2 | X_t = 3) \\\\\n P(X_{t+1} = 3 | X_t = 1) & P(X_{t+1} = 3 | X_t = 2) & P(X_{t+1} = 3 | X_t = 3)\n \\end{bmatrix} \\\\\n & = \\begin{bmatrix}\n 0.8 & 0.4 & 0.2\\\\\n 0.2 & 0.4 & 0.6 \\\\\n 0.0 & 0.2 & 0.2\n \\end{bmatrix} \n \\end{aligned}\n $$\n 有 $Y_{t+1} = A Y_t$,那么$Y_{n} = A^n Y_0$,将$A$进行相似分解为对角阵$A = P D P^{-1}$,其中$D$为\n $$\n D = \\begin{bmatrix}\n 1 & 0 & 0 \\\\\n 0 & \\frac{1 + \\sqrt{2}}{5} & 0 \\\\\n 0 & 0& \\frac{1 - \\sqrt{2}}{5}\n \\end{bmatrix} \n $$\n 由于 $$\n \\lim_{n \\rightarrow \\infty} D^n = \\begin{bmatrix}\n 1 & 0 & 0 \\\\\n 0 & 0 & 0 \\\\\n 0 & 0& 0\n \\end{bmatrix} \n $$\n 所以最终\n $$\n \\begin{aligned}\n \\lim_{n \\rightarrow \\infty} Y^n &= P \\begin{bmatrix}\n 1 & 0 & 0 \\\\\n 0 & 0 & 0 \\\\\n 0 & 0& 0\n \\end{bmatrix} P^{-1} X_0 \\\\\n & = \\begin{bmatrix}\n \\frac{9}{14} \\\\\n \\frac{2}{7} \\\\\n \\frac{1}{14} \n \\end{bmatrix}\n \\end{aligned}\n $$\n</code></pre><p> (e) </p>\n<pre><code> $$\n \\begin{aligned}\n H(x) = -(\\frac{9}{14} \\log_2\\frac{9}{14} + \\frac{2}{7} \\log_2\\frac{2}{7} + \\frac{1}{14} \\log_2\\frac{1}{14})\n \\end{aligned}\n $$\n</code></pre><p> (f) 根据贝叶斯法则,用稳态时候的概率,可以计算出概率为</p>\n<pre><code> $$\n \\begin{aligned}\n p(Y_{t-1} | Y_t) &= \\frac{p(Y_t | Y_{t-1}) p(Y_{t-1})}{p(Y_t)} \\\\\n &=A \\cdot \\begin{bmatrix}\n 1 & 2.25 & 9 \\\\\n 0.444 & 1 & 4 \\\\\n 0.111 & 0.25 & 1\n \\end{bmatrix} \\\\\n & = \n \\begin{bmatrix}\n 0.8 & 0.45 & 0 \\\\\n 0.18 & 0.40 & 0.80 \\\\\n 0.02 & 0.15 & 0.20\n \\end{bmatrix} \n \\end{aligned}\n $$\n</code></pre><p> (g) 状态转移矩阵依赖季节的话会丧失马尔可夫性,需要将季节变量引入到状态变量中恢复马尔可夫性</p>\n</li>\n<li><p>解:<br>(a)</p>\n<p> | | $z_t$ | $\\overline{\\mathrm{bel}}(x_t)$ | ${\\mathrm{bel}}(x_t)$ | $\\eta$ |<br> | —- | ——- | ——————————————————————— | —————————————————————- | ——— |<br> | 1 | | | $\\begin{bmatrix}1&0&0\\end{bmatrix}^T$ | 1 |<br> | 2 | 多云 | $\\begin{bmatrix}0.8&0.2&0\\end{bmatrix}^T$ | $\\begin{bmatrix}0.32&0.14&0\\end{bmatrix}^T$ | 2.17 |<br> | 3 | 多云 | $\\begin{bmatrix}0.67&0.26&0.06\\end{bmatrix}^T$ | $\\begin{bmatrix}0.26&0.18&0\\end{bmatrix}^T$ | 2.27 |<br> 用同样的方法向后计算,第五天时晴天的后验概率为0.4<br>(b) 如果只依据以往的数据,计算后验概率,2-4最有可能的天气为晴、晴、雨,概率分别为0.89、0.87、1。利用所有数据计算后验概率,2-4最有可能的天气为晴、多云、雨,概率分别为0.8, 1.0, 1.0</p>\n</li>\n<li><p>解:<br>(a): $p(x)$ 为一个高斯分布,测量$p(z|x)$也为一个高斯分布<br>(b): 后验也为一个高斯分布</p>\n</li>\n</ol>\n<h2 id=\"第三章-高斯滤波\"><a href=\"#第三章-高斯滤波\" class=\"headerlink\" title=\"第三章 高斯滤波\"></a>第三章 高斯滤波</h2><h3 id=\"3-2-卡尔曼滤波\"><a href=\"#3-2-卡尔曼滤波\" class=\"headerlink\" title=\"3.2 卡尔曼滤波\"></a>3.2 卡尔曼滤波</h3><h4 id=\"3-2-1-线性高斯系统\"><a href=\"#3-2-1-线性高斯系统\" class=\"headerlink\" title=\"3.2.1 线性高斯系统\"></a>3.2.1 线性高斯系统</h4><p>状态转移概率以及测量概率均符合高斯分布</p>\n<h4 id=\"3-2-2-卡尔曼滤波算法\"><a href=\"#3-2-2-卡尔曼滤波算法\" class=\"headerlink\" title=\"3.2.2 卡尔曼滤波算法\"></a>3.2.2 卡尔曼滤波算法</h4><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">Algorithm Kalman_filter(mu(t-1), Sigma(t-1), u(t), z(t)):</span><br><span class=\"line\"> overline_mu(t) = A(t) mu(t-1) + B(t) u(t)</span><br><span class=\"line\"> overline_Sigma(t) = A(t) Sigma(t-1) A(t).T + R(t)</span><br><span class=\"line\"></span><br><span class=\"line\"> K(t) = overline_sigma(t) C(t).T (C(t) overline_sigma(t) C(t).T + Q(t)).inverse()</span><br><span class=\"line\"> mu(t) = overline_mu(t) + K(t) (z(t) - C(t) overline_mu(t))</span><br><span class=\"line\"> Sigma(t) = (I - K(t) C(t)) overline_Sigma(t)</span><br></pre></td></tr></table></figure>\n<h4 id=\"3-2-4-卡尔曼滤波的数学推导\"><a href=\"#3-2-4-卡尔曼滤波的数学推导\" class=\"headerlink\" title=\"3.2.4 卡尔曼滤波的数学推导\"></a>3.2.4 卡尔曼滤波的数学推导</h4><p>首先根据贝叶斯滤波的预测步骤可知</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n \\overline{\\mathrm{bel}}(x_t) &= \\int p(x_t | x_{t-1}, u_t) {\\mathrm{bel}}(x_t-1) dx_{t-1} \\\\\n &= \\int N(A_t x_{t-1} + B_t u _t, R_t) N(\\mu_{t-1}, \\Sigma_{t-1}) dx_{t-1} \\\\\n &= \\eta \\int \\exp \\left\\{ -\\frac{1}{2}(x_t - A_t x_{t-1} - B_t u_t)^T R_t^{-1}(x_t - A_t x_{t-1} - B_t u_t)\\right\\} \\\\\n & \\quad \\exp \\left\\{-\\frac{1}{2} (x_{t-1} - \\mu_{t-1})^T \\Sigma^{-1}_{t-1} (x_{t-1} - \\mu_{t-1})\\right\\} dx_{t-1} \\\\\n & = \\eta \\int \\exp \\left\\{ -L_t\\right\\} dx_{t-1}\n\\end{aligned}</script><p>其中</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\nL_t &= \\frac{1}{2}(x_t - A_t x_{t-1} - B_t u_t)^T R_t^{-1}(x_t - A_t x_{t-1} - B_t u_t) + \\\\\n & \\quad \\frac{1}{2} (x_{t-1} - \\mu_{t-1})^T \\Sigma^{-1}_{t-1} (x_{t-1} - \\mu_{t-1})\n\\end{aligned}</script><p>该式子可以分解为仅包含$x_t$的部分以及剩余部分,经过推导可以得知 $\\overline{\\mathrm{bel}}(x_t)$ 也为一个高斯分布,其均值为 $\\overline{\\mu}_t = A_t \\mu_{t-1} + B_t u_t$,方差为 $\\overline{\\Sigma}_t = A_t \\Sigma_{t-1}^{-1} A_t^T + R_t$</p>\n<p>更新步骤有</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n{\\mathrm{bel}}(x_t) &= \\eta p(z_t | x_t) \\overline{\\mathrm{bel}}(x_t) \\\\\n& = N(C_tx_t, Q_t) N(\\overline{\\mu}_t, \\overline{\\Sigma}_t)\n\\end{aligned}</script><p>该高斯的乘积也是一个高斯分布,且</p>\n<script type=\"math/tex; mode=display\">\n\\mu_t = \\overline{\\mu}_t + K_t(z_t - C_t \\overline{\\mu}_t) \\\\\n\\Sigma_t = (I - K_t C_t) \\overline{\\Sigma}_t</script><h3 id=\"3-3-扩展卡尔曼滤波\"><a href=\"#3-3-扩展卡尔曼滤波\" class=\"headerlink\" title=\"3.3 扩展卡尔曼滤波\"></a>3.3 扩展卡尔曼滤波</h3><h4 id=\"3-3-3-扩展卡尔曼滤波算法\"><a href=\"#3-3-3-扩展卡尔曼滤波算法\" class=\"headerlink\" title=\"3.3.3 扩展卡尔曼滤波算法\"></a>3.3.3 扩展卡尔曼滤波算法</h4><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">Algorithm Extended_Kalman_filter(mu(t-1), Sigma(t-1), u(t), z(t)):</span><br><span class=\"line\"> overline_mu(t) = g(u(t), mu(t-1))</span><br><span class=\"line\"> overline_Sigma(t) = G(t) Sigma(t-1) G(t).T + R(t)</span><br><span class=\"line\"></span><br><span class=\"line\"> K(t) = overline_sigma(t) H(t).T (H(t) overline_sigma(t) H(t).T + Q(t)).inverse()</span><br><span class=\"line\"> mu(t) = overline_mu(t) + K(t) (z(t) - h(overline_mu(t)))</span><br><span class=\"line\"> Sigma(t) = (I - K(t) H(t)) overline_Sigma(t)</span><br></pre></td></tr></table></figure>\n<h3 id=\"3-4-无迹卡尔曼滤波\"><a href=\"#3-4-无迹卡尔曼滤波\" class=\"headerlink\" title=\"3.4 无迹卡尔曼滤波\"></a>3.4 无迹卡尔曼滤波</h3><p>UKF采用一些采样点来计算高斯分布,避免求导</p>\n<h3 id=\"3-5-信息滤波\"><a href=\"#3-5-信息滤波\" class=\"headerlink\" title=\"3.5 信息滤波\"></a>3.5 信息滤波</h3><p>使用正则参数表达高斯分布,与KF是对偶关系</p>\n","site":{"data":{}},"excerpt":"","more":"<h2 id=\"第二章-递归状态估计\"><a href=\"#第二章-递归状态估计\" class=\"headerlink\" title=\"第二章 递归状态估计\"></a>第二章 递归状态估计</h2><h3 id=\"2-2-概率的基本概念\"><a href=\"#2-2-概率的基本概念\" class=\"headerlink\" title=\"2.2 概率的基本概念\"></a>2.2 概率的基本概念</h3><p><strong>高斯分布</strong></p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n p(x) &= \\frac{1}{\\sqrt{2 \\pi} \\sigma} e^{-\\frac{(x - \\mu)^2}{2\\sigma^2}} \\\\\n p(\\mathbf{x}) &= \\frac{1}{\\det {\\sqrt{2 \\pi \\boldsymbol{\\Sigma}}}}e^{-\\frac{1}{2}{(\\mathbf{x} - \\boldsymbol{\\mu})^T}\\boldsymbol{\\Sigma}^{-1}(\\mathbf{x} - \\boldsymbol{\\mu})} \n\\end{aligned}</script><p><strong>条件独立与绝对独立之间既不充分也不必要</strong></p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n & p(x, y | z ) = p(x | z) p(y | z) \\nRightarrow p(x, y) = p(x) p(y) \\\\\n & p(x, y) = p(x) p(y) \\nRightarrow p(x, y | z ) = p(x | z) p(y | z) \n\\end{aligned}</script><p><strong>期望与协方差</strong></p>\n<script type=\"math/tex; mode=display\">\nE[X] = \\int xp(x)dx \\\\\nE[aX + b] = a E[X] + b \\\\\nD[X] = E[(X - E[X])^2] = E[X^2] - E^2[X]</script><p><strong>熵</strong></p>\n<script type=\"math/tex; mode=display\">\nH(x) = -E[\\log_2p(x)]</script><h3 id=\"2-3-机器人环境交互\"><a href=\"#2-3-机器人环境交互\" class=\"headerlink\" title=\"2.3 机器人环境交互\"></a>2.3 机器人环境交互</h3><h4 id=\"2-3-1-状态\"><a href=\"#2-3-1-状态\" class=\"headerlink\" title=\"2.3.1 状态\"></a>2.3.1 状态</h4><p>机器人系统中典型状态:</p>\n<ul>\n<li>机器人位姿</li>\n<li>机器人运动学状态,一般指关节的转动角度</li>\n<li>机器人速度、角速度</li>\n<li>环境中物体的位置和特征</li>\n<li>移动的物体和人的位置和状态</li>\n<li>潜在的其他状态量,如传感器是否故障</li>\n</ul>\n<h4 id=\"2-3-2-环境交互\"><a href=\"#2-3-2-环境交互\" class=\"headerlink\" title=\"2.3.2 环境交互\"></a>2.3.2 环境交互</h4><p>两种交互类型: 机器人通过执行机构影响环境的状态与它通过传感器收集有关状态的信息</p>\n<h4 id=\"2-3-3-概率生成法则\"><a href=\"#2-3-3-概率生成法则\" class=\"headerlink\" title=\"2.3.3 概率生成法则\"></a>2.3.3 概率生成法则</h4><p>马尔可夫性,可以称为隐马尔可夫模型(HMM)或者动态贝叶斯网络(DBN)</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n p(x_t | x_{0:t-1}, z_{1:t-1}, u_{1:t}) &= p(x_t | x_{t - 1}, u_t) \\\\\n p(z_t | x_{0:t-1}, z_{1:t-1}, u_{1:t}) & = p(z_t | x_t)\n\\end{aligned}</script><h4 id=\"2-3-4-置信分布\"><a href=\"#2-3-4-置信分布\" class=\"headerlink\" title=\"2.3.4 置信分布\"></a>2.3.4 置信分布</h4><p>置信分布可以理解为状态量的后验分布,有两种后验分布</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(x_t) &= p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n\\mathrm{bel}(x_t) &= p(x_t | z_{1:t}, u_{1:t})\n\\end{aligned}</script><p>第一种后验计算过程被称为预测,而第二种后验被称为修正或者测量更新,这两个概率为卡尔曼滤波的核心</p>\n<h3 id=\"2-4-贝叶斯滤波\"><a href=\"#2-4-贝叶斯滤波\" class=\"headerlink\" title=\"2.4 贝叶斯滤波\"></a>2.4 贝叶斯滤波</h3><h4 id=\"2-4-1-贝叶斯滤波算法\"><a href=\"#2-4-1-贝叶斯滤波算法\" class=\"headerlink\" title=\"2.4.1 贝叶斯滤波算法\"></a>2.4.1 贝叶斯滤波算法</h4><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">Algo Bayes_filter(bel(x(t-1)), u(t), z(t)):</span><br><span class=\"line\"> for all x(t) do:</span><br><span class=\"line\"> bel_overline(x(t)) = integrate(p(x(t) | u(t), x(t - 1)) bel(x(t - 1)) dx(t-1))</span><br><span class=\"line\"> bel_(x(t)) = eta p((z(t) | x(t))) bel_overline(x(t))</span><br><span class=\"line\"> endfor</span><br><span class=\"line\"> return bel_(x(t))</span><br></pre></td></tr></table></figure>\n<h4 id=\"2-4-2-实例\"><a href=\"#2-4-2-实例\" class=\"headerlink\" title=\"2.4.2 实例\"></a>2.4.2 实例</h4><p>假设有一个估计门开关的传感器,初始的门开关与否的先验相同,即</p>\n<script type=\"math/tex; mode=display\">\np(X_0 = \\mathrm{open}) = 0.5 \\\\\np(X_0 = \\mathrm{close}) = 0.5</script><p>且有测量模型</p>\n<script type=\"math/tex; mode=display\">\np(Z_t = \\mathrm{sense\\_open} | X_t = \\mathrm{open}) = 0.6 \\\\ \np(Z_t = \\mathrm{sense\\_close} | X_t = \\mathrm{open}) = 0.4 \\\\\np(Z_t = \\mathrm{sense\\_open} | X_t = \\mathrm{close}) = 0.2 \\\\\np(Z_t = \\mathrm{sense\\_close} | X_t = \\mathrm{close}) = 0.8</script><p>机器人有推门或者啥也不干的操作,有如下的状态转移概率</p>\n<script type=\"math/tex; mode=display\">\np(X_t = \\mathrm{open} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{open}) = 1 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{open}) = 0 \\\\\np(X_t = \\mathrm{open} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{close}) = 0.8 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{push}, X_{t-1} = \\mathrm{close}) = 0.2 \\\\\np(X_t = \\mathrm{open} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{open}) = 1 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{open}) = 0 \\\\\np(X_t = \\mathrm{open} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{close}) = 0 \\\\\np(X_t = \\mathrm{close} | U_t = \\mathrm{do \\ nothing}, X_{t-1} = \\mathrm{close}) = 1</script><p>假设在$t_1$时刻,机器人没有采用任何控制动作,但传感器检测到门时开的,此时有贝叶斯滤波计算结果如下</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(x_1) = &p(x_1 | U_1 = \\mathrm{do \\ nothing}, X_0 = \\mathrm{open}) \\mathrm{bel}(x_0 = \\mathrm{open}) + \\\\ \n&p(x_1 | U_1 = \\mathrm{do \\ nothing}, X_0 = \\mathrm{close}) \\mathrm{bel}(x_0 = \\mathrm{close})\n\\end{aligned}</script><p>那么有</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(X_1 = \\mathrm{open}) &= 1 \\times 0.5 + 0 \\times 0.5 = 0.5 \\\\\n\\overline{\\mathrm{bel}}(X_1 = \\mathrm{close}) & = 0 \\times 0.5 + 1 \\times 0.5 = 0.5\n\\end{aligned}</script><p>接着计算更新后的后验概率</p>\n<script type=\"math/tex; mode=display\">\n\\mathrm{bel}(x_1) = \\eta p(Z_1 = \\mathrm{open} | x_1) \\overline{\\mathrm{bel}}(x_1)</script><p>那么有</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= \\eta 0.6 \\times 0.5 = 0.3 \\eta \\\\\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= \\eta 0.2 \\times 0.5 = 0.1 \\eta\n\\end{aligned}</script><p>归一化因子$\\eta = (0.3 + 0.1)^-1 = 2.5$,所以有</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= 0.75 \\\\\n\\mathrm{bel}(X_1 = \\mathrm{open}) &= 0.25\n\\end{aligned}</script><p>对于$u_2 = \\mathrm{push}$并且$Z_2 = \\mathrm{open}$的情况下,此时可以计算得到</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(X_2 = \\mathrm{open}) &= 1 \\times 0.75 + 0.8 \\times 0.25 = 0.95 \\\\\n\\overline{\\mathrm{bel}}(X_2 = \\mathrm{close}) & = 0 \\times 0.75 + 0.2 \\times 0.25 = 0.05 \\\\\n\\mathrm{bel}(X_2 = \\mathrm{open}) &= \\eta 0.6 \\times 0.95 \\approx 0.983 \\\\\n\\mathrm{bel}(X_2 = \\mathrm{open}) &= \\eta 0.4 \\times 0.05 \\approx 0.017\n\\end{aligned}</script><h4 id=\"2-4-3-贝叶斯滤波的数学推导\"><a href=\"#2-4-3-贝叶斯滤波的数学推导\" class=\"headerlink\" title=\"2.4.3 贝叶斯滤波的数学推导\"></a>2.4.3 贝叶斯滤波的数学推导</h4><p>首先根据贝叶斯法则后验概率有</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\np(x_t | z_{1:t}, u_{1:t}) &= \\frac{p(z_t| x_t, z_{1:t-1}, u_{1:t}) p(x_t | z_{1:t-1}, u_{1:t})}{p(z_t | z_{1:t-1}, u_{1:t})} \\\\\n& = \\eta p(z_t| x_t, z_{1:t-1}, u_{1:t}) p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n& = \\eta p(z_t| x_t) p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n& = \\eta p(z_t| x_t) \\overline{\\mathrm{bel}}(x_{t})\n\\end{aligned}</script><p>接着计算$\\overline{\\mathrm{bel}}(x_{t})$:</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n\\overline{\\mathrm{bel}}(x_{t}) &= p(x_t | z_{1:t-1}, u_{1:t}) \\\\\n& = \\int p(x_t | x_{t-1}, z_{1:t-1}, u_{1:t}) p(x_{t-1} | z_{1:t-1}, u_{1:t}) dx_{t-1} \\\\\n& = \\int p(x_t | x_{t-1}, u_{t}) p(x_{t-1} | z_{1:t-1}, u_{1:t-1}) dx_{t-1} \\\\\n& = \\int p(x_t | x_{t-1}, u_{t}) \\mathrm{bel}(x_{t-1})\n\\end{aligned}</script><h3 id=\"2-8-习题\"><a href=\"#2-8-习题\" class=\"headerlink\" title=\"2.8 习题\"></a>2.8 习题</h3><ol>\n<li><p>解:</p>\n<script type=\"math/tex; mode=display\">\np(x_1 = 0) = \\frac{1}{34} \\approx 0.0294 \\\\\np(x_2 = 0) = \\frac{1}{12} \\approx 0.0833 \\\\\n\\vdots\\\\\np(x_N = 0) = \\frac{1}{1 + 99 \\frac{1}{3^N}}</script></li>\n<li><p> 解:<br> (a) $p = 0.2 <em> 0.4 </em> 0.2 = 0.016$<br> (b) Day 0: 随机出一个天气; Day 1: 按照状态转移表的概率进行随机转移<br> (c) …<br> (d) 设</p>\n<pre><code> $$\n \\begin{aligned}\n Y_t &= \\begin{bmatrix}\n P(X_t = 1) \\\\\n p(X_t = 2) \\\\\n p(X_t = 3)\n \\end{bmatrix} \\\\\n A &= \\begin{bmatrix}\n P(X_{t+1} = 1 | X_t = 1) & P(X_{t+1} = 1 | X_t = 2) & P(X_{t+1} = 1 | X_t = 3) \\\\\n P(X_{t+1} = 2 | X_t = 1) & P(X_{t+1} = 2 | X_t = 2) & P(X_{t+1} = 2 | X_t = 3) \\\\\n P(X_{t+1} = 3 | X_t = 1) & P(X_{t+1} = 3 | X_t = 2) & P(X_{t+1} = 3 | X_t = 3)\n \\end{bmatrix} \\\\\n & = \\begin{bmatrix}\n 0.8 & 0.4 & 0.2\\\\\n 0.2 & 0.4 & 0.6 \\\\\n 0.0 & 0.2 & 0.2\n \\end{bmatrix} \n \\end{aligned}\n $$\n 有 $Y_{t+1} = A Y_t$,那么$Y_{n} = A^n Y_0$,将$A$进行相似分解为对角阵$A = P D P^{-1}$,其中$D$为\n $$\n D = \\begin{bmatrix}\n 1 & 0 & 0 \\\\\n 0 & \\frac{1 + \\sqrt{2}}{5} & 0 \\\\\n 0 & 0& \\frac{1 - \\sqrt{2}}{5}\n \\end{bmatrix} \n $$\n 由于 $$\n \\lim_{n \\rightarrow \\infty} D^n = \\begin{bmatrix}\n 1 & 0 & 0 \\\\\n 0 & 0 & 0 \\\\\n 0 & 0& 0\n \\end{bmatrix} \n $$\n 所以最终\n $$\n \\begin{aligned}\n \\lim_{n \\rightarrow \\infty} Y^n &= P \\begin{bmatrix}\n 1 & 0 & 0 \\\\\n 0 & 0 & 0 \\\\\n 0 & 0& 0\n \\end{bmatrix} P^{-1} X_0 \\\\\n & = \\begin{bmatrix}\n \\frac{9}{14} \\\\\n \\frac{2}{7} \\\\\n \\frac{1}{14} \n \\end{bmatrix}\n \\end{aligned}\n $$\n</code></pre><p> (e) </p>\n<pre><code> $$\n \\begin{aligned}\n H(x) = -(\\frac{9}{14} \\log_2\\frac{9}{14} + \\frac{2}{7} \\log_2\\frac{2}{7} + \\frac{1}{14} \\log_2\\frac{1}{14})\n \\end{aligned}\n $$\n</code></pre><p> (f) 根据贝叶斯法则,用稳态时候的概率,可以计算出概率为</p>\n<pre><code> $$\n \\begin{aligned}\n p(Y_{t-1} | Y_t) &= \\frac{p(Y_t | Y_{t-1}) p(Y_{t-1})}{p(Y_t)} \\\\\n &=A \\cdot \\begin{bmatrix}\n 1 & 2.25 & 9 \\\\\n 0.444 & 1 & 4 \\\\\n 0.111 & 0.25 & 1\n \\end{bmatrix} \\\\\n & = \n \\begin{bmatrix}\n 0.8 & 0.45 & 0 \\\\\n 0.18 & 0.40 & 0.80 \\\\\n 0.02 & 0.15 & 0.20\n \\end{bmatrix} \n \\end{aligned}\n $$\n</code></pre><p> (g) 状态转移矩阵依赖季节的话会丧失马尔可夫性,需要将季节变量引入到状态变量中恢复马尔可夫性</p>\n</li>\n<li><p>解:<br>(a)</p>\n<p> | | $z_t$ | $\\overline{\\mathrm{bel}}(x_t)$ | ${\\mathrm{bel}}(x_t)$ | $\\eta$ |<br> | —- | ——- | ——————————————————————— | —————————————————————- | ——— |<br> | 1 | | | $\\begin{bmatrix}1&0&0\\end{bmatrix}^T$ | 1 |<br> | 2 | 多云 | $\\begin{bmatrix}0.8&0.2&0\\end{bmatrix}^T$ | $\\begin{bmatrix}0.32&0.14&0\\end{bmatrix}^T$ | 2.17 |<br> | 3 | 多云 | $\\begin{bmatrix}0.67&0.26&0.06\\end{bmatrix}^T$ | $\\begin{bmatrix}0.26&0.18&0\\end{bmatrix}^T$ | 2.27 |<br> 用同样的方法向后计算,第五天时晴天的后验概率为0.4<br>(b) 如果只依据以往的数据,计算后验概率,2-4最有可能的天气为晴、晴、雨,概率分别为0.89、0.87、1。利用所有数据计算后验概率,2-4最有可能的天气为晴、多云、雨,概率分别为0.8, 1.0, 1.0</p>\n</li>\n<li><p>解:<br>(a): $p(x)$ 为一个高斯分布,测量$p(z|x)$也为一个高斯分布<br>(b): 后验也为一个高斯分布</p>\n</li>\n</ol>\n<h2 id=\"第三章-高斯滤波\"><a href=\"#第三章-高斯滤波\" class=\"headerlink\" title=\"第三章 高斯滤波\"></a>第三章 高斯滤波</h2><h3 id=\"3-2-卡尔曼滤波\"><a href=\"#3-2-卡尔曼滤波\" class=\"headerlink\" title=\"3.2 卡尔曼滤波\"></a>3.2 卡尔曼滤波</h3><h4 id=\"3-2-1-线性高斯系统\"><a href=\"#3-2-1-线性高斯系统\" class=\"headerlink\" title=\"3.2.1 线性高斯系统\"></a>3.2.1 线性高斯系统</h4><p>状态转移概率以及测量概率均符合高斯分布</p>\n<h4 id=\"3-2-2-卡尔曼滤波算法\"><a href=\"#3-2-2-卡尔曼滤波算法\" class=\"headerlink\" title=\"3.2.2 卡尔曼滤波算法\"></a>3.2.2 卡尔曼滤波算法</h4><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">Algorithm Kalman_filter(mu(t-1), Sigma(t-1), u(t), z(t)):</span><br><span class=\"line\"> overline_mu(t) = A(t) mu(t-1) + B(t) u(t)</span><br><span class=\"line\"> overline_Sigma(t) = A(t) Sigma(t-1) A(t).T + R(t)</span><br><span class=\"line\"></span><br><span class=\"line\"> K(t) = overline_sigma(t) C(t).T (C(t) overline_sigma(t) C(t).T + Q(t)).inverse()</span><br><span class=\"line\"> mu(t) = overline_mu(t) + K(t) (z(t) - C(t) overline_mu(t))</span><br><span class=\"line\"> Sigma(t) = (I - K(t) C(t)) overline_Sigma(t)</span><br></pre></td></tr></table></figure>\n<h4 id=\"3-2-4-卡尔曼滤波的数学推导\"><a href=\"#3-2-4-卡尔曼滤波的数学推导\" class=\"headerlink\" title=\"3.2.4 卡尔曼滤波的数学推导\"></a>3.2.4 卡尔曼滤波的数学推导</h4><p>首先根据贝叶斯滤波的预测步骤可知</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n \\overline{\\mathrm{bel}}(x_t) &= \\int p(x_t | x_{t-1}, u_t) {\\mathrm{bel}}(x_t-1) dx_{t-1} \\\\\n &= \\int N(A_t x_{t-1} + B_t u _t, R_t) N(\\mu_{t-1}, \\Sigma_{t-1}) dx_{t-1} \\\\\n &= \\eta \\int \\exp \\left\\{ -\\frac{1}{2}(x_t - A_t x_{t-1} - B_t u_t)^T R_t^{-1}(x_t - A_t x_{t-1} - B_t u_t)\\right\\} \\\\\n & \\quad \\exp \\left\\{-\\frac{1}{2} (x_{t-1} - \\mu_{t-1})^T \\Sigma^{-1}_{t-1} (x_{t-1} - \\mu_{t-1})\\right\\} dx_{t-1} \\\\\n & = \\eta \\int \\exp \\left\\{ -L_t\\right\\} dx_{t-1}\n\\end{aligned}</script><p>其中</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\nL_t &= \\frac{1}{2}(x_t - A_t x_{t-1} - B_t u_t)^T R_t^{-1}(x_t - A_t x_{t-1} - B_t u_t) + \\\\\n & \\quad \\frac{1}{2} (x_{t-1} - \\mu_{t-1})^T \\Sigma^{-1}_{t-1} (x_{t-1} - \\mu_{t-1})\n\\end{aligned}</script><p>该式子可以分解为仅包含$x_t$的部分以及剩余部分,经过推导可以得知 $\\overline{\\mathrm{bel}}(x_t)$ 也为一个高斯分布,其均值为 $\\overline{\\mu}_t = A_t \\mu_{t-1} + B_t u_t$,方差为 $\\overline{\\Sigma}_t = A_t \\Sigma_{t-1}^{-1} A_t^T + R_t$</p>\n<p>更新步骤有</p>\n<script type=\"math/tex; mode=display\">\n\\begin{aligned}\n{\\mathrm{bel}}(x_t) &= \\eta p(z_t | x_t) \\overline{\\mathrm{bel}}(x_t) \\\\\n& = N(C_tx_t, Q_t) N(\\overline{\\mu}_t, \\overline{\\Sigma}_t)\n\\end{aligned}</script><p>该高斯的乘积也是一个高斯分布,且</p>\n<script type=\"math/tex; mode=display\">\n\\mu_t = \\overline{\\mu}_t + K_t(z_t - C_t \\overline{\\mu}_t) \\\\\n\\Sigma_t = (I - K_t C_t) \\overline{\\Sigma}_t</script><h3 id=\"3-3-扩展卡尔曼滤波\"><a href=\"#3-3-扩展卡尔曼滤波\" class=\"headerlink\" title=\"3.3 扩展卡尔曼滤波\"></a>3.3 扩展卡尔曼滤波</h3><h4 id=\"3-3-3-扩展卡尔曼滤波算法\"><a href=\"#3-3-3-扩展卡尔曼滤波算法\" class=\"headerlink\" title=\"3.3.3 扩展卡尔曼滤波算法\"></a>3.3.3 扩展卡尔曼滤波算法</h4><figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">Algorithm Extended_Kalman_filter(mu(t-1), Sigma(t-1), u(t), z(t)):</span><br><span class=\"line\"> overline_mu(t) = g(u(t), mu(t-1))</span><br><span class=\"line\"> overline_Sigma(t) = G(t) Sigma(t-1) G(t).T + R(t)</span><br><span class=\"line\"></span><br><span class=\"line\"> K(t) = overline_sigma(t) H(t).T (H(t) overline_sigma(t) H(t).T + Q(t)).inverse()</span><br><span class=\"line\"> mu(t) = overline_mu(t) + K(t) (z(t) - h(overline_mu(t)))</span><br><span class=\"line\"> Sigma(t) = (I - K(t) H(t)) overline_Sigma(t)</span><br></pre></td></tr></table></figure>\n<h3 id=\"3-4-无迹卡尔曼滤波\"><a href=\"#3-4-无迹卡尔曼滤波\" class=\"headerlink\" title=\"3.4 无迹卡尔曼滤波\"></a>3.4 无迹卡尔曼滤波</h3><p>UKF采用一些采样点来计算高斯分布,避免求导</p>\n<h3 id=\"3-5-信息滤波\"><a href=\"#3-5-信息滤波\" class=\"headerlink\" title=\"3.5 信息滤波\"></a>3.5 信息滤波</h3><p>使用正则参数表达高斯分布,与KF是对偶关系</p>\n"}],"PostAsset":[],"PostCategory":[],"PostTag":[{"post_id":"cl8vrsuue00027ovqadvqb3gz","tag_id":"cl8vrsuug00037ovqbqmqau91","_id":"cl8vrsuui00047ovq6l5w38m8"}],"Tag":[{"name":"SLAM","_id":"cl8vrsuug00037ovqbqmqau91"}]}}