Module dji_onboard::http [] [src]

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

All api should be invoked with the http header X-Drone-Name: <onboard-hostname>.

Ping

GET /ping

{
    "message": "pong",
    "status": true
}

Prepare

POST /api/prepare

After prepared the next commands emitted to the drone will take effect.

{
    "message": "msg",
    // `true` means success, `false` means failed
    "status": true
}

Payload

{
    "app_id": <app_id>,
    // whether to enable rc, default is `true`
    "rc_enable": true
}

Landing

GET /api/landing

{
    "message": "msg",
    // `true` means success, `false` means failed
    "status": true
}

Execute arbitrary commands

POST /api/cmd/:command

{
    "message": "msg",
    // `true` means success, `false` means failed
    "status": true
}

Pause waypoint

GET /api/waypoint/pause

{
    "message": "msg",
    // `true` means success, `false` means failed
    "status": true
}

Resume waypoint

GET /api/waypoint/resume

{
    "message": "msg",
    // `true` means success, `false` means failed
    "status": true
}

Stop waypoint

GET /api/waypoint/stop

{
    "message": "msg",
    // `true` means success, `false` means failed
    "status": true
}

Return

GET /api/waypoint/return

Must start waypoint before return or the status in response will be false. When return, the json file <previous starting waypoint id>_return will be used.

{
    "message": "msg",
    // `true` means success, `false` means failed
    "status": true
}

Load flight route

POST /api/waypoint/:id

After a successful loading the route will be store as a json file in the onboard device. In order to implement return two routes should be loaded, one's id is <id> the other is <id>_return.

{
    // when success
    "id": id,
    // when failed
    "message": "error",
    // `true` means success, `false` means failed
    status: true
}

Payload

{
    "max_velocity": 15.0,
    "idle_velocity": 5.0,
    "turn_mode": "coordinated",
    "points": [
        [0.5456587948657111, 2.1187751180221137, 40, 5],
        [0.5456583061735205, 2.1187731458000587, 40, 5],
        [0.5456570320831665, 2.1187749434891883, 40, 5],
        [0.5456583410801056, 2.1187771775106308, 40, 5],
        [0.5456587948657111, 2.1187751180221137, 40, 5]
    ]
}

Start waypoint task

GET /api/waypoint/:id

This api will find a file named <id> in the onboard device and use that file as the waypoint task.

{
    "message": "msg",
    // `true` means success, `false` means failed
    "status": true
}

Structs

Post

Used to post data to external server using http protocol.

XDroneName

Functions

build_router
serve

Start the http server.