syntax = "proto2";

import "dccl/option_extensions.proto";
import "goby/middleware/protobuf/frontseat_data.proto";
import "jaiabot/messages/option_extensions.proto";

package jaiabot.protobuf;

enum SetpointType
{
    SETPOINT_STOP = 0;      // no actuator movement - drift
    SETPOINT_IVP_HELM = 1;  // IvPHelm setpoints (helm_course)
    SETPOINT_REMOTE_CONTROL =
        2;              // fixed heading, speed, etc. for a given duration
    SETPOINT_DIVE = 3;  // Inverse drive control (dive_depth)
    SETPOINT_POWERED_ASCENT = 4;  // Power ascent to surface
    SETPOINT_SUSPEND_PID = 5; // stop sending PID based control messages until another SETPOINT is sent
}

message RemoteControl
{
    option (dccl.msg).unit_system = "si";

    required int32 duration = 1 [
        (dccl.field) = {
            min: 1,
            max: 600
            units { derived_dimensions: "time" }
        },
        (jaia.field).rest_api.presence = GUARANTEED
    ];

    optional double heading = 10 [
        default = 0,
        (dccl.field) = {
            min: 0
            max: 360
            precision: 0
            units { derived_dimensions: "plane_angle", system: "angle::degree" }
        },
        (jaia.field).rest_api.presence = GUARANTEED
    ];
    optional double speed = 11 [
        default = 0,
        (dccl.field) = {
            min: 0,
            max: 5,
            precision: 1,
            units { derived_dimensions: "length/time" }
        },
        (jaia.field).rest_api.presence = GUARANTEED
    ];
}

message DesiredSetpoints
{
    option (dccl.msg).unit_system = "si";

    required SetpointType type = 1;

    oneof setpoint_data
    {
        // pHelmIvP control, i.e. SETPOINT_IVP_HELM
        goby.middleware.frontseat.protobuf.DesiredCourse helm_course = 10;

        // remote control, i.e. SETPOINT_REMOTE_CONTROL
        RemoteControl remote_control = 11;

        // inverse dive control to target depth, i.e. SETPOINT_DIVE
        double dive_depth = 12
            [(dccl.field).units = { derived_dimensions: "length" }];

        // throttle control, i.e. SETPOINT_POWERED_ASCENT
        double throttle = 13;
    };

    optional bool is_helm_constant_course = 2 [default = false];
}
