Home Manual Reference Source Test Repository

Build Status API Doc Code Climate Dependencies

MEP (Memristor's Eurobot Platform)

MEP is a development platform for easy building and prototyping software for robots. It allows developing drivers for hardware modules, implementation of control algorithms and testing new strategies.

Read more about Memristor at our website.

Installation

*only for Debian distros

  • Install Node.js & npm
    curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
    sudo apt-get install -y nodejs
    
  • Install git sudo apt-get install git
  • Install MEP
    git clone https://github.com/Memristor-Robotics/mep-core.git --depth 1 && cd mep-core && sudo ./install
    

Execute

./mep

check for arguments

./mep --help

Dashboard (simulator & other tools)

Check here for more details

Documentation

create a documentation locally

npm run-script docs

or check for online docs

Logger

Logger

Please don't use console.log(message)! Instead of that use built in logging system Mep.Log.debug(module, message). For more details please check reference for Log class.

Logger configuration

Configuration can be done via configuration file located under src/config directory.

Sample configuration:

"Log": {
  "console" :{
    "active" : true,
    "outputMode" : "short",
    "color": true
  },
  "file" :{
    "active" : false,
    "file" : "javascript.log",
    "period" : "1d",
    "count" : 3
  },
  "elasticsearch": {
    "active" : false,
    "level" : "debug",
    "host" : "http://localhost:9200",
    "indexPattern" : "[mep2_logs-]YYYY-MM-DD",
    "type": "log"
  }
},

Loggers

console

Console logger parameters:

  • active (false): true/false : activate console logger
  • outputMode (short): short|long|simple|json|bunyan see bunyan-format
  • color (true): toggles colors in output

By default log level is debug.

file

File logger parameters:

  • active (false): true/false : activate file logger
  • file (javascript.log): log filename, either an absolute path, or relative to ./logs directory
  • period (1d): rotate log every day
  • count (3): backup only

By default log level is debug.

elasticsearch

  • active (false): true/false : activate elasticsearch logger
  • level (debug): debug/info : debug level
  • host (http://localhost:9200) : elasticsearch server http address
  • index (mep2_logs) : elasticsearch index name. (no pattern allowed here)
  • indexPattern ([mep2_logs-]YYYY-MM-DD) : elasticsearch index pattern. Can be a static name or a dynamic with YYYY-MM-DD pattern.
  • type (log): elasticsearch type

If index is configured, indexPattern is ignored.

Performance Parameter

Log are impacted by "performance" parameter, if "performance" == true : Log level is limited to "info" for all loggers.

About

About

Our goal is to make a modular platform for developing robots for Eurobot competition.

Big picture simple

MEP Simple

Big picture full

MEP Full

Goals

Goals

Modular

Every driver or service can be easily replaced and tested separately.

Team orientated

There is big picture & every module is separated.

Easy & fast to make a change

Because it is JIT you don't have compile and transfer over the network

Fast learning curve

Software should be well organized and documented.

Tested

Every module should be tested using Unit tests.

Package manager

Don't rewrite software, if there is already packet written use it.

Hardware independent

Services should be independent of drivers, practically that means if we disable LidarDriver TerrainService should work just fine.

Logging system

Elastic Search & Kibana will help us to find a bugs.

Guide

Guide

Logger

Please don't use console.log(message)! Instead of that use built in logging system Mep.Log.debug(module, message). For more details please check reference for Log class.

Inspiration

Inspiration

Previous Memristor's software

The most of concepts are taken by previous software built by Pandurov.

ROS

Publish/Subscribe system is inspired by ROS.

Android

Like Android's Service Manager and generally managers in Android platform our software has DriverManager, ServiceManager, LaserManager... Necessarily module name in Android's Log class is great, and we will also use it.

Yii

Ability to change module's class path in config file is implemented in Yii framework. Also as Yii has global object Yii we have global object Mep which provides custom require function, access to configuration and logging system.

Alexandre Guillon

Alexandre has been helping a lot during software design.

Services vs Drivers

Services vs Drivers

Drivers

A driver provides a software interface to hardware devices, enabling services and users to access hardware functions without needing to know precise details of the hardware being used.

The configuration file determinate which driver is going to be used and which parameters to use. It is very useful when we are speaking about rapid hardware changes and using the same core for multiple robots.

Services

A service presents high level of abstraction and it refers to a set of software functionalities that can be for different purposes. The service implements complex algorithms to collect, synthesize and process data from drivers and it also provides interface to control the robot.

In short, services are the brain of the platform. They are hardware independent and all services are always available. Using driver provide mechanism services are able to collect data from unlimited number of drivers without needing to reprogram the service.

Creating a Driver

Creating a Driver

SkeletonDriver

Let's start with very simple driver which do nothing. SkeletonDriver meets minimal requirements to become a driver.

class SkeletonDriver {
    constructor(name, config) {

    }

    provides() { return []; }
}

Each driver gets variables name and config in constructor. name is unique name of each driver instance, and config is configuration object for instance of the driver.

Method provides() can return empty array or array of strings which represents data that can be provided by a driver. If driver provides some type of data it must meets a requirements for that type of data. More will be explained.

All drivers are located in directory /drivers and by convention have dedicated directory, eg. SkeletonDriver is stored in /drivers/skeleton/SkeletonDriver.js.

Every driver must be added in configuration file. By adding our driver in configuration file DriverManager knows that our driver should be instantiated.

... 
Drivers: {
    ... 
    SkeletonDriverInstance: {
        class: 'drivers/skeleton/SkeletonDriver',
        init: true
    }
}

An example of a driver in configuration file. SkeletonDriverInstance in this case is name of the instance of SkeletonDriver. class is path to SkeletonDriver.js and init field describes if driver should be instantiated or not.

SimpleDriver

The code above is example of a very simple driver.

const driverManager = Mep.require('drivers/DriverManager').get();

class SimpleDriver {
    constructor(name, config) {
        this.modbusDriver = driverManager.getDriver('ModbusDriver');
    } 

    provides() { return ['terrain']; }
}

TODO: Explain all segments of the SimpleDriver

References

References

Class Summary

Static Public Class Summary
public
this class was deprecated.

Queue of callback functions.

public

Driver for CAN bus (Controller Area Network)

public

Driver that simulates CAN bus

public

Implementation of circular buffer using Node.js's Buffer

public

A goal of the class is to check if drivers are correctly implemented.

public

Class manipulate drivers

public

Communicates with dynamixel servos (AX12 & RX24).

public
public

Uses data from infrared sensors to determine where is an enemy robot and other obstacles.

public

Provides an abstraction layer on top of lidar's firmware and algorithms to determine robot's position and obstacles

public

Line in 2D space

public
public

Mep

Proxy to custom require(), Log, Config, DriverManager & services.

public

Driver for Modbus communication protocol.

public

Simulation for Modbus communication protocol

public

MotionDriverSimulator simulation module.

public

Driver enables communication with Memristor's motion driver.

public

Remote controller for motion driver

public

Natively (C++) implemented driver that enables communication with Memristor's motion driver.

public

Provides a very abstract way to control and estimate robot position

public

Target (point & params) that robot has to reach

public

Queue of targets (points) that robot has to reach.

public

Packetized Low-Level Secured Protocol

0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+--------------+-------+-------+---------------+----------------+
|  Start Byte  | Header|Payload|  Packet type  | Payload length |
|    (0x3C)    |    Checksum   |               |                |
+-------------------------------- - - - - - - - - - - - - - - - +
:                     Payload Data continued ...

public

Communicates with pins on microcontrollers.

public

Point in 2D space

public

Describes an polygon

public

Implements algorithms to collect data from sensors and determine current robot's location

public

Default scheduler class describes general task scheduling and robot behaviour

public

Implements algorithms to schedule task execution

public

Automatically shares position, obstacles and task statuses between robots and provides simple API to share custom messages.

public

Detects when rope is pulled out of the robot and starts counting game time.

public

Default task class describes general task robot behaviour during task execution

public

Describes an error during strategy execution (eg.

public

Enables communication between mep-core and mep-dash.

public

Class represent obstacles on the terrain and mechanism to search terrain between objects.

public

Tunable angle.

public

Tunable Point.

public

Driver enables uart communication with electronic boards

public

Udp

Provides sharing based on UDP protocol.

public

Logs memory and cpu usage

Function Summary

Static Public Function Summary
public

async delay(milliseconds: *): Promise

Synced setTimeout()

Variable Summary

Static Public Variable Summary
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

Point: *

public

Point: *

public

Point: *

public

Point: *

public

Point: *

public

Point: *

public

Point: *

public
public
public
public
public
public
public
public
public

Task: *

public
public
public

Usage: *

public

fs: *