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

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());

I would recomend finding time to look through each of these classes to find useful methods and to see an example of high quality code

Last updated