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.SimpleMatrixkinematicsBackwardsprivate org.ejml.simple.SimpleMatrixkinematicsForwardsprivate PointposBlprivate PointposBrprivate PointposFlprivate PointposFr -
Constructor Summary
Constructors Constructor Description MeccanumKinematics(Point posFl, Point posFr, Point posBl, Point posBr)Create a newMeccanumKinematicsinstance that calculates power values and transformations based on the inputted points. -
Method Summary
Modifier and Type Method Description MeccanumStatetoMeccanumState(RTransform transform)Get aMeccanumStatefrom a providedRTransform.RTransformtoTransform(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
-
posFr
-
posBl
-
posBr
-
-
Constructor Details
-
MeccanumKinematics
Create a newMeccanumKinematicsinstance 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
Get aMeccanumStatefrom a providedRTransform.- 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
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.
-