Ejemplo n.º 1
0
        public HolonomicDriveValues TankDrive(float left, float right, bool inputsSquared = false)
        {
            left  = InputUtilities.TransformWithWarning(left, square: inputsSquared);
            right = InputUtilities.TransformWithWarning(right, square: inputsSquared);

            return(new HolonomicDriveValues {
                FrontLeft = left,
                FrontRight = right,
                RearLeft = left,
                RearRight = right
            });
        }
Ejemplo n.º 2
0
        public HolonomicDriveValues MecanumDrive(HolonomicDriveTrain driveTrain, float x, float y, bool inputsSquared = false)
        {
            x = InputUtilities.TransformWithWarning(x, square: inputsSquared);
            y = InputUtilities.TransformWithWarning(y, square: inputsSquared);

            var desiredMovement = new DenseVector(new [] { x, y });
//         var desiredMovement = new DenseVector(new [] { 1f, 0f });
            HolonomicDriveValues result = new HolonomicDriveValues();

            result.FrontLeft  = ComputeMecanumDriveMotorSpeed(desiredMovement, driveTrain.FrontLeft.GetComponent <VectorComponent>(DeviceComponentType.DriveWheelForceVector));
            result.FrontRight = ComputeMecanumDriveMotorSpeed(desiredMovement, driveTrain.FrontRight.GetComponent <VectorComponent>(DeviceComponentType.DriveWheelForceVector));
            result.RearLeft   = ComputeMecanumDriveMotorSpeed(desiredMovement, driveTrain.RearLeft.GetComponent <VectorComponent>(DeviceComponentType.DriveWheelForceVector));
            result.RearRight  = ComputeMecanumDriveMotorSpeed(desiredMovement, driveTrain.RearRight.GetComponent <VectorComponent>(DeviceComponentType.DriveWheelForceVector));
            return(result);
        }