{"id":540,"date":"2017-05-12T23:08:52","date_gmt":"2017-05-12T23:08:52","guid":{"rendered":"http:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/?page_id=540"},"modified":"2017-05-13T03:40:28","modified_gmt":"2017-05-13T03:40:28","slug":"app-and-server-subsystem","status":"publish","type":"page","link":"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/system-implementation\/app-and-server-subsystem\/","title":{"rendered":"App and Server Subsystem"},"content":{"rendered":"<h1>App and Server Subsystem<\/h1>\n<p>The main function of the server is to act as a repository and relay data between Mell-E and the user, and vice versa. The architecture of the data flow is shown in figure below. <img loading=\"lazy\" decoding=\"async\" class=\"wp-image-345 aligncenter\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/App-Structure-e1481929179763.jpg\" alt=\"app-structure\" width=\"490\" height=\"318\" \/><\/p>\n<p>The dataflows between the app and server subsystems<\/p>\n<p>The app, written for the Android mobile platform, is used to:<\/p>\n<ul>\n<li>Display diagnostic information about Mell-E<\/li>\n<li>Show the areas which Mell-E has covered<\/li>\n<li>Provide location boundaries which Mell-E is allowed to cover<\/li>\n<li>Start\/stop Mell-E<\/li>\n<\/ul>\n<p>Among all the host-providers, we decided to use Heroku as our API host provider, as it has tools that make it simple to diagnosis issues with the application and remotely restart the server.\u00a0 With regards to the server-side technology, we used Ruby on Rails as our backend platform as our team-members had the most familiarity with the technology.\u00a0 Furthermore, Ruby on Rails provides tools which simplify the process of managing the database.\u00a0 For the database technology, we chose to use PostgreSQL because it is scalable while still being simple to manage. Mell-E retrieves the boundary data and start\/stop commands from the server.\u00a0 We currently haven\u2019t implemented either or these functions on Mell-E; i.e., for the Fall semester, we pre-programmed a set of waypoints that Mell-E should go within 10 feet of.\u00a0 Furthermore, rather than allowing the user to remotely start\/stop Mell-E, we start\/stop Mell-E directly from the mobile base.\u00a0 Nevertheless, both the UI for starting\/stopping Mell-E and setting Mell-E\u2019s boundaries have been built on the app. Our backend exposes the following JSON API endpoints:<\/p>\n<table width=\"652\">\n<tbody>\n<tr>\n<td width=\"119\">HTTP Method<\/td>\n<td width=\"124\">Endpoint<\/td>\n<td width=\"409\">Parameters<\/td>\n<\/tr>\n<tr>\n<td width=\"119\">POST<\/td>\n<td width=\"124\">\/api\/boundary<\/td>\n<td width=\"409\">robotID, startLat, startLng, endLat, endLng<\/td>\n<\/tr>\n<tr>\n<td width=\"119\">GET<\/td>\n<td width=\"124\">\/api\/boundary<\/td>\n<td width=\"409\">robotID<\/td>\n<\/tr>\n<tr>\n<td width=\"119\">POST<\/td>\n<td width=\"124\">\/api\/running<\/td>\n<td width=\"409\">robotID, isRunning<\/td>\n<\/tr>\n<tr>\n<td width=\"119\">GET<\/td>\n<td width=\"124\">\/api\/running<\/td>\n<td width=\"409\">robotID<\/td>\n<\/tr>\n<tr>\n<td width=\"119\">POST<\/td>\n<td width=\"124\">\/api\/heartbeat<\/td>\n<td width=\"409\">robotID, lat, lng, batteryLevel, signalStrength, binFullness<\/td>\n<\/tr>\n<tr>\n<td width=\"119\">GET<\/td>\n<td width=\"124\">\/api\/heartbeat<\/td>\n<td width=\"409\">robotID, withPath<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The heartbeat contains all the important diagnostic data about Mell-E.\u00a0 Mell-E\u2019s location is retrieved from an Android phone that runs aboard the robot.\u00a0 As detailed in the navigation subsystem description, our team decided the external GPS sensor was too noisy for our purpose; as a result, we wrote a simple app that retrieves the location and heading of the robot.\u00a0 In addition, the mobile phone on-board Mell-E transmits a WiFi hotspot that allows Mell-E to connect to the Internet.\u00a0 The battery level is calculated based on a voltage sensor attached to the batteries.\u00a0 We use an IR sensor to measure how full Mell-E\u2019s bin is.\u00a0 Finally, the signal strength is calculated based on the cellular signal strength of the mobile phone onboard Mell-E.<\/p>\n<p>Representation of how data is displayed to the user through the Android app UI is shown below.\u00a0 In the state represented by the UI, Mell-E is stopped and does not have any boundaries set.\u00a0 Therefore, the UI asks the user to enter a boundary area.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-346 aligncenter\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/App-e1481929266581.jpg\" alt=\"app\" width=\"276\" height=\"263\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Main components of the UI are shown in the figure on the left. The figure beside displays the main components of the user-interface.\u00a0 As previously explained, the UI displays relevant diagnostic data about Mell-E.\u00a0 Additionally, the app is used to start\/stop Mell-E and set the boundaries that Mell-E must cover. For Fall semester, our group:<\/p>\n<ul>\n<li>Implemented all the functions of the user interface<\/li>\n<li>Wrote the backend API services<\/li>\n<li>Pushed the application to a production server<\/li>\n<li>Setup a Postgres database<\/li>\n<li>Retrieved sensor data from Mell-E and transmitted it to the server<\/li>\n<\/ul>\n<p>For Spring semester, we had added the remote start and stop capabilities to the app. This was separated into two parts: build app content and be able to update data on server through touching buttons; pull the updated data from server and activate or kill the navigation node on Mell-E. The following four pictures show the start\/stop buttons in app and their effects of updating isRunning data&#8217;s states on the server.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-440 alignleft\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3287.jpg\" alt=\"\" width=\"228\" height=\"406\" srcset=\"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3287.jpg 899w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3287-169x300.jpg 169w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3287-768x1366.jpg 768w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3287-576x1024.jpg 576w\" sizes=\"auto, (max-width: 228px) 100vw, 228px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-242 alignleft\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/2-1.png\" alt=\"\" width=\"206\" height=\"197\" srcset=\"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/2-1.png 407w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/2-1-300x287.png 300w\" sizes=\"auto, (max-width: 206px) 100vw, 206px\" \/><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-441 alignleft\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3289.jpg\" alt=\"\" width=\"229\" height=\"408\" srcset=\"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3289.jpg 899w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3289-169x300.jpg 169w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3289-768x1366.jpg 768w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3289-576x1024.jpg 576w\" sizes=\"auto, (max-width: 229px) 100vw, 229px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-442 alignleft\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3288.jpg\" alt=\"\" width=\"229\" height=\"407\" srcset=\"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3288.jpg 899w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3288-169x300.jpg 169w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3288-768x1366.jpg 768w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3288-576x1024.jpg 576w\" sizes=\"auto, (max-width: 229px) 100vw, 229px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"wp-image-242 alignleft\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/2-1.png\" alt=\"\" width=\"202\" height=\"193\" srcset=\"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/2-1.png 407w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/2-1-300x287.png 300w\" sizes=\"auto, (max-width: 202px) 100vw, 202px\" \/><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-443 alignleft\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3290.jpg\" alt=\"\" width=\"229\" height=\"407\" srcset=\"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3290.jpg 899w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3290-169x300.jpg 169w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3290-768x1366.jpg 768w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/IMG_3290-576x1024.jpg 576w\" sizes=\"auto, (max-width: 229px) 100vw, 229px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Once the server get updated, we created a Heartbeat ROS node that will grasp the data from the server and publish a topic \/running to navigation ROS node, which will activate\/kill the navigation process. The logic is shown as follows: \u00a0 \u00a0 <img loading=\"lazy\" decoding=\"async\" class=\" wp-image-447 aligncenter\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/APP1.png\" alt=\"\" width=\"571\" height=\"312\" srcset=\"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/APP1.png 518w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/APP1-300x164.png 300w\" sizes=\"auto, (max-width: 571px) 100vw, 571px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-448 aligncenter\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/APP2.png\" alt=\"\" width=\"517\" height=\"288\" srcset=\"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/APP2.png 517w, https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-content\/uploads\/sites\/14\/2016\/10\/APP2-300x167.png 300w\" sizes=\"auto, (max-width: 517px) 100vw, 517px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>App and Server Subsystem The main function of the server is to act as a repository and relay data between Mell-E and the user, and vice versa. The architecture of the data flow is shown in figure below. The dataflows between the app and server subsystems The app, written for the Android mobile platform, is<br \/><a class=\"moretag\" href=\"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/system-implementation\/app-and-server-subsystem\/\">+ Read More<\/a><\/p>\n","protected":false},"author":49,"featured_media":0,"parent":180,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-540","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-json\/wp\/v2\/pages\/540","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-json\/wp\/v2\/users\/49"}],"replies":[{"embeddable":true,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-json\/wp\/v2\/comments?post=540"}],"version-history":[{"count":4,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-json\/wp\/v2\/pages\/540\/revisions"}],"predecessor-version":[{"id":564,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-json\/wp\/v2\/pages\/540\/revisions\/564"}],"up":[{"embeddable":true,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-json\/wp\/v2\/pages\/180"}],"wp:attachment":[{"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2016teamc\/wp-json\/wp\/v2\/media?parent=540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}