Geometry
It can be useful to think in terms of geometry to solve more complex problems, the following pages contain useful classes that you will see everywhere
Team 254 made changes to the wpilib geometry classes, they have useful functions so we prefer to work with theirs
Many librarys will return/require a WPILib geometry class rather than the 254 class, following are conversion standards for all classes. This is a common source of confusing syntax errors for beginers
Converting from WPI to 254
import com.team254.lib.geometry.Translation2d;
edu.wpi.first.math.geometry.Translation2d wpiTranslation = new edu.wpi.first.math.geometry.Translation2d(1,0);
Translation2d poofTranslation = new Translation2d(wpiTranslation);
//WPI Translation does NOT have to be redefined
//it is a pain to write out the whole path
//but it is uncommon to have to store a value in a form you dislike
//For example
Translation2d newTranslation = new Translation2d(exampleLib.getTranslation());
Converting from 254 to WPI
import com.team254.lib.geometry.Translation2d;
Translation2d poofTranslation = new Translation2d(0,1);
edu.wpi.first.math.geometry.Translation2d wpiTranslation = poofTranslation.wpi();
//WPI Translation does NOT have to be redefined
//it is a pain to write out the whole path
//but it is uncommon to have to store a value in a form you dislike
//For example
exampleLib.takeTranslation(poofTranslation.wpi());
Last updated