Package edu.wpi.first.units
Class Units
java.lang.Object
edu.wpi.first.units.Units
Contains a set of predefined units.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CurrentUnitThe base unit of electrical current.static final CurrentUnitThe base unit of electrical current.static final TemperatureUnitThe standard SI unit of temperature, where a value of 0 roughly corresponds to the freezing point of water and a value of 100 corresponds to the boiling point.static final DistanceUnit1/100 of aMeter.static final DistanceUnit1/100 of aMeter.static final AngleUnit1/360 of a turn around a circle, or 1/57.3Radians.static final AngleUnit1/360 of a turn around a circle, or 1/57.3Radians.static final AngularVelocityUnitstatic final AngularAccelerationUnitstatic final TemperatureUnitThe base imperial (American) unit of temperature, where a value of 32 roughly corresponds to the freezing point of water and a value of 212 corresponds to the boiling point.static final DistanceUnitstatic final LinearVelocityUnitstatic final LinearAccelerationUnitstatic final DistanceUnitstatic final MassUnit1/1000 of aKilogram.static final MassUnit1/1000 of aKilogram.static final LinearAccelerationUnitA unit of acceleration equivalent to the pull of gravity on an object at sea level on Earth.static final FrequencyUnitThe standard SI unit of frequency, equivalent to a periodic signal repeating once everySecond.static final PowerUnitA unit equal to 745.7Watts.static final DistanceUnitstatic final DistanceUnitstatic final LinearVelocityUnitstatic final LinearAccelerationUnitstatic final EnergyUnitThe base unit of energy.static final EnergyUnitThe base unit of energy.static final TemperatureUnitThe base unit of temperature, where a value of 0 corresponds with absolutely zero energy in the measured system.static final MassUnitThe standard SI unit of mass.static final LinearMomentumUnitThe standard SI unit for linear momentum, equivalent to a oneKilogrammass moving at oneMetersPerSecond.static final AngularMomentumUnitThe standard SI unit for angular momentum.static final MassUnitThe standard SI unit of mass.static final MomentOfInertiaUnitThe standard SI unit for moment of inertia.static final EnergyUnitA unit equal to 1,000Joules.static final EnergyUnitA unit equal to 1,000Joules.static final ResistanceUnitA unit equal to 1,000Ohms.static final ResistanceUnitA unit equal to 1,000Ohms.static final DistanceUnitThe base unit of distance.static final DistanceUnitThe base unit of distance.static final LinearVelocityUnitstatic final LinearAccelerationUnitstatic final TimeUnitAlias forMicrosecondsto make combined unit definitions read more smoothly.static final TimeUnit1/1,000,000 of aSecond.static final CurrentUnitA unit equal to 1/1000 of anAmp.static final CurrentUnitA unit equal to 1/1000 of anAmp.static final FrequencyUnit1/1000th of aHertz.static final EnergyUnitA unit equal to 1/1000 of aJoule.static final EnergyUnitA unit equal to 1/1000 of aJoule.static final DistanceUnit1/1000 of aMeter.static final DistanceUnit1/1000 of aMeter.static final ResistanceUnitA unit equal to 1/1000 of aOhm.static final ResistanceUnitA unit equal to 1/1000 of aOhm.static final TimeUnitAlias forMillisecondsto make combined unit definitions read more smoothly.static final TimeUnit1/1000 of aSecond.static final VoltageUnit1/1000 of aVolt.static final VoltageUnit1/1000 of aVolt.static final PowerUnitA unit equal to 1/1000 of aWatt.static final PowerUnitA unit equal to 1/1000 of aWatt.static final TimeUnitAlias forMinutesto make combined unit definitions read more smoothly.static final TimeUnit60Seconds.static final ForceUnitThe standard unit of force, equivalent to the standard force of gravity applied to a oneKilogrammass.static final TorqueUnitThe standard SI unit for torque.static final TorqueUnitThe standard SI unit for torque.static final ForceUnitThe standard unit of force, equivalent to accelerating a mass of oneKilogramat a rate of onemeter per second per second.static final ResistanceUnitThe base unit of resistance.static final ResistanceUnitThe base unit of resistance.static final MassUnit1/16 of aPound.static final ForceUnit1/16th ofPoundsForce, equivalent to the standard force of gravity applied to a oneOuncemass.static final TorqueUnitThe equivalent of oneounce of forceapplied to an object oneInchaway from its center of rotation.static final TorqueUnitThe equivalent of oneounce of forceapplied to an object oneInchaway from its center of rotation.static final MassUnit1/16 of aPound.static final ForceUnit1/16th ofPoundsForce, equivalent to the standard force of gravity applied to a oneOuncemass.static final DimensionlessUnitA dimensionless unit equal to to 1/100th of aValue.static final MassUnitA unit of mass equivalent to approximately 453Grams.static final TorqueUnitThe equivalent of onepound of forceapplied to an object oneFootaway from its center of rotation.static final TorqueUnitThe equivalent of onepound of forceapplied to an object oneFootaway from its center of rotation.static final ForceUnitThe standard Imperial unit of force, equivalent to the standard force of gravity applied to a onePoundmass.static final TorqueUnitThe equivalent of onepound of forceapplied to an object oneInchaway from its center of rotation.static final TorqueUnitThe equivalent of onepound of forceapplied to an object oneInchaway from its center of rotation.static final MassUnitA unit of mass equivalent to approximately 453Grams.static final ForceUnitThe standard Imperial unit of force, equivalent to the standard force of gravity applied to a onePoundmass.static final AngleUnitThe standard SI unit of angle, represented by the distance that the radius of a unit circle can wrap around its circumference.static final AngleUnitThe standard SI unit of angle, represented by the distance that the radius of a unit circle can wrap around its circumference.static final AngularVelocityUnitstatic final AngularAccelerationUnitstatic final AngleUnitA single turn of an object around an external axis.static final AngleUnitA single turn of an object around an external axis.static final AngularVelocityUnitA unit of angular velocity equivalent to spinning at a rate of oneRevolutionperSecond.static final AngleUnitA single turn of an object around an internal axis.static final AngleUnitA single turn of an object around an internal axis.static final AngularVelocityUnitstatic final AngularAccelerationUnitstatic final AngularVelocityUnitstatic final TimeUnitAlias forSecondsto make combined unit definitions read more smoothly.static final TimeUnitThe base unit of time.static final DimensionlessUnitA dimensionless unit that performs no scaling whatsoever.static final VoltageUnitThe base unit of electric potential.static final VoltageUnitThe base unit of electric potential.static final PerUnit<VoltageUnit,LinearVelocityUnit> A standard unit for measuring linear mechanisms' feedforward voltages based on a model of the system and a desired commanded linear velocity.static final PerUnit<VoltageUnit,LinearAccelerationUnit> A standard unit for measuring linear mechanisms' feedforward voltages based on a model of the system and a desired commanded linear acceleration.static final PerUnit<VoltageUnit,AngularVelocityUnit> A standard unit for measuring angular mechanisms' feedforward voltages based on a model of the system and a desired commanded angular velocity.static final PerUnit<VoltageUnit,AngularAccelerationUnit> A standard unit for measuring angular mechanisms' feedforward voltages based on a model of the system and a desired commanded angular acceleration.static final PowerUnitThe base unit of power.static final PowerUnitThe base unit of power. -
Method Summary
Modifier and TypeMethodDescriptionstatic <U extends Unit>
UnitBuilder<U>derive(U unit) Creates a new unit builder object based on a given input unit.static <U extends Unit>
UKilo(U baseUnit) Creates a unit equal to a thousand of the base unit, eg Kilograms = Kilo(Units.Grams).static <U extends Unit>
UCreates a unit equal to a thousand of the base unit, eg Kilograms = Kilo(Units.Grams).static <U extends Unit>
UMicro(U baseUnit) Creates a unit equal to a millionth of the base unit, eg Microseconds = Micro(Units.Seconds).static <U extends Unit>
UCreates a unit equal to a millionth of the base unit, egMicroseconds = Micro(Units.Seconds, "Microseconds", 'us").static <U extends Unit>
UMilli(U baseUnit) Creates a unit equal to a thousandth of the base unit, eg Milliseconds = Milli(Units.Seconds).static <U extends Unit>
UCreates a unit equal to a thousandth of the base unit, eg Milliseconds = Milli(Units.Seconds).
-
Field Details
-
Value
A dimensionless unit that performs no scaling whatsoever. -
Percent
A dimensionless unit equal to to 1/100th of aValue. A measurement ofPercent.of(42)would be equivalent toValue.of(0.42). -
Meters
The base unit of distance. -
Meter
The base unit of distance. -
Millimeters
1/1000 of aMeter. -
Millimeter
1/1000 of aMeter. -
Centimeters
1/100 of aMeter. -
Centimeter
1/100 of aMeter. -
Inches
-
Inch
-
Feet
-
Foot
-
Seconds
The base unit of time. -
Second
Alias forSecondsto make combined unit definitions read more smoothly. -
Milliseconds
1/1000 of aSecond. -
Millisecond
Alias forMillisecondsto make combined unit definitions read more smoothly. -
Microseconds
1/1,000,000 of aSecond. -
Microsecond
Alias forMicrosecondsto make combined unit definitions read more smoothly. -
Minutes
60Seconds. -
Minute
Alias forMinutesto make combined unit definitions read more smoothly. -
Radians
The standard SI unit of angle, represented by the distance that the radius of a unit circle can wrap around its circumference. -
Radian
The standard SI unit of angle, represented by the distance that the radius of a unit circle can wrap around its circumference. -
Revolutions
A single turn of an object around an external axis. Numerically equivalent toRotations, but may be semantically more expressive in certain scenarios. -
Revolution
A single turn of an object around an external axis. Numerically equivalent to aRotation, but may be semantically more expressive in certain scenarios. -
Rotations
A single turn of an object around an internal axis. Numerically equivalent toRevolutions, but may be semantically more expressive in certain scenarios. -
Rotation
A single turn of an object around an internal axis. Numerically equivalent to aRevolution, but may be semantically more expressive in certain scenarios. -
Degrees
1/360 of a turn around a circle, or 1/57.3Radians. -
Degree
1/360 of a turn around a circle, or 1/57.3Radians. -
MetersPerSecond
-
FeetPerSecond
-
InchesPerSecond
-
RevolutionsPerSecond
A unit of angular velocity equivalent to spinning at a rate of oneRevolutionperSecond. -
RotationsPerSecond
-
RPM
-
RadiansPerSecond
-
DegreesPerSecond
-
Hertz
The standard SI unit of frequency, equivalent to a periodic signal repeating once everySecond. -
Millihertz
1/1000th of aHertz. -
MetersPerSecondPerSecond
-
FeetPerSecondPerSecond
-
InchesPerSecondPerSecond
-
RotationsPerSecondPerSecond
-
RadiansPerSecondPerSecond
-
DegreesPerSecondPerSecond
-
Gs
A unit of acceleration equivalent to the pull of gravity on an object at sea level on Earth. -
Kilograms
The standard SI unit of mass. -
Kilogram
The standard SI unit of mass. -
Grams
1/1000 of aKilogram. -
Gram
1/1000 of aKilogram. -
Pounds
A unit of mass equivalent to approximately 453Grams. This is not equivalent to pounds-force, which is the amount of force required to accelerate an object with one pound of mass at a rate of oneG.- See Also:
-
Pound
A unit of mass equivalent to approximately 453Grams. This is not equivalent to pounds-force, which is the amount of force required to accelerate an object with one pound of mass at a rate of oneG.- See Also:
-
Ounces
1/16 of aPound. -
Ounce
1/16 of aPound. -
Newtons
The standard unit of force, equivalent to accelerating a mass of oneKilogramat a rate of onemeter per second per second. -
Newton
The standard unit of force, equivalent to the standard force of gravity applied to a oneKilogrammass. -
PoundsForce
The standard Imperial unit of force, equivalent to the standard force of gravity applied to a onePoundmass. -
PoundForce
The standard Imperial unit of force, equivalent to the standard force of gravity applied to a onePoundmass. -
OuncesForce
1/16th ofPoundsForce, equivalent to the standard force of gravity applied to a oneOuncemass. -
OunceForce
1/16th ofPoundsForce, equivalent to the standard force of gravity applied to a oneOuncemass. -
NewtonMeters
The standard SI unit for torque. -
NewtonMeter
The standard SI unit for torque. -
PoundFeet
The equivalent of onepound of forceapplied to an object oneFootaway from its center of rotation. -
PoundFoot
The equivalent of onepound of forceapplied to an object oneFootaway from its center of rotation. -
PoundInches
The equivalent of onepound of forceapplied to an object oneInchaway from its center of rotation. -
PoundInch
The equivalent of onepound of forceapplied to an object oneInchaway from its center of rotation. -
OunceInches
The equivalent of oneounce of forceapplied to an object oneInchaway from its center of rotation. -
OunceInch
The equivalent of oneounce of forceapplied to an object oneInchaway from its center of rotation. -
KilogramMetersPerSecond
The standard SI unit for linear momentum, equivalent to a oneKilogrammass moving at oneMetersPerSecond. -
KilogramMetersSquaredPerSecond
The standard SI unit for angular momentum. -
KilogramSquareMeters
The standard SI unit for moment of inertia. -
Volts
The base unit of electric potential. -
Volt
The base unit of electric potential. -
Millivolts
1/1000 of aVolt. Useful when dealing with low-voltage applications like LED drivers or low-power circuits. -
Millivolt
1/1000 of aVolt. Useful when dealing with low-voltage applications like LED drivers or low-power circuits. -
Amps
The base unit of electrical current. -
Amp
The base unit of electrical current. -
Milliamps
A unit equal to 1/1000 of anAmp. Useful when dealing with low-current applications like LED drivers or low-power circuits. -
Milliamp
A unit equal to 1/1000 of anAmp. Useful when dealing with low-current applications like LED drivers or low-power circuits. -
Ohms
-
Ohm
-
KiloOhms
A unit equal to 1,000Ohms. -
KiloOhm
A unit equal to 1,000Ohms. -
MilliOhms
A unit equal to 1/1000 of aOhm. -
MilliOhm
A unit equal to 1/1000 of aOhm. -
Joules
The base unit of energy. -
Joule
The base unit of energy. -
Millijoules
A unit equal to 1/1000 of aJoule. Useful when dealing with lower-power applications. -
Millijoule
A unit equal to 1/1000 of aJoule. Useful when dealing with lower-power applications. -
Kilojoules
A unit equal to 1,000Joules. Useful when dealing with higher-level robot energy usage. -
Kilojoule
A unit equal to 1,000Joules. Useful when dealing with higher-level robot energy usage. -
Watts
-
Watt
-
Milliwatts
A unit equal to 1/1000 of aWatt. Useful when dealing with lower-power applications. -
Milliwatt
A unit equal to 1/1000 of aWatt. Useful when dealing with lower-power applications. -
Horsepower
A unit equal to 745.7Watts. May be useful when dealing with high-power gearboxes and motors. -
Kelvin
The base unit of temperature, where a value of 0 corresponds with absolutely zero energy in the measured system. Not particularly useful for robots unless you're cooling motors with liquid helium. -
Celsius
The standard SI unit of temperature, where a value of 0 roughly corresponds to the freezing point of water and a value of 100 corresponds to the boiling point. Electronics tend to exhibit degraded performance or damage above 90 degrees Celsius. -
Fahrenheit
The base imperial (American) unit of temperature, where a value of 32 roughly corresponds to the freezing point of water and a value of 212 corresponds to the boiling point. -
VoltsPerMeterPerSecond
A standard unit for measuring linear mechanisms' feedforward voltages based on a model of the system and a desired commanded linear velocity. -
VoltsPerMeterPerSecondSquared
A standard unit for measuring linear mechanisms' feedforward voltages based on a model of the system and a desired commanded linear acceleration. -
VoltsPerRadianPerSecond
A standard unit for measuring angular mechanisms' feedforward voltages based on a model of the system and a desired commanded angular velocity. -
VoltsPerRadianPerSecondSquared
A standard unit for measuring angular mechanisms' feedforward voltages based on a model of the system and a desired commanded angular acceleration.
-
-
Method Details
-
Milli
Creates a unit equal to a thousandth of the base unit, eg Milliseconds = Milli(Units.Seconds).- Type Parameters:
U- the type of the unit- Parameters:
baseUnit- the unit being derived from. This does not have to be the base unit of measurename- the name of the new derived unitsymbol- the symbol of the new derived unit- Returns:
- the milli-unit
-
Milli
Creates a unit equal to a thousandth of the base unit, eg Milliseconds = Milli(Units.Seconds).- Type Parameters:
U- the type of the unit- Parameters:
baseUnit- the unit being derived from. This does not have to be the base unit of measure- Returns:
- the milli-unit
-
Micro
Creates a unit equal to a millionth of the base unit, egMicroseconds = Micro(Units.Seconds, "Microseconds", 'us").- Type Parameters:
U- the type of the unit- Parameters:
baseUnit- the unit being derived from. This does not have to be the base unit of measurename- the name of the new derived unitsymbol- the symbol of the new derived unit- Returns:
- the micro-unit
-
Micro
Creates a unit equal to a millionth of the base unit, eg Microseconds = Micro(Units.Seconds).- Type Parameters:
U- the type of the unit- Parameters:
baseUnit- the unit being derived from. This does not have to be the base unit of measure- Returns:
- the micro-unit
-
Kilo
Creates a unit equal to a thousand of the base unit, eg Kilograms = Kilo(Units.Grams).- Type Parameters:
U- the type of the unit- Parameters:
baseUnit- the unit being derived from. This does not have to be the base unit of measurename- the name of the new derived unitsymbol- the symbol of the new derived unit- Returns:
- the kilo-unit
-
Kilo
Creates a unit equal to a thousand of the base unit, eg Kilograms = Kilo(Units.Grams).- Type Parameters:
U- the type of the unit- Parameters:
baseUnit- the unit being derived from. This does not have to be the base unit of measure- Returns:
- the kilo-unit
-
derive
Creates a new unit builder object based on a given input unit. The builder can be used to fluently describe a new unit in terms of its relation to the base unit.- Type Parameters:
U- the dimension of the unit to derive- Parameters:
unit- the base unit from which to derive a new unit- Returns:
- a builder object
-