Where Does The Botball Camera Store Images?

3 replies [Last post]
cosbykid
Title: NooBot
Joined: 01/26/2012
Posts:
BotPoints: 18
User offline. Last seen 10 years 21 weeks ago.

Hello, my question should be relatively simple to answer if the information is available, but where does the image get stored when a track_update() is issued?
This question, of course is operating on the premise that there is some sort of intermediate storage between track_update and all the image processing / color tracking that goes on. If anyone has this knowledge, it would be much appreciated if they were able to share it with me.

Sincerely,
cosbykid

I pity the fool who eats my cereal.

Beta
Beta's picture
Title: The Magnificent
Joined: 02/24/2012
Posts:
BotPoints: 266
User offline. Last seen 8 years 32 weeks ago.

There is no intermediate representation of the image captured by the botball camera. It goes straight from the kernel driver to cbcui, where it is processed. All finalized tracking data is then publicly posted to client programs using a pipe/mmap of some sort (I think... It's been a while since I've looked at it.)

Anyway, I digress. It is not possible to get an image from the CBC without digging deep into the firmware.

If you still want to try, however, here is a link to the applicable source code from cbcui: https://github.com/kipr/cbc/tree/master/cbcui/src/vision

It's a mess and quite a lot of code. I recall one team that wrote their own camera interface and sent a stream to a laptop, but I don't remember the team's name nor do I believe the source is openly available.

Good Luck!

Braden McDorman

Developer of the KIPR Link, KISS IDE, KIPR's 2D Simulator, and CBCJVM.

Reach me at bmcdorman(cat)kipr(dog)org where (cat)=@ and (dog)=. if you need assistance of any kind.

cosbykid
Title: NooBot
Joined: 01/26/2012
Posts:
BotPoints: 18
User offline. Last seen 10 years 21 weeks ago.

Thanks! Although it looks like it would probably be easier to write a new camera interface than to try to modify what's already there.

I pity the fool who eats my cereal.

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 7 years 19 weeks ago.

Both Matthew Thompson (Nease) and I have tinkered with the cbcui vision code. It's probably not that hard to dump frames to a file in /tmp/. I would do this as part of the MicrodiaCamera.cpp loop.

If you don't want to compile a new firmware, there's a workaround. Run your program, then go back to the menu while the program is running, and go to the vision screen so that the camera image is visible. From there, I believe the following KISS-C command will give you an image:

  1. system("cat /dev/fb0 > /tmp/screenshot.bin");

I may have the device name wrong; it's been a while since I looked at that. Once you do that, you'll have a file in /tmp/screenshot.bin which will contain a 16-bit-per-pixel copy of what was on the CBC screen at that time, including the camera image. You can open and parse that file however you wish. Note that you can also modify the data, write it back to another file, and cat that file's contents to the fb0 device to see the modified data on-screen.

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS