001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005package edu.wpi.first.math.kinematics; 006 007/** Represents the motor voltages for a mecanum drive drivetrain. */ 008public class MecanumDriveMotorVoltages { 009 /** Voltage of the front left motor. */ 010 public double frontLeftVoltage; 011 012 /** Voltage of the front right motor. */ 013 public double frontRightVoltage; 014 015 /** Voltage of the rear left motor. */ 016 public double rearLeftVoltage; 017 018 /** Voltage of the rear right motor. */ 019 public double rearRightVoltage; 020 021 /** Constructs a MecanumDriveMotorVoltages with zeros for all member fields. */ 022 public MecanumDriveMotorVoltages() {} 023 024 /** 025 * Constructs a MecanumDriveMotorVoltages. 026 * 027 * @param frontLeftVoltage Voltage of the front left motor. 028 * @param frontRightVoltage Voltage of the front right motor. 029 * @param rearLeftVoltage Voltage of the rear left motor. 030 * @param rearRightVoltage Voltage of the rear right motor. 031 */ 032 public MecanumDriveMotorVoltages( 033 double frontLeftVoltage, 034 double frontRightVoltage, 035 double rearLeftVoltage, 036 double rearRightVoltage) { 037 this.frontLeftVoltage = frontLeftVoltage; 038 this.frontRightVoltage = frontRightVoltage; 039 this.rearLeftVoltage = rearLeftVoltage; 040 this.rearRightVoltage = rearRightVoltage; 041 } 042 043 @Override 044 public String toString() { 045 return String.format( 046 "MecanumDriveMotorVoltages(Front Left: %.2f V, Front Right: %.2f V, " 047 + "Rear Left: %.2f V, Rear Right: %.2f V)", 048 frontLeftVoltage, frontRightVoltage, rearLeftVoltage, rearRightVoltage); 049 } 050}