syntax = "proto2";

import "goby/middleware/protobuf/app_config.proto";
import "goby/zeromq/protobuf/interprocess_config.proto";
import "goby/middleware/protobuf/transporter_config.proto";
import "dccl/option_extensions.proto";
import "jaiabot/messages/bounds.proto";

package jaiabot.config;

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

    optional goby.middleware.protobuf.AppConfig app = 1;
    optional goby.zeromq.protobuf.InterProcessPortalConfig interprocess = 2;

    required int32 bot_id = 10;

    optional int32 default_timeout = 20
        [default = 5, (dccl.field).units.base_dimensions = "T"];

    message PIDGains
    {
        required double Kp = 1;
        required double Ki = 2;
        required double Kd = 3;
    };

    optional PIDGains throttle_speed_pid_gains = 30;
    optional PIDGains throttle_depth_pid_gains = 40;
    optional PIDGains heading_pid_gains = 50;
    optional PIDGains heading_constant_pid_gains = 51;
    optional PIDGains roll_pid_gains = 60;
    optional PIDGains pitch_pid_gains = 70;

    // Speed => rpm table
    optional bool use_throttle_table_for_speed = 31;

    message ThrottleSpeedEntry
    {
        required double speed = 1
            [(dccl.field).units = {derived_dimensions: "velocity"}];
        required int32 throttle = 2;
    }
    repeated ThrottleSpeedEntry throttle_table = 32;

    // The threshold heading_error below which the PID algorithm will target full desired speed
    optional double full_speed_window = 33
        [default = 1, (dccl.field).units = {
                derived_dimensions: "plane_angle"
                system: "angle::degree"
                }];

    optional jaiabot.protobuf.Bounds bounds = 80;
}
