コード例 #1
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;
        }
コード例 #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);
        }
コード例 #3
0
 public void SetValues(HolonomicDriveValues values)
 {
     SetValues(values.FrontLeft, values.FrontRight, values.RearLeft, values.RearRight);
 }
コード例 #4
0
 public void SetValues(HolonomicDriveValues values)
 {
     SetValues(values.FrontLeft, values.FrontRight, values.RearLeft, values.RearRight);
 }