Class MeccanumKinematics

java.lang.Object
me.wobblyyyy.pathfinder.kinematics.MeccanumKinematics

public class MeccanumKinematics
extends java.lang.Object
Forwards and inverse meccanum kinematics. Most forms of drivetrains can use the states of each wheel to determine a position estimate, but meccanum drivetrains have so much slip that doesn't really work. Thus, this class is mostly only useful for forwards kinematics.
Since:
0.5.0
Author:
Colin Robertson
  • Field Summary

    Fields
    Modifier and Type Field Description
    private org.ejml.simple.SimpleMatrix kinematicsBackwards  
    private org.ejml.simple.SimpleMatrix kinematicsForwards  
    private Point posBl  
    private Point posBr  
    private Point posFl  
    private Point posFr  
  • Constructor Summary

    Constructors
    Constructor Description
    MeccanumKinematics​(Point posFl, Point posFr, Point posBl, Point posBr)
    Create a new MeccanumKinematics instance that calculates power values and transformations based on the inputted points.
  • Method Summary

    Modifier and Type Method Description
    MeccanumState toMeccanumState​(RTransform transform)
    Get a MeccanumState from a provided RTransform.
    RTransform toTransform​(MeccanumState state, Angle angle)
    Convert meccanum states into a robot transformation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • kinematicsForwards

      private final org.ejml.simple.SimpleMatrix kinematicsForwards
    • kinematicsBackwards

      private org.ejml.simple.SimpleMatrix kinematicsBackwards
    • posFl

      private final Point posFl
    • posFr

      private final Point posFr
    • posBl

      private final Point posBl
    • posBr

      private final Point posBr
  • Constructor Details

    • MeccanumKinematics

      public MeccanumKinematics​(Point posFl, Point posFr, Point posBl, Point posBr)
      Create a new MeccanumKinematics instance that calculates power values and transformations based on the inputted points. These points are relative to the center of the robot.
      Parameters:
      posFl - the position of one of the meccanum modules. This position is relative to the center of the robot.
      posFr - the position of one of the meccanum modules. This position is relative to the center of the robot.
      posBl - the position of one of the meccanum modules. This position is relative to the center of the robot.
      posBr - the position of one of the meccanum modules. This position is relative to the center of the robot.
  • Method Details

    • toMeccanumState

      public MeccanumState toMeccanumState​(RTransform transform)
      Get a MeccanumState from a provided RTransform.
      Parameters:
      transform - the desired robot translation.
      Returns:
      a meccanum state, representing the power values each module should have to move as desired. Please note: the returned state is NOT normalized, meaning the power values aren't ensured to be in any valid range. It's strongly suggested that you normalize these power values by using the MeccanumState.normalizeFromMaxUnderOne() method - otherwise, the power values might not be very epic.
    • toTransform

      public RTransform toTransform​(MeccanumState state, Angle angle)
      Convert meccanum states into a robot transformation.
      Parameters:
      state - the meccanum state to get a transformation from.
      angle - yeah I don't know it's an angle or something!
      Returns:
      a transformation representing the provided meccanum state.