Crate dji_onboard [] [src]

DJI Onboard

Rust implementation of DJI open protocol and the application of the protocol.

Example

extern crate dji_onboard;
extern crate serial;

use dji_onboard::{Runner, Task, TaskType};

fn main() {
    const RAW_KEY: &'static str = "ca229c5d7ca44920ba3716e5baabc310\
                                   ed94aa40c1fd405296f793a4d7343518";

    let task = Task::activate(12345);

    // Create runner
    let mut runner = Runner::build()
        .finish("/tmp/serial-port", serial::Baud9600, RAW_KEY)
        .unwrap();

    // Add tasks
    runner.add_task(TaskType::simple(task));

    // Run the event loop
    runner.run();
}

Run

Create a task file in json format like task-sample.json.

# Command line usage:
$ cargo run -- -h

# Run the program:
$ cargo run -- -t task.json

# Use `-f <file>` to log flight data to file:
$ cargo run -- -t task.json -f flight-data

To start a shell for interacting with the program, add an entry named tcp-port to task.json:

{
  // ...
  "tcp_port": 9090,
  // ...
}

then run telnet 127.0.0.1 9090 or rlwrap telnet 127.0.0.1 9090.

To start a http server, add api to task.json:

{
  // ...
  "api": "localhost:9009",
  "flight-data-url": "http://testing.lab.eleme.io/flight/drone/push/data",
  "waypoint-status-url": "http://testing.lab.eleme.io/flight/drone/push/waypoint",
  // ...
}

Test

$ cargo test

Deploy

Install ansible first.

$ cargo build --release --target=armv7-unknown-linux-gnueabihf
$ cd ./deploy
# the target after `--limit` should be listed in *hosts* file
$ ansible-playbook -i hosts --limit <target raspberry pi>  playbook.yml

# deploy to a new raspberry pi
$ ansible-playbook -i hosts --limit raw playbook.yml \
    --extra-vars="ansible_host=<ip address of pi> ansible_user=pi platform=<m100 or a3>" \
    --ask-pass

Modules

http

This module implememts a set of http api for interacting with the drone.

transport

Macros

assert_result
die

Structs

Runner
Task

Enums

Error
TaskType

Type Definitions

Result