Code Monkey home page Code Monkey logo

libevents's Introduction

libevents

This project contains the events interface, which includes the following:

  • a protocol to send events based on an ID (and possibly arguments) to inform other components (in a reliable way)
  • using MAVLink as a transport layer. Each MAVLink component can send and/or receive events to/from other components. The primary use-case is for an autopilot to inform a user (through a GCS) about certain events (such as a failsafe action).
  • metadata for each event, for example a description, stored as JSON. Metadata is typically distributed via the COMPONENT_INFORMATION MAVLink API.
  • a set of commonly used predefined events that can be used to build simple protocols
  • a parser (MAVLink-independent) to combine event ID's with the JSON metadata for display or analysis purposes. This also includes log processing.

Design

Initial design doc: https://docs.google.com/document/d/18qdDgfML97lItom09MJhngYnFzAm1zFdmlCKG7TaBpg/edit#heading=h.l8v2vka1vs88

Event definitions

Event definitions are separated by namespaces. Each namespace has a name and an 8 bit component ID (typically matching the MAVLink component ID). Within a namespace, each event has a unique name and sub ID (24 bits). The event ID is the combined component ID with sub ID. So events can be uniquely identified for the whole system by ID or <namespace>::<name>.

Each event can have a set of arguments, using either basic types or enums.

Message and description

Events have a single-line (short) message and possibly a more extensive description.

Supported format and parsing:

  • characters can be escaped with \

    These have to be escaped: '\\', '\<', '\{'.

  • tags:

    • Profiles: <profile name="[!]NAME">CONTENT</profile>

      CONTENT will only be shown if the name matches the configured profile. This can be used for example to hide developer information from end-users.

    • URLs: <a [href="URL"]>CONTENT</a>. If href is not set, use CONTENT as URL

    • Parameters: <param>PARAM_NAME</param>

    • no nested tags of the same type

  • arguments: following python syntax, with 1-based indexing (instead of 0)

    • general form: {ARG_IDX[:.NUM_DECIMAL_DIGITS][UNIT]}

      UNIT:

      • m: horizontal distance in meters
      • m_v: vertical distance in meters
      • m^2: area in m^2
      • m/s: speed in m/s
      • C: temperature in degrees celcius

Log levels

Events have 2 log levels:

  • Internal: for logging purposes
  • External: log level used by a GCS

Typically the same log level is used for both cases, but they can differ. For example a low battery event could be shown as warning to the user, but is either an info or disabled in the log.

An event with log level 'Protocol' should not be shown.

Event groups

Every event belongs to a group. That is essentially just a tag, and can be used to treat a set of events different from others. A UI should not display unkown groups.

Special groups:

  • calibration: used for the sensor/RC calibration protocol

  • health and arming_check: used to report health and arming check results. Apart from the 2 summary messages, each event needs to have at least 2 arguments:

    • common::navigation_mode_category_t modes: affected flight modes (bitmask)
    • uint8_t health_component_index: affected health component index (to the health_component_t bitset), can be -1 if none applies.

    The order of sending is:

    • arming_check_summary
    • set of N health and arming check events
    • health_summary

common namespace

Since events in the common namespace are used by multiple components, they cannot be changed arbitrarily. Rules:

  • changing the description or message is ok, as long as the semantic is the same
  • arguments cannot be changed, it is only possible to add new arguments
  • for any other change (name, ID, ...), a new event needs to be defined, and the old one deprecated.
  • enums cannot be changed, except for adding new values

Serialization

  • Event arguments are serialized in the same order as defined. No extra padding, so accesses might be unaligned.
  • Everything assumes little endian

libevents's People

Contributors

bkueng avatar voanhcuoc avatar

Watchers

James Cloos 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.