Closed AhmetCihatBoz closed 5 years ago
public void teleopPeriodic() {
pixy.getCCC();
byte x = 1;
pixy.setLamp(x, x);
System.out.println(pixy.getCCC().getBlocks());
}
I cant pull data like this, I dont know how to do it :(
Sorry for the unclear documentation, I will work on improving it soon, however there are a few mistakes here.
For one thing, you don't need to call pixy.getCCC()
at the start of the method. The CCC is already setup automatically on it's own.
Also, pixy.getCCC().getBlocks()
will return an ArrayList
full of the object, Block
, so you won't be able to just output it to System.out.println()
like that. You can instead do the following:
ArrayList<Block> blocks = pixy.getCCC().getBlocks();
for (Block b : blocks) {
b.print();
}
Finally, in order for getBlocks()
to give you an array of blocks, you first have to instruct the Pixy to send the block data with the getBlocks(boolean wait, int sigmap, int maxBlocks)
method. For most cases, I would recommend using something like: getBlocks(false, Pixy2CCC.CCC_SIG1, 25)
What this will do, is it will request the Pixy to send over 25 blocks that match signature #1.
The way that it works, is that when you request the blocks from the Pixy, the Pixy sends the data back, and it is stored in a cache. To get access to and use the data, you have to read from the cache by using getBlocks()
. I will rename this when the season is over to make it more concise. Sorry for any confusion!
Thanks!
👍 I done everything like in this documentation 👍 . I can use commands like setLamp setLED getFPS but I dont know how to pull datas like m_x and m_y. Please help me :(