{"id":11672,"date":"2020-08-07T11:16:07","date_gmt":"2020-08-07T15:16:07","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=11672"},"modified":"2020-08-07T11:17:20","modified_gmt":"2020-08-07T15:17:20","slug":"model-based-autonomous-traffic-simulation","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2020\/08\/07\/model-based-autonomous-traffic-simulation\/","title":{"rendered":"Model-Based Autonomous Traffic Simulation"},"content":{"rendered":"Today's post is by Kathi Kugler, who is part of MathWorks Academic Engineering Team.\r\n<p>\r\nThis week\u2019s Pick is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/78444\" rel=\"noopener noreferrer\" target=\"_blank\">MOBATSim<\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/9124022\" rel=\"noopener noreferrer\" target=\"_blank\">Mustafa Saraoglu<\/a>.\r\n<p>\r\nDid you know that you can simulate traffic, where you can customize the behavior of every single vehicle in that traffic? That is what MOBATSim is for! Let\u2019s go ahead and try it. Let\u2019s say we have a map, which is a digraph where nodes are the waypoints, and the edges are the routes. As shown below, you can also run  the 3D animation of the map if you have already built the WRL file of it, in the MATLAB built-in tool V-realm.\r\n<p>\r\n<img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/guest\/MOBATSim\/Blog2Dmap3Dmap.gif\" width=\"1920\" height=\"1080\" class=\"alignnone size-full\" \/>\r\n<p>\r\nNow let\u2019s imagine we want to start ten different vehicles from ten different starting points and make them find their way to ten other different destination points. How can they do that? Simply by localizing themselves on the map, using algorithms like <a href=\"https:\/\/en.wikipedia.org\/wiki\/A*_search_algorithm\" rel=\"noopener noreferrer\" target=\"_blank\">A*<\/a> to find a path from their initial waypoint to their destination waypoint. Do you think they can do that without colliding with each other? That is what V2X communication and sensors are for. They will simply avoid a collision, obey the rules of the intersection, and slow down if their preceding vehicle suddenly slows down. How it slows down or should it even slowdown is up to you and the algorithm that you put into the \u201cPlatoon Controller\u201d subsystem of the vehicle. How do other more complicated algorithms work? Instead of subsystems, they use MATLAB System Blocks to execute any algorithm that you can write as a MATLAB script in a conventional way. The animation shows how to navigate from your full model into a vehicle subsystem and finally to one of the MATLAB System Blocks.\r\n<p>\r\n<div style=\"width: 1280px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-11672-1\" width=\"1280\" height=\"720\" loop=\"1\" autoplay=\"1\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/BlogWalkThroughModel.mp4?_=1\" \/><a href=\"https:\/\/blogs.mathworks.com\/pick\/files\/BlogWalkThroughModel.mp4\">https:\/\/blogs.mathworks.com\/pick\/files\/BlogWalkThroughModel.mp4<\/a><\/video><\/div>\r\n<p><p>\r\nTo learn more and try it for yourself, you can <a href=\"https:\/\/jp.mathworks.com\/matlabcentral\/fileexchange\/78444\">download<\/a> it from the File Exchange or simply fork it from GitHub and contribute! Let us know what you think <a href=\"http:\/\/blogs.mathworks.com\/pick\/?p=11672#respond\">here<\/a> or leave a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/78444#comment\">comment<\/a> for Mustafa. Also, take a look at this <a href=\"https:\/\/www.mathworks.com\/company\/newsletters\/articles\/developing-an-autonomous-traffic-simulation-framework-for-functional-safety-testing.html\">technical article<\/a> by Mustafa.","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/guest\/MOBATSim\/Blog2Dmap3Dmap.gif\" onError=\"this.style.display ='none';\" \/><\/div><p>Today's post is by Kathi Kugler, who is part of MathWorks Academic Engineering Team.\r\n\r\nThis week\u2019s Pick is MOBATSim by Mustafa Saraoglu.\r\n\r\nDid you know that you can simulate traffic, where you can... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2020\/08\/07\/model-based-autonomous-traffic-simulation\/\">read more >><\/a><\/p>","protected":false},"author":36,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/11672"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/36"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=11672"}],"version-history":[{"count":8,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/11672\/revisions"}],"predecessor-version":[{"id":11692,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/11672\/revisions\/11692"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=11672"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=11672"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=11672"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}