The Anki Drive SDK for Java is an implementation of the message protocols and data parsing routines necessary for communicating with Anki Drive vehicles.
See anki/drive-sdk for the official SDK written in C.
The authors of this software are in no way affiliated to Anki. All naming rights for Anki, Anki Drive and Anki Overdrive are property of Anki.
Unfortunately, there is currently no cross-platform Java library to interface with Bluetooth LE devices.
This project therefore requires a Node.js gateway service to handle low-level communication with the Anki vehicles. All data processing and message parsing is carried out in Java code.
To build and use the SDK in your own project you will need:
- Java JDK (>= 1.8.0)
- a compatible Bluetooth 4.0 interface with LE support
To install the SDK and all required dependencies run the following commands:
git clone https://github.com/adessoAG/anki-drive-java
cd anki-drive-java
./gradlew build
Optional Dependency node-usb will not be installed. So, run:
sudo apt-get install libudev-dev
Start the Node.js gateway service:
./gradlew server
To get the Java library into your build:
// add JitPack.io as a repository
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
// <Git commit-ish>: commit hash or tag
compile 'com.github.adessoAG:anki-drive-java:<Git commit-ish>'
}
For the Maven instructions see the JitPack.io website.
Create a AnkiConnector object:
AnkiConnector anki = new AnkiConnector("localhost", 5000);
Start scanning for vehicles:
List<Vehicle> vehicles = anki.findVehicles();
To try a connection, start the server and run the class:
edu.oswego.cs.CPSLab.anki.AnkiConnectionTest
Contributions are always welcome! Feel free to fork this repository and submit a pull request.