GithubHelp home page GithubHelp logo

dvallejo / sparkstream_ioft Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pfcoperez/sparkstream_ioft

0.0 2.0 0.0 2.95 MB

Code used for "Spark Stream for the Internet of [Flying] Things" Meetup 2016

License: MIT License

Scala 100.00%

sparkstream_ioft's Introduction

Internet Of Flying Things

This project is a PoC whereby we succesfully test whether is possible to analyze the collective behaviour of a UAV fleet using Big Data streaming tools. Namely Spark Streaming.

Where to start reading this code?

It seems a good a idea to start with the Spark Streaming applications where streams are created and combined in different ways to show the transformations providing detection algorithms, how the latter work and how their generated events can be persisted into Cassandra.

All these Spark Streaming drivers belong to com.stratio.ioft.streaming.drivers package. There are two types of apps: Demonstration drivers and a main application which covers many cases and includes persistence.

And, finally, the full-stack driver:

Stream sources and transformations

The building blocks of the aforementioned Spark Streaming drivers (applications) can be found under com.stratio.ioft.streaming.transformations package. It contains a set of objects with functions to build, compose and transform streams:

  • At Sources are deffined those methods which extract high level objects from an Entry stream.
  • Aggregators contains methods to aggregate sets of events within a window into a smaller set of events. e.g: All actittuve events within a window can be transformed into a single history event sumarizing what happened during the window.
  • Combinators
  • Find at Detectors the transformations needed to located x-axis bumps.

Input

Attitude

Provided by entries (Entry) with name AttitudeState

yaw pitch roll

The following example:

{
  "fields": [
    {
      "name": "Roll", 
      "type": "float32", 
      "unit": "degrees", 
      "values": [
        {
          "name": "0", 
          "value": 12.360915184020996
        }
      ]
    }, 
    {
      "name": "Pitch", 
      "type": "float32", 
      "unit": "degrees", 
      "values": [
        {
          "name": "0", 
          "value": -7.535737991333008
        }
      ]
    }, 
    {
      "name": "Yaw", 
      "type": "float32", 
      "unit": "degrees", 
      "values": [
        {
          "name": "0", 
          "value": 13.041015625
        }
      ]
    }
  ], 
  "gcs_timestamp_ms": 1459438549760, 
  "id": "D7E0D964", 
  "instance": 0, 
  "name": "AttitudeState", 
  "setting": false
}

Is telling us that:

  • The drone is looking towards NE: 13.04º (positive yaw)
  • It is 12.36º inclined to the right (positive roll)
  • And slightly facing ground: -7.53º (negative pitch)

Acceleration

Acceleration information is given as:

{
    "fields": [
      {
        "name": "x", 
        "type": "float32", 
        "unit": "m/s^2", 
        "values": [
          {
            "name": "0", 
            "value": -0.02022501826286316
          }
        ]
      }, 
      {
        "name": "y", 
        "type": "float32", 
        "unit": "m/s^2", 
        "values": [
          {
            "name": "0", 
            "value": 0.05858611315488815
          }
        ]
      }, 
      {
        "name": "z", 
        "type": "float32", 
        "unit": "m/s^2", 
        "values": [
          {
            "name": "0", 
            "value": -9.915225982666016
          }
        ]
      }
    ], 
    "gcs_timestamp_ms": 1461080146848, 
    "id": "AD3C0E06", 
    "instance": 0, 
    "name": "AccelState", 
    "setting": false
  }

Where:

*X Represents the horizontal acceleration in the direction of roll axis. Positive values represent the UAV accelerating fordward whereas negative values show a slowing or backward acceleraton. *Y Represents the the horizontal acceleration in the direction of the pitch axis, that is, left (-) or right(+) *Z stands for the vertical acceleration which, at rest, should be near -9.8 m/s^2 thus representing gravitational acceleration.

Barometer and its magnitudes

A baromether with an internal termoter is embeeded in the flight instrumentation chip, it provides a temperature adjusted barometric measure as well which allows altitude (not attitude) inference:

  {
    "fields": [
      {
        "name": "Altitude", 
        "type": "float32", 
        "unit": "m", 
        "values": [
          {
            "name": "0", 
            "value": 646.9263916015625
          }
        ]
      }, 
      {
        "name": "Temperature", 
        "type": "float32", 
        "unit": "C", 
        "values": [
          {
            "name": "0", 
            "value": 46.57999801635742
          }
        ]
      }, 
      {
        "name": "Pressure", 
        "type": "float32", 
        "unit": "kPa", 
        "values": [
          {
            "name": "0", 
            "value": 93792
          }
        ]
      }
    ], 
    "gcs_timestamp_ms": 1461080146844, 
    "id": "48120EA6", 
    "instance": 0, 
    "name": "BaroSensor", 
    "setting": false
  },

sparkstream_ioft's People

Contributors

mafernandez-stratio avatar pfcoperez avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.