Coder Social home page Coder Social logo

bluecobold / ankinodedrive Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tiker/ankinodedrive

0.0 1.0 0.0 3.88 MB

Anki Overdrive SDK using Node and BTLE

License: GNU General Public License v3.0

JavaScript 77.79% CSS 5.28% HTML 14.28% Shell 2.65%

ankinodedrive's Introduction

AnkiNodeDrive

Anki Overdrive SDK using Node and BTLE

This emulates much of what can be found in the default Anki Drive SDK:
http://developer.anki.com/drive-sdk/
This example shows similar capabilities using NodeJS.

Full documentation can be found in the apidoc/index.html; which is automatically served by the nodeJS server at '/'.

Running

There is a run.sh to show how to run the server using a specific BLTE device. I run this on a PI3 with built-in BLTE. If you only have one BLTE device, node server.js should be enough. You will likely need to do an npm install first to gather any dependencies.

Basic capabilities

See the apidoc for full api documentation. There are some APIs, such as set-sdk, connect, etc, which happen automatically, so you don't need to worry about them. For example, when you call "setSpeed", if the server is not connected to a car yet, it will automatically do a connect and turn on sdk mode. Also, logging is turned off by default, so you won't see messages from the car unless you explicitly call the 'turnOnLogging' service.

Here is a basic list of capabilities:
COMMUNICATIONS

  • batteryLevel
  • connect
  • disconnect
  • getDevices
  • ping
  • rescan
  • turnOnLogging
DRIVE
  • changeLanes
  • setLaneOffset
  • setSpeed
  • trackCountTravel
LIGHTS
  • flashTaillights
  • setEngineLight
  • turnOffHeadlights
  • turnOffTaillights
  • turnOnHeadlights
  • turnOnTaillights
MAPPING
  • getTrackMap
  • getTrackMapData
  • mapTrack

Example map generated

Known Limitations

I was only able to sort out the track IDs for my kit. I have a few other kits on order and will update the track IDs as best I can. Please let me know if you are able to tell me additional track IDs and what type of track it is (straight/curve/start).

The lights APIs were not easy to figure out. I believe they changed quite a bit in the Overdrive version and the public SDK does not address the changes yet. I did my best to handle a few cases. If you sort out others, let me know.

I began to work on being able to build a map of the track, but this is not yet complete. My thinking was to expose two services:
/mapTrack/:carname - This would drive the given car at a slow pace (300) and capture each track ID from start to finish building a track map array.
/getMap - Get the resulting map array which could be used to generate an image.
/getMapImage - Perhaps auto generate a png/gif of the track. TBD

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.