First of all, Pixy is a clever idea and feel it fits my needs very well. I look forward to face detection later but as of now I am on the 1.0.2 fairly new firmware so am rather current.
My Pixy is running over USB using a modified version of your libpixymon demo program.
This version runs as your code runs but grabs my own System V semaphore then dumps the blocks to my own shared memory segment.
I then have my own code in a ROS (Robot Operating System) ‘node’ (process) that acquires the lock and reads the samples.
This all works well BUT I get multiple frame of data each time and have no reference to sort out what I know about already VS new sets of blocks.
What I wish to do is acquire a new run of samples far slower than you run like every 100ms or maybe 50ms and be able to correlate the blocks I read to know what time they are from. The ‘correct’ way to do all this is I guess to integrate the USB demo code into my ROS node (process) and I realize my approach is a bit of a ‘hack’ with the shared memory.
BUT I wondered why there seems to be no pixy-centric unique 32 bit number or something that indicates what sample frame the set of blocks comes from. It would be acceptable for this to be an unsigned value that rolls back to 1 as with 32 bits (or even 16 bits) that is a HUGE time between rollovers and logic to determine a rollover happened is then rather easy modulo math. If such an index existed in your ‘block’ structure in the Pixy Demo OR I could put it in myself if I knew how to get some sort of frame number from PIXY.
If I had such an index that said ‘This set of blocks is from frame 1234’ then later as I read again I could see ‘this set of blocks comes from frame 1280’ and have a way to avoid reading duplicate blocks which it seems to do at this time.
Any thoughts on this OR a way to ‘trigger’ pixy to do another run myself so then I could KNOW for sure what time the frame was analyzed. This ability would have to be over USB for my system.
The issue is total free-run without a timestamp or index makes it non trivial to filter out duplicate packets from set of blocks to next set of blocks.
I see deep down that the Blobs class increments and thus maintains in terms of bumping on each blob the m_blobReadIndex and m_ccBlobReadIndex and then there seems to be a microsecond timestamp also way down at the blobs.cpp level of acquisition although that is a bit more illusive I think it may get stuffed into the data returned from Blobs::getBlocks() and Blobs::getCCBlocks but that starts to get old-skewl fortran array uint16 data stuff and I gave up so far at that point but may revisit if no reply to this query. Either of these (index or usecClock) if they made there way back up to the higher level ‘Block’ structures would do the trick and I feel is a fairly important thing for Pixy to support to be a ‘pro’ device and not a toy.
I’m out of gas tonight in more reverse engineering but I bet you guys know how the PixyInterpreter thread that is instantiated goes about translating Blobs to Blocks for higher level code consumption. This would be a nice addition (please).
Thanks for listening.
Mark Johnston