dogecv / DogeCV

FTC Vision Library
https://discord.gg/colton
GNU General Public License v3.0
68 stars 64 forks source link

How do I access the alignedX var outside of the class #27

Closed GraniteBots10230 closed 5 years ago

GraniteBots10230 commented 5 years ago

I'm working on a opmode with gold align detector, and i want to use the alignedX variable in my code to use. I've messed around with some values and things but can't figure it out. More spicificly, I'm looking for the center of what the detector considers aligned.

ghost commented 5 years ago

Hey! Inside the GoldAlignDetector class, there is two public fields: alignPosOffset and alignSize. I believe this is what you are looking for.

ghost commented 5 years ago

Inside the process method of the GoldAlignDetector class, there the following statements: double alignX = (getAdjustedSize().width / 2) + alignPosOffset; double alignXMin = alignX - (alignSize / 2); double alignXMax = alignX +(alignSize / 2);

As we can see, variable alignX is where the center of the aligning zone, while alignXMin is the left-bound for the zone and alignXMax is the right-bound one.