{"id":289,"date":"2020-03-31T23:39:28","date_gmt":"2020-03-31T23:39:28","guid":{"rendered":"http:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/?p=289"},"modified":"2020-10-10T01:50:37","modified_gmt":"2020-10-10T01:50:37","slug":"software-documentation","status":"publish","type":"post","link":"https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/2020\/03\/31\/software-documentation\/","title":{"rendered":"Software Documentation"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\"><span class=\"has-inline-color has-black-color\">UML Diagram<\/span><\/h1>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/10\/new_planner-1-1024x428.png\" alt=\"\" class=\"wp-image-574\" width=\"864\" height=\"361\" srcset=\"https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/10\/new_planner-1-1024x428.png 1024w, https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/10\/new_planner-1-300x125.png 300w, https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/10\/new_planner-1-250x104.png 250w, https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/10\/new_planner-1-768x321.png 768w, https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/10\/new_planner-1-1536x641.png 1536w, https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/10\/new_planner-1-2048x855.png 2048w\" sizes=\"auto, (max-width: 864px) 100vw, 864px\" \/><\/figure>\n\n\n<h1><span style=\"color: #000000\">Maintaining synchronicity with simulation and RL agent for training<\/span><\/h1>\n<div id=\"attachment_290\" style=\"width: 1034px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-290\" class=\"wp-image-290 size-large\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/03\/Thread-flowchart-1024x627.png\" alt=\"\" width=\"1024\" height=\"627\" srcset=\"https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/03\/Thread-flowchart-1024x627.png 1024w, https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/03\/Thread-flowchart-250x153.png 250w, https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/03\/Thread-flowchart-300x184.png 300w, https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/03\/Thread-flowchart-768x470.png 768w, https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/03\/Thread-flowchart.png 1698w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><p id=\"caption-attachment-290\" class=\"wp-caption-text\"><span style=\"color: #000000\">Threading Flow Chart<\/span><\/p><\/div>\n<div class=\"page\" title=\"Page 2\">\n<div class=\"layoutArea\">\n<div class=\"column\">\n<p><span style=\"color: #000000\">The simulator and agent are implemented in a ROS framework. The agent publishes actions and the simulator publishes observations. However, both of these processes are asynchronous. We need to pause the simulation after the execution of an action and make it wait until the next action is given. This is implemented as described in the flowchart shown in the above figure.<\/span><\/p>\n<p><span style=\"color: #000000\">The stable-baseline(sb) thread (thread running the training\/optimisation process) issues an action and this action is published. The sb thread is then blocked and the callback loop of the ROS node is released. The ROS node thread continues to execute the action and monitors the current environment state, to look for termination conditions. The ROS node thread blocks itself when it detects a termination condition and releases the sb thread. This way we can pause and resume the sim. This functionality is enough to ensure the synchronicity of the action and reward feedback loop necessary for the RL agent training process.<\/span><\/p>\n<\/div>\n<\/div>\n<h1><span style=\"color: #000000\">Integration of CARLA with the system in a synchronous setting<\/span><\/h1>\n<div id=\"attachment_290\" style=\"width: 1034px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-290\" class=\"wp-image-290 size-large\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/04\/1.png\" alt=\"\" width=\"1024\" height=\"627\" \/><p id=\"caption-attachment-290\" class=\"wp-caption-text\"><span style=\"color: #000000\">(1)<\/span><\/p><\/div>\n<div class=\"page\" title=\"Page 2\">\n<div class=\"layoutArea\">\n<div class=\"column\">\n<p><span style=\"color: #000000\">The process begins with the CARLA handler and the Traffic Manager establishing a connection to the CARLA server\/.<\/span><\/p>\n<\/div>\n<\/div>\n<div id=\"attachment_290\" style=\"width: 1034px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-290\" class=\"wp-image-290 size-large\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/04\/2.png\" alt=\"\" width=\"1024\" height=\"627\" \/><p id=\"caption-attachment-290\" class=\"wp-caption-text\"><span style=\"color: #000000\">(2)<\/span><\/p><\/div>\n<div class=\"page\" title=\"Page 2\">\n<div class=\"layoutArea\">\n<div class=\"column\">\n<p><span style=\"color: #000000\">The CARLA handler then spawns the ego vehicle in CARLA while the traffic manager spawns the NPCs.<\/span><\/p>\n<\/div>\n<\/div>\n<div id=\"attachment_290\" style=\"width: 1034px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-290\" class=\"wp-image-290 size-large\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/04\/3.png\" alt=\"\" width=\"1024\" height=\"627\" \/><p id=\"caption-attachment-290\" class=\"wp-caption-text\"><span style=\"color: #000000\">(3)<\/span><\/p><\/div>\n<div class=\"page\" title=\"Page 2\">\n<div class=\"layoutArea\">\n<div class=\"column\">\n<p><span style=\"color: #000000\">The CARLA handler then pauses the simulation.<\/span><\/p>\n<\/div>\n<\/div>\n<div id=\"attachment_290\" style=\"width: 1034px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-290\" class=\"wp-image-290 size-large\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/04\/4.png\" alt=\"\" width=\"1024\" height=\"627\" \/><p id=\"caption-attachment-290\" class=\"wp-caption-text\"><span style=\"color: #000000\">(4)<\/span><\/p><\/div>\n<div class=\"page\" title=\"Page 2\">\n<div class=\"layoutArea\">\n<div class=\"column\">\n<p><span style=\"color: #000000\">The state information of the environment is extracted from the paused simulation. The state information consists of the position, orientation and velocities of all vehicles and pedestrians in the simulation.<\/span><\/p>\n<\/div>\n<\/div>\n<div id=\"attachment_290\" style=\"width: 1034px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-290\" class=\"wp-image-290 size-large\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/04\/5.png\" alt=\"\" width=\"1024\" height=\"627\" \/><p id=\"caption-attachment-290\" class=\"wp-caption-text\"><span style=\"color: #000000\">(5)<\/span><\/p><\/div>\n<div class=\"page\" title=\"Page 2\">\n<div class=\"layoutArea\">\n<div class=\"column\">\n<p><span style=\"color: #000000\">The state information is sent to the RL Node.<\/span><\/p>\n<\/div>\n<\/div>\n<div id=\"attachment_290\" style=\"width: 1034px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-290\" class=\"wp-image-290 size-large\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/04\/6.png\" alt=\"\" width=\"1024\" height=\"627\" \/><p id=\"caption-attachment-290\" class=\"wp-caption-text\"><span style=\"color: #000000\">(6)<\/span><\/p><\/div>\n<div class=\"page\" title=\"Page 2\">\n<div class=\"layoutArea\">\n<div class=\"column\">\n<p><span style=\"color: #000000\">The path planning node provides the CARLA handler with the next set of waypoints to track.<\/span><\/p>\n<\/div>\n<\/div>\n<div id=\"attachment_290\" style=\"width: 1034px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-290\" class=\"wp-image-290 size-large\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/04\/7.png\" alt=\"\" width=\"1024\" height=\"627\" \/><p id=\"caption-attachment-290\" class=\"wp-caption-text\"><span style=\"color: #000000\">(7)<\/span><\/p><\/div>\n<div class=\"page\" title=\"Page 2\">\n<div class=\"layoutArea\">\n<div class=\"column\">\n<p><span style=\"color: #000000\">The waypoints are used to generate a control signal for the ego vehicle. The traffic manager creates control signals for all NPCs in parallel.<\/span><\/p>\n<\/div>\n<\/div>\n<div id=\"attachment_290\" style=\"width: 1034px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-290\" class=\"wp-image-290 size-large\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/04\/8.png\" alt=\"\" width=\"1024\" height=\"627\" \/><p id=\"caption-attachment-290\" class=\"wp-caption-text\"><span style=\"color: #000000\">(8)<\/span><\/p><\/div>\n<div class=\"page\" title=\"Page 2\">\n<div class=\"layoutArea\">\n<div class=\"column\">\n<p><span style=\"color: #000000\">The control signals generated above are assigned to their corresponding vehicles in simulation.<\/span><\/p>\n<\/div>\n<\/div>\n<div id=\"attachment_290\" style=\"width: 1034px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-290\" class=\"wp-image-290 size-large\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/04\/9.png\" alt=\"\" width=\"1024\" height=\"627\" \/><p id=\"caption-attachment-290\" class=\"wp-caption-text\"><span style=\"color: #000000\">(9)<\/span><\/p><\/div>\n<div class=\"page\" title=\"Page 2\">\n<div class=\"layoutArea\">\n<div class=\"column\">\n<p><span style=\"color: #000000\">The CARLA handler then resumes the simulation for one time step.<\/span><\/p>\n<\/div>\n<\/div>\n<div id=\"attachment_290\" style=\"width: 1034px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-290\" class=\"wp-image-290 size-large\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-content\/uploads\/sites\/43\/2020\/04\/10.png\" alt=\"\" width=\"1024\" height=\"627\" \/><p id=\"caption-attachment-290\" class=\"wp-caption-text\"><span style=\"color: #000000\">(10)<\/span><\/p><\/div>\n<div class=\"page\" title=\"Page 2\">\n<div class=\"layoutArea\">\n<div class=\"column\">\n<p><span style=\"color: #000000\">The CARLA handler pauses the simulation after one time step and the loop defined above begins again.<\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>UML Diagram Maintaining synchronicity with simulation and RL agent for training The simulator and agent are implemented in a ROS framework. The agent publishes actions and the simulator publishes observations. However, both of these processes are asynchronous. We need to pause the simulation after the execution of an action and make it wait until the<br \/><a class=\"moretag\" href=\"https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/2020\/03\/31\/software-documentation\/\">+ Read More<\/a><\/p>\n","protected":false},"author":196,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-289","post","type-post","status-publish","format-standard","hentry","category-documentation"],"_links":{"self":[{"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-json\/wp\/v2\/posts\/289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-json\/wp\/v2\/users\/196"}],"replies":[{"embeddable":true,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-json\/wp\/v2\/comments?post=289"}],"version-history":[{"count":8,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-json\/wp\/v2\/posts\/289\/revisions"}],"predecessor-version":[{"id":577,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-json\/wp\/v2\/posts\/289\/revisions\/577"}],"wp:attachment":[{"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-json\/wp\/v2\/media?parent=289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-json\/wp\/v2\/categories?post=289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2020teamd\/wp-json\/wp\/v2\/tags?post=289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}