// Copyright (c) 2022 Boston Dynamics, Inc.  All rights reserved.
//
// Downloading, reproducing, distributing or otherwise using the SDK Software
// is subject to the terms and conditions of the Boston Dynamics Software
// Development Kit License (20191101-BDSDK-SL).

syntax = "proto3";

package bosdyn.api.spot_cam;

option java_outer_classname = "PtzProto";

import "google/protobuf/wrappers.proto";
import "bosdyn/api/header.proto";

//PtzDescription provides information about a given PTZ. The name is usually all that's required to
//describe a PTZ, but ListPtzResponse will include more information.
message PtzDescription {
    // Identifier of a particular controllable PTZ mechanism (real or virtual).
    string name = 1;

    // Limits for a single axis.
    message Limits {
        google.protobuf.FloatValue min = 1; // Units depend on the axis being controlled.
        google.protobuf.FloatValue max = 2; // Units depend on the axis being controlled.
    }

    // If a limit is not set, all positions are valid
    Limits pan_limit = 2; // Limits in degrees.
    Limits tilt_limit = 3; // Limits in degrees.
    Limits zoom_limit = 4; // Limits in zoom level.
}

// Doubles as a description of current state, or a command for a new position.
message PtzPosition {
    // The "mech" ptz can pan [0, 360] degrees,
    // tilt approximately [-30, 100] degrees where 0 is the horizon, IR and PTZ models differ
    // and zoom between 1x and 30x.
    PtzDescription ptz = 2;
    google.protobuf.FloatValue pan = 3; // degrees
    google.protobuf.FloatValue tilt = 4; // degrees
    google.protobuf.FloatValue zoom = 5; // zoom level
}

// Doubles as a description of current state, or a command for a new velocity.
message PtzVelocity {
    // The "mech" ptz cannot be used with Velocity.
    PtzDescription ptz = 2;
    google.protobuf.FloatValue pan = 3; // degrees/second
    google.protobuf.FloatValue tilt = 4; // degrees/second
    google.protobuf.FloatValue zoom = 5; // zoom level/second
}

// Request the current position of a ptz.
message GetPtzPositionRequest {
    // Common request header.
    bosdyn.api.RequestHeader header = 1;
    // Only the name is used.
    PtzDescription ptz = 2;
}

// Provides the current measured position.
message GetPtzPositionResponse {
    // Common response header.
    bosdyn.api.ResponseHeader header = 1;
    // Current position of the mechanism.
    PtzPosition position = 2;
}

// Request the velocity of a ptz
message GetPtzVelocityRequest {
    // Common request header.
    bosdyn.api.RequestHeader header = 1;
    // Only the name is used.
    PtzDescription ptz = 2;
}

// Provides the current measured velocity.
message GetPtzVelocityResponse {
    // Common response header.
    bosdyn.api.ResponseHeader header = 1;
    // Current velocity of the mechanism.
    PtzVelocity velocity = 2;
}

// Request all available ptzs on the SpotCam.
message ListPtzRequest {
    // Common request header.
    bosdyn.api.RequestHeader header = 1;
}

// Provide all available ptz on the SpotCam.
message ListPtzResponse {
    // Common response header.
    bosdyn.api.ResponseHeader header = 1;
    // List of ptzs, real and virtual.
    repeated PtzDescription ptzs = 2;
}

// Command the ptz to move to a position.
message SetPtzPositionRequest {
    // Common request header.
    bosdyn.api.RequestHeader header = 1;
    // Desired position to achieve.
    PtzPosition position = 2;
}

// Result of a SetPtzPositionRequest.
message SetPtzPositionResponse {
    // Common response header.
    bosdyn.api.ResponseHeader header = 1;
    // Applied desired position.
    PtzPosition position = 2;
}

// Command a velocity for a ptz.
message SetPtzVelocityRequest {
    // Common request header.
    bosdyn.api.RequestHeader header = 1;
    // Desired velocity to achieve.
    PtzVelocity velocity = 2;
}

// Result of a SetPtzVelocityRequest.
message SetPtzVelocityResponse {
    // Common response header.
    bosdyn.api.ResponseHeader header = 1;
    // Applied desired position.
    PtzVelocity velocity = 2;
}

// Command to reset PTZ autofocus
message InitializeLensRequest {
    // Common response header.
    bosdyn.api.RequestHeader header = 1;
}

// Result of a InitializeLensRequest.
message InitializeLensResponse {
    // Common response header.
    bosdyn.api.ResponseHeader header = 1;
}

