// Copyright 2021:
//   JaiaRobotics LLC
// File authors:
//   Toby Schneider <toby@gobysoft.org>
//
//
// This file is part of the JaiaBot Project Binaries
// ("The Jaia Binaries").
//
// The Jaia Binaries are free software: you can redistribute them and/or modify
// them under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// The Jaia Binaries are distributed in the hope that they will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Jaia Binaries.  If not, see <http://www.gnu.org/licenses/>.

syntax = "proto2";

import "dccl/option_extensions.proto";

import "goby/middleware/protobuf/app_config.proto";
import "goby/zeromq/protobuf/interprocess_config.proto";
import "goby/moos/protobuf/moos_gateway_config.proto";
import "goby/middleware/protobuf/udp_config.proto";
import "jaiabot/messages/geographic_coordinate.proto";

package jaiabot.config;

message Simulator
{
    option (dccl.msg) = {
        unit_system: "si"
    };

    // required parameters for ApplicationBase3 class
    optional goby.middleware.protobuf.AppConfig app = 1;
    // required parameters for connecting to 'gobyd'
    optional goby.zeromq.protobuf.InterProcessPortalConfig interprocess = 2;

    optional goby.apps.moos.protobuf.GobyMOOSGatewayConfig.MOOSConfig moos = 10;

    optional goby.middleware.protobuf.UDPPointToPointConfig gps_udp_config = 20;

    optional goby.middleware.protobuf.UDPPointToPointConfig udp_gateway_config = 21;

    // allow simulator without GPS by setting this false
    optional bool enable_gps = 25 [default = true];

    optional jaiabot.protobuf.GeographicCoordinate start_location = 26;

    // Default is to use the hdop value so bot does not need to reacquire gps
    optional double gps_hdop_rand_max = 27 [default = 1.3];

    optional bool is_bot_sim = 28 [default = true];

    // Default is to use the pdop value so bot does not need to reacquire gps
    optional double gps_pdop_rand_max = 29 [default = 2.2];

    optional double heading_rand_max = 30 [default = 0];

    optional double vertical_dive_rate = 31
        [(dccl.field) = { units { derived_dimensions: "velocity" } }];
    optional double seafloor_depth = 32
        [(dccl.field) = { units { derived_dimensions: "length" } }];
    optional double seafloor_wavelength = 33 [
        (dccl.field) = { units { derived_dimensions: "length" } },
        default = 100
    ];
    optional double seafloor_amplitude = 34 [
        (dccl.field) = { units { derived_dimensions: "length" } },
        default = 5
    ];

    optional double gps_hdop_dropout = 35 [default = 20];
    optional double gps_pdop_dropout = 36 [default = 20];

    // minimum thrust value for forward motion (-100-100 scale)
    optional double minimum_thrust = 37 [default = 5];
    optional double pitch_at_rest = 38 [
        default = 85,
        (dccl.field).units = {
            derived_dimensions: "plane_angle"
            system: "angle::degree"
        }
    ];

    message ScalarSample
    {
        optional double depth = 1
            [(dccl.field) = { units: { derived_dimensions: "length" } }];

        optional double temperature = 2 [(dccl.field) = {
            units { derived_dimensions: "temperature" system: "celsius" }
        }];
        optional double salinity = 3;
    }

    repeated ScalarSample sample = 40;
    optional double temperature_stdev = 41 [(dccl.field) = {
        units {
            derived_dimensions: "temperature"
            system: "celsius"
            relative_temperature: true
        }
    }];
    optional double salinity_stdev = 42;

    optional string hub_gpsd_device = 43;

    optional ArduinoSimThread arduino_config = 60;
}

message ArduinoSimThread
{
    option (dccl.msg) = {
        unit_system: "si"
    };

    optional int32 voltage_period = 1 [default = 1];
    optional double voltage_step_decrease = 2 [default = 0.1];
    optional double voltage_start = 3 [default = 24.0];
    optional double reset_voltage_level = 4 [default = 15.0];
}