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; }
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); }
public void SetValues(HolonomicDriveValues values) { SetValues(values.FrontLeft, values.FrontRight, values.RearLeft, values.RearRight); }