using System;
using System.Collections.Generic;
using System.Text;
using CartActivator;
using MDCSToolBox.Medulla.Chassis.MultiWheel;

namespace MedullaAdapter
{
    public class Remote:MultiWheelRemote<DiverCartDefinition>
    {
        [AsControlItem(name = "夹抱速度", LayoutRow = 0, LayoutCol = 4)]
        public Throttle ArmSpeed;

        [AsControlItem(name = "夹抱打开", LayoutRow = 1, LayoutCol = 0)]
        public Button Open;

        [AsControlItem(name = "夹抱关闭", LayoutRow = 1, LayoutCol = 2)]
        public Button Close;

        public override void MultiVehicleModeChassisLogic()
        {
            // cart.MultiVehicleRemoteManualEnabled = true;
            // cart.MultiVehicleManualEnabled = true;
            // cart.MultiVehicleManualVx = SpeedPad.y * SpeedThreshold.val;
            // cart.MultiVehicleManualVth = -(float)Math.Pow(Math.Abs(SpeedPad.x), cart.ManualThetaPow) * Math.Sign(SpeedPad.x);
        }

        public override void CustomOperation()
        {
            if (Open.pressed)
            {
                cart.SpeedLeftArm = -ArmSpeed.val * cart.ManualArmSpeedFac;
                cart.SpeedRightArm = -ArmSpeed.val * cart.ManualArmSpeedFac;
            }
            else if (Close.pressed)
            {
                cart.SpeedLeftArm = ArmSpeed.val * cart.ManualArmSpeedFac;
                cart.SpeedRightArm = ArmSpeed.val * cart.ManualArmSpeedFac;
            }
            else
            {
                cart.SpeedLeftArm = 0;
                cart.SpeedRightArm = 0;
            }
        }
    }
}
