Skip to content

Captain's POC 1

Tal Ater edited this page Aug 26, 2017 · 13 revisions

General Requirements

  • Able to answer authenticated requests for data with various levels (e.g. authenticated requests from Mission Control will have access to vehicle details and current details, but only requests from Vehicle Web UI can include the list of wallets or add wallets.)

  • Can be launched in different environments, each might communicate with a different Mission Control endpoint. In a simulation environment, all communication with vehicle and some of the properties are simulated as detailed below.

  • Able to calculate estimated times to fly between two sets of coordinates (taking flight, take-off, and landing times into consideration)

Lifecycle

When captain launches, starts boot sequence:

  • Simulation environment: Get or randomize current state. Get vehicle details from random vehicle generator. Initialize mock vehicle object with state and details.
  • Get vehicle state and details and save them in captain's memory.

In simulation environment, boot sequence is immediately followed by registering the vehicle with Mission Control.

Properties

The Captain keeps track of the following parameters:

  1. Current state:
    • Coordinates
    • Heading
    • Height
    • Battery level
    • Waypoints (an ordered list of coordinates indicating movement within or without mission)
    • Mission status: available for missions, unavailable for missions, heading to pickup, landing at pickup, awaiting loading at pickup, taking off, flying to drop-off, landing at drop-off, awaiting unloading at drop-off, taking off from drop-off
  2. Vehicle details
    • Model
    • Range
    • ID
    • Nickname (optional)
    • Photo (optional)
  3. Current mission details (mission ID, DAV UID of client, origin coordinates, target coordinates)
  4. History of missions.
  5. Wallets

Interacts with Web UI for Vehicle Owners

  1. Responds to requests from web UI for information:
    • Current state
    • Current mission details
    • Wallet details
  2. Responds to request from web UI to register/deregister itself with Mission Control (register == mark itself available for missions)

Interacts with Mission Control

  1. Able to register/deregister itself with Mission Control
  2. Responds to requests from Mission Control for information (only if registered):
    • Current mission details (origin coordinates, target coordinates)
    • Current state
    • Vehicle details
  3. Reports current state to Mission control every 60 seconds, or every 1 second if in the middle of a mission.
  4. Receives mission requests from Mission Control. A request includes: mission ID, pickup coords, delivery coordinates, and DAV UID of client.
  5. Decides whether to respond to mission requests with a bid. A bid response contains: mission ID, estimated time to pickup, estimated delivery time, and price.
  6. Receives mission confirmation from Mission Control (if won bidding). Includes: mission ID, pickup coordinates, delivery coordinates, and DAV UID of client. In response will start executing a mission.

Executes Missions

  1. From now until the end of the mission:
    • Ask vehicle to record a photo every 10 seconds. Sends that photo back to Mission Control.
    • Report current details to mission control every 1 second.
  2. Instructs vehicle to fly to pick up location and land.
  3. Once landed report status to mission control.
  4. Receive confirmation that loading is complete from mission control.
  5. Instructs vehicle to take off, fly to the drop-off location, and land.
  6. Once landed report status to mission control.
  7. Receive confirmation that unloading is complete from mission control.

During any take-off and landing, take a video. While on the ground take photos at increased frequency.

Interacts with Vehicle

TBD. Meanwhile, Captain will interact with Vehcile Mock.

Simulation Environment

In a normal environment, when the Captain launches it receives current state from vehicle through API.

When launched in a simulation environment we need to create a vehicle mock object that will return the current state just like a vehicle's API.

To help create this vehicle mock object, the Captain accepts a number of parameters (maybe as environment variables?):

  • Starting coordinates (required)

  • Vehicle UID (required)

  • Vehicle model name (required)

  • Starting height (optional)

    If height is not given there's an 80% chance it will be at ground level (see: Google Maps Elevation API for figuring out how high that is). If it isn't, it will be at a random height between 50-150 meters above ground level, and some random coordinates between 100m and 500m away are chosen as its target coordinates (this will ensure that when launching the simulation, not all vehicles are just sitting idle on the ground).

  • Starting battery status (optional. Defaults to random value between 100%-85%)

  • Speed in meters per minute (optional. Defaults to integer between 100 and 1000)

  • Battery usage in percent per minute of flight (optional. Defaults to float between 0.4 and 4)

Vehicle Mock

The Captain in a simulation environment does not communicate with a real vehicle's API but with a mock object.

Mock vehicle keeps track of things like battery usage (changes it over time according to its battery usage setting), coordinates, movement over time according to the mission and its speed.

Vehicle API

To vehicle:
  • Command: Move to coordinates
  • Request current state
  • Request vehicle details (see random vehicle generator for fields)
  • Request photo
  • Can you takeoff?
  • Set current state and details (mock only)
From vehicle:
  • Report move complete
  • Send photo
  • Report ready for takeoff

Notes

  • Any numbers given above should be configurable (e.g. the chance for a vehicle to be in the air when launched in simulation mode)