{"id":1954,"date":"2018-01-26T16:00:59","date_gmt":"2018-01-26T21:00:59","guid":{"rendered":"https:\/\/rpchurchill.com\/wordpress\/?p=1954"},"modified":"2018-01-30T02:57:39","modified_gmt":"2018-01-30T07:57:39","slug":"generic-sensor-api","status":"publish","type":"post","link":"https:\/\/rpchurchill.com\/wordpress\/posts\/2018\/01\/26\/generic-sensor-api\/","title":{"rendered":"Generic Sensor API"},"content":{"rendered":"<p>On Wednesday I attended a <a href=\"https:\/\/www.meetup.com\/Pittsburgh-Code-Supply\/events\/246610327\/\">Meetup<\/a> hosted by Pittsburgh Code &#038; Supply.  This particular event was hosted by <a href=\"https:\/\/www.meetup.com\/Pittsburgh-Code-Supply\/members\/154177352\/\">Brian Kardell<\/a> (see also <a href=\"https:\/\/briankardell.wordpress.com\/\">here<\/a>) and was formally titled with the prefix &#8220;[Chapters Web Standards]:&#8221; I think to indicate that the talk is part of a <a href=\"https:\/\/www.youtube.com\/watch?v=rwWEQPc5GRE\">series or a larger effort<\/a>.<\/p>\n<p>The talk itself (see slides <a href=\"https:\/\/docs.google.com\/presentation\/d\/1-gCCSMCLUg--SjaFC_Q8cxJA2K1d4IoTS0f-T-f9pzQ\/edit#slide=id.g325ebd679c_0_0\">here<\/a>) was delivered remotely from Denmark by <a href=\"https:\/\/github.com\/kenchris?tab=activity\">Kenneth R. Christiansen<\/a>, who works for Intel on web standards.<\/p>\n<p><a href=\"https:\/\/www.w3.org\/TR\/generic-sensor\/\">Here<\/a> is the current working draft standard for the Generic Sensor API.<\/p>\n<p>I drove up to Pittsburgh to see the talk because of my experience working with real-time, real-world systems that included sensors and actuators.   I had even run into some of the specific issues discussed when I was experimenting with <a href=\"https:\/\/threejs.org\/\">Three.js<\/a> and <a href=\"https:\/\/www.khronos.org\/webgl\/\">WebGL<\/a> in preparation for the <a href=\"http:\/\/slides.com\/qulatan\/deck#\/\">talk<\/a> I gave at <a href=\"https:\/\/www.meetup.com\/charmcityjs\/events\/228557320\/\">CharmCityJS<\/a>.  I wrote about my investigations <a href=\"https:\/\/rpchurchill.com\/wordpress\/posts\/2017\/02\/09\/webgl-incorporating-device-orientation\">here<\/a>.<\/p>\n<p>That preamble out of the way, the presentation was really interesting.  It was also very dense and delivered very quickly.  The speaker demanded a lot of his audience as he made it through all 67 slides in less than an hour.  This worked because the audience probably self-selected for interest in the subject and because the slides are posted <a href=\"https:\/\/docs.google.com\/presentation\/d\/1-gCCSMCLUg--SjaFC_Q8cxJA2K1d4IoTS0f-T-f9pzQ\/edit#slide=id.g325ebd679c_0_0\">here<\/a>.<\/p>\n<p>The talk described efforts to create a standard way of exposing and accessing sensors of various kinds.  Many of these are built in to the devices themselves (like the accelerometers in three axes built into handheld devices like phones that allow sensing of orientation and other things) but the talk also described how to incorporate sensors built into external devices.  One example involved an external Arduino board connected through the Chrome browser&#8217;s <a href=\"https:\/\/caniuse.com\/#search=bluetooth\">Bluetooth API<\/a> as shown here:<\/p>\n<p><!--iframe width=\"1280\" height=\"720\" src=\"https:\/\/www.youtube.com\/embed\/K0efnqWDrkY?ecver=1\" frameborder=\"0\" allow=\"autoplay; encrypted-media\" allowfullscreen><\/iframe--><br \/>\n<iframe loading=\"lazy\" width=\"320\" height=\"180\" src=\"https:\/\/www.youtube.com\/embed\/K0efnqWDrkY?ecver=1\" frameborder=\"0\" allow=\"autoplay; encrypted-media\" allowfullscreen><\/iframe><\/p>\n<p>I had known about the Bluetooth API but learned there was also a <a href=\"https:\/\/caniuse.com\/#search=usb\">USB API<\/a>, which also seems to be implemented only on Chrome.<\/p>\n<p>The talk included a number of highly informative graphics.  The illustration of how accelerometers work was a classic case of a picture being worth a thousand words.  I&#8217;d never taken the time to think about how they worked but Ken&#8217;s <a href=\"https:\/\/docs.google.com\/presentation\/d\/1-gCCSMCLUg--SjaFC_Q8cxJA2K1d4IoTS0f-T-f9pzQ\/edit#slide=id.g325ebd679c_0_284\">25th slide<\/a> led to an immediate &#8220;aha!&#8221; moment.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.rpchurchill.com\/images\/articles\/20180126_Accelerometer_images.png\" width=\"400px\" \/><\/p>\n<p>Subsequent images showed how gyroscopes and magnetometers work with similar verve.<\/p>\n<p>The most interesting parts of the discussion involved derived and fusion sensors, with the latter being fusions of physical sensors into unified, abstract sensors implemented in code.  (See slides <a href=\"https:\/\/docs.google.com\/presentation\/d\/1-gCCSMCLUg--SjaFC_Q8cxJA2K1d4IoTS0f-T-f9pzQ\/edit#slide=id.g32614e00d6_0_100\">14<\/a> and following.)  Several examples were given about how fusion is accomplished, including text and code.<\/p>\n<p>The talk went into security concerns, which is obviously important.<\/p>\n<p>I had also never heard the term &#8220;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Polyfill_(programming)\">polyfill<\/a>&#8221; before.  It refers to code that implements features found in some browsers in other browsers that do not support those features.<\/p>\n<p>The <a href=\"https:\/\/www.zephyrproject.org\/introducing-javascript-runtime-for-zephyr-os\/\">Zephyr.js<\/a> project, which implements a limited, full-stack (Node.js-based) version of JavaScript on small, IOT-type devices (like Arduino boards), was referenced, as well as the <a href=\"http:\/\/johnny-five.io\/\">Johnny Five<\/a> project, which does something similar.  I&#8217;ve been playing around with Arduino kits a little bit and am looking forward to trying these.<\/p>\n<p>I haven&#8217;t included a huge amount of text here but have probably set a new record for links.  This is an indication that I found the talk hugely satisfying.  It should provide a lot of food for thought going forward.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On Wednesday I attended a Meetup hosted by Pittsburgh Code &#038; Supply. This particular event was hosted by Brian Kardell (see also here) and was formally titled with the prefix &#8220;[Chapters Web Standards]:&#8221; I think to indicate that the talk &hellip; <a href=\"https:\/\/rpchurchill.com\/wordpress\/posts\/2018\/01\/26\/generic-sensor-api\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[199,197,196,198,200],"_links":{"self":[{"href":"https:\/\/rpchurchill.com\/wordpress\/wp-json\/wp\/v2\/posts\/1954"}],"collection":[{"href":"https:\/\/rpchurchill.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rpchurchill.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rpchurchill.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/rpchurchill.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1954"}],"version-history":[{"count":10,"href":"https:\/\/rpchurchill.com\/wordpress\/wp-json\/wp\/v2\/posts\/1954\/revisions"}],"predecessor-version":[{"id":1973,"href":"https:\/\/rpchurchill.com\/wordpress\/wp-json\/wp\/v2\/posts\/1954\/revisions\/1973"}],"wp:attachment":[{"href":"https:\/\/rpchurchill.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1954"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rpchurchill.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1954"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rpchurchill.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}