Anki Overdrive API
Prerequisites
- Bluetooth Low Enerty (BLE) Adapter
- Some modifications to get BLE running in your OS (see noble)
Install
npm install anki-overdrive-api --save
Changelog
Changes in the API are tracked in a Changelog.
Documentation
The current documentation of the API can be found here
Usage
The API implements the current specification of the official Anki Overdrive Drive SDK. The API can be used to find and control vehicles in the BLE network.
Searching vehicles
Use the VehicleScanner
class to search for vehicles in the BLE network.
scanner.findAll.then.catch/* Handle Errors */
Vehicles can also be found by using the device address or id.
scanner.findByAddress"42:e2:b6:q7".then scanner.findById"df6as5fda".then
Controlling Vehicles
After connecting the vehicles they can execute several commands like changing the speed or lane. See the documentation to see all commands.
// First the vehicle has to be connectedvehicle.connect.then
The vehicles can also send messages if they changes their position. Therefore a listener has to be registered on the vehicle.
vehicle.addListener
Testing
The API can be tested with unit tests or end-to-end (e2e) tests. Code coverage is also supported.
Run unit tests
npm t
or with code coverage
npm run test:coverage
Run e2e tests
npm run test:e2e
Note: You need to specify at least one vehicle in the settings.json in test/e2e/resources
.
The vehicle has to be online and full charged placed on the track.
Developing
Clone the repo and install the dependencies, please follow the instructions from the prerequisites section to avoid problems concerning the BLE adapter.
git clone https://github.com/Aspern/anki-overdrive-api.git
cd anki-overdrive-api
npm i
Licence
Copyright © 2017-present, msg systems ag