Class Velocity<D extends Unit<D>>

java.lang.Object
edu.wpi.first.units.Unit<Velocity<D>>
edu.wpi.first.units.Velocity<D>
Type Parameters:
D - the distance unit, such as Angle or Distance

public class Velocity<D extends Unit<D>>
extends Unit<Velocity<D>>
Unit of velocity dimension that is a combination of a distance unit (numerator) and a time unit (denominator).

This is the base type for units of velocity dimension. It is also used in combination with a distance dimension to specify the dimension for Measure. For example: Measure<Velocity<Distance>>.

Actual units (such as Units.MetersPerSecond and Units.RPM) can be found in the Units class.

  • Method Details

    • combine

      public static <D extends Unit<D>> Velocity<D> combine​(Unit<D> numerator, Time period, String name, String symbol)
      Creates a new velocity unit derived from an arbitrary numerator and time period units.

      Results of this method are cached so future invocations with the same arguments will return the pre-existing units instead of generating new identical ones.

         Velocity.combine(Kilograms, Second) // mass flow
         Velocity.combine(Feet, Millisecond) // linear speed
         Velocity.combine(Radians, Second) // angular speed
      
         Velocity.combine(Feet.per(Second), Second) // linear acceleration in ft/s/s
         Velocity.combine(Radians.per(Second), Second) // angular acceleration
       

      It's recommended to use the convenience function Unit.per(Time) instead of calling this factory directly.

      Type Parameters:
      D - the type of the numerator unit
      Parameters:
      numerator - the numerator unit
      period - the period for unit time
      name - the name of the new velocity unit
      symbol - the symbol of the new velocity unit
      Returns:
      the new unit
    • combine

      public static <D extends Unit<D>> Velocity<D> combine​(Unit<D> numerator, Time period)
      Creates a new velocity unit derived from an arbitrary numerator and time period units.

      Results of this method are cached so future invocations with the same arguments will return the pre-existing units instead of generating new identical ones.

      This method automatically generates a new name and symbol for the new velocity unit.

         Velocity.combine(Kilograms, Second) // mass flow
         Velocity.combine(Feet, Millisecond) // linear speed
         Velocity.combine(Radians, Second) // angular speed
      
         Velocity.combine(Feet.per(Second), Second) // linear acceleration in ft/s/s
         Velocity.combine(Radians.per(Second), Second) // angular acceleration
       

      It's recommended to use the convenience function Unit.per(Time) instead of calling this factory directly.

      Type Parameters:
      D - the type of the numerator unit
      Parameters:
      numerator - the numerator unit
      period - the period for unit time
      Returns:
      the new unit
    • getUnit

      public D getUnit()
      Gets the major unit being measured (eg Meters for Meters per Second).
      Returns:
      the major unit
    • getPeriod

      public Time getPeriod()
      Gets the period unit of the velocity, eg Seconds or Milliseconds.
      Returns:
      the period unit
    • equals

      public boolean equals​(Object o)
      Overrides:
      equals in class Unit<Velocity<D extends Unit<D>>>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Unit<Velocity<D extends Unit<D>>>