Class DrivetrainSpeed


  • public class DrivetrainSpeed
    extends java.lang.Object
    Class represents a speed vector for the robot, relative to the robot.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      double omega
      Rotational velocity
      double vx
      Velocity in X direction
      double vy
      Velocity in Y direction
    • Constructor Summary

      Constructors 
      Constructor Description
      DrivetrainSpeed()
      Creates a new, zero drivetrain speed.
      DrivetrainSpeed​(double vx, double vy, double omega)
      Creates a new drivetrain speed.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static DrivetrainSpeed fromFieldCentricSpeed​(double vx, double vy, double omega, edu.wpi.first.math.geometry.Rotation2d theta)
      Creates a drivetrain speed from a field-centric velocity.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • vx

        public final double vx
        Velocity in X direction
      • vy

        public final double vy
        Velocity in Y direction
      • omega

        public final double omega
        Rotational velocity
    • Constructor Detail

      • DrivetrainSpeed

        public DrivetrainSpeed()
        Creates a new, zero drivetrain speed.
      • DrivetrainSpeed

        public DrivetrainSpeed​(double vx,
                               double vy,
                               double omega)
        Creates a new drivetrain speed.
        Parameters:
        vx - Velocity in X direction
        vy - Velocity in Y direction
        omega - Rotational velocity
    • Method Detail

      • fromFieldCentricSpeed

        public static DrivetrainSpeed fromFieldCentricSpeed​(double vx,
                                                            double vy,
                                                            double omega,
                                                            edu.wpi.first.math.geometry.Rotation2d theta)
        Creates a drivetrain speed from a field-centric velocity.
        Parameters:
        vx - Velocity in X direction relative to the field
        vy - Velocity in Y direction relative to the field
        omega - Rotational velocity relative to the field
        theta - Robot's orientation relative to the field
        Returns:
        A new drivetrain speed equal to the input speed relative to the robot.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object