// Copyright (c) 2018 Anki, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License in the file LICENSE.txt or at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// External interface for robot <-> app and robot <-> sdk communication
// about the robot's navigational memory map.

syntax = "proto3";

package Anki.Vector.external_interface;

option go_package = "Anki.Vector.external_interface";

// Every tile in the nav map will be tagged with a content key referring to
// the different environmental elements that Vector can identify.
enum NavNodeContentType
{
  NAV_NODE_UNKNOWN                     = 0;
  NAV_NODE_CLEAR_OF_OBSTACLE           = 1;
  NAV_NODE_CLEAR_OF_CLIFF              = 2;
  NAV_NODE_OBSTACLE_CUBE               = 3;
  NAV_NODE_OBSTACLE_PROXIMITY          = 4;
  NAV_NODE_OBSTACLE_PROXIMITY_EXPLORED = 5;
  NAV_NODE_OBSTACLE_UNRECOGNIZED       = 6;
  NAV_NODE_CLIFF                       = 7;
  NAV_NODE_INTERESTING_EDGE            = 8;
  NAV_NODE_NON_INTERESTING_EDGE        = 9;
}

// An individual sample of vector's nav map.  This quad's size will vary and
// depends on the resolution the map requires to effectively identify
// boundaries in the environment.
message NavMapQuadInfo
{
  NavNodeContentType  content     = 1;
  uint32              depth       = 2;
  uint32              color_rgba  = 3;
}

// General information about the nav map as a whole.
message NavMapInfo
{
  int32   root_depth    = 1;
  float   root_size_mm  = 2;
  float   root_center_x = 3;
  float   root_center_y = 4;
  float   root_center_z = 5;
}

// Requests nav map data from the robot at a specified maximum update frequency.
// Responses in the nav map stream may be sent less frequently if the robot does
// not consider there to be relevant new information.
message NavMapFeedRequest
{
  float frequency = 1;
}

// A full nav map sent from the robot.  It contains an origin_id that
// which can be compared against the robot's current origin_id, general
// info about the map, and a collection of quads representing the map's
// content.
message NavMapFeedResponse
{
  uint32                  origin_id  = 1;
  NavMapInfo              map_info   = 2;
  repeated NavMapQuadInfo quad_infos = 3;
}
