CR4 - The Engineer's Place for News and Discussion ®
Login | Register for Engineering Community (CR4)


Workbench Creations Blog

Workbench Creations

Workbench Creations is the place for conversation and discussion about do-it-yourself (DIY) projects. This DIY blog will feature projects completed by its owner as well as projects completed by other do-it-yourselfers. Workbench Creations is the place where DIYers can discuss ideas, learn about what others have done, and share their expertise.

Previous in Blog: Team 250: Robot Mock-ups   Next in Blog: Wanted: Simple Science Experiments for Kids
Close
Close
Close
56 comments

Team 250: Programming CMUCam2

Posted January 22, 2007 2:29 PM by jtassarotti
Pathfinder Tags: CMUCam2 computer vision robotics

The game this year presents many challenging problems in both the mechanical and programming sides. One of the key issues for us as programmers is to be able to hone in on "the Rack" during both the autonomous and teleoperated sections of the game. Since the Rack can be rotated and translated this year, it is not possible to simply use dead reckoning methods such as inertial navigation or gear tooth sensors . However, FIRST does offer us an alternative method of finding the Rack: tracking the four green lights atop it with the use of the CMUCam2

But before we could start focusing on the camera there were a few other housekeeping and preliminary issues we needed to address. In the beginning of the season we spent time setting up a remote server which could house our code and files. We also set up a CVS on this server, which automatically updates versions of our code, and allows us to work remotely from anywhere with an internet connection.

We have used this capability to get ahead of schedule, working not only at school but also together at home using a collaborative editing program called Gobby. This allows us to work together on the code at the same time (We are actually writing this blog entry using that program).

In the past week we have not only gotten the basic driving functions of the robot completed, but we have also started work on the CMUCam2 camera. This camera communicates with the robot controller and can be configured to track a given RGB or YCrCb color. When it detects the specified color, it returns the coordinates of a large bounding box around any portion of that color in its view.

The default camera code gives the ability to track two lights at one time, however it does not actually return two separate bounding boxes for each light. Instead it sees the two lights and draws a large box, or "blob" as we call it, around both lights. If this blob is big enough, it infers that there are two lights, instead of just one. This default code and a video of this process can be found here [http://first.wpi.edu/FRC/25814.htm]

However, soon after Kickoff, discussions about alternate methods of multiple object tracking began on the popular FIRST related forum, ChiefDelphi. After posting a potential method and receiving acknowledgment from Kevin Watson, the writer of a great deal of FIRST related code, our team began implementing that technique.

The method we have been implementing revolves around the CMUCam2 command called "virtual window". This allows the camera's view to be split up into smaller windows and re-processed. In our initial version of our code, we divided the window up into multiple rows and columns and printed a 1 or 0 through the serial port if there was any green in that section. Quickly our code grew more advanced, and we wrote a Python script to interpret the serial data and display small green rectangles in a window on our computers.

We quickly learned that this method was too slow. Each new box was processed at a rate of 26.2 milliseconds, and with a total of only 32 boxes, this took at least 838.4 milliseconds. This would be too slow for actual game play, with only 15 seconds of autonomous mode to work with. We can not afford to spend a long time scanning with the camera because there are other functions which must also be run during this period, like driving and manipulation.

Our second version was split up into three steps. First it processed the whole view of the CMUCam2. Then based on the center of the bounding box the camera returned, we split the view in half and processed the left side and then the right side. Then this code printed the coordinates for the first large bounding box and then the two smaller rectangles, and our Python script drew a side by side comparison of the initial bounding box and the re-processed views.

We have made a video which shows an example of our code at work. The position and orientation of the two lights are altered throughout the video. This can be seen in the lower right box which shows two green rectangles drawn based on the coordinates returned by the camera and our code. However, only one green box appears when using the original default code, seen in the upper right corner.


The video can be seen here:
http://video.google.com/videoplay?docid=4711623040823747005

We hope that this method will provide an alternate means to track two lights in view. If you are interested in more information, or would like the source code in its beta phase, please post a comment below. Can anyone share their experience with vision algorithms with or without the CMUCam2? Also, since we hope to combine data from the CMUCam2 with other sensors, can someone share any information about multi-modal sensor fusion and adaptive filters or point out any good resources or papers on these topics and other issues of control theory and filtering?

Farewell,
Team 250 Programmers

Reply

Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

Comments rated to be "almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, rate them!
Anonymous Poster
#1

Re: Team 250: Programming CMUCam2

01/22/2007 3:29 PM

Hey,

I wouldn't mind getting a copy of the code: dan.hoizner@gmail.com


Thanks!

Reply
Anonymous Poster
#2

Re: Team 250: Programming CMUCam2

01/23/2007 7:14 PM

I would also appreciate a copy of the code: m077224@usna.edu.

Very respectfully,

P. White

Reply
Anonymous Poster
#3

Re: Team 250: Programming CMUCam2

01/23/2007 8:37 PM

Can i get a copy of the code also?

bear24rw@gmail.com

Reply Score 1 for Good Answer
Anonymous Poster
#4

Re: Team 250: Programming CMUCam2

01/24/2007 1:11 PM

Hi, Thanks for posting your blog on C.D...nicely done!

By day I am an aerospace engineer, but by night and weekend I mentor the controls and software on FRC Team 180. You may have seen these already - and they are not high school math - but you might want to Google for these papers:

Error tolerant Multimodal Sensor Fusion
Sensor Fusion for Social robotics (if you can't download copies...let me know...I have .pdf's)

and check out Dan Simons Embedded.com article on Kalman Filtering:

http://academic.csuohio.edu/simond/courses/eec644/kalman.pdf

you can also search Embedded.com for more on filters. His "On Getting It" lays a lot of foundation for the math behind the methods.

These might help as a jumping off point on filtering and sensor fusion. I'd like to take you up on your offer for your beta code. You can PM me on C.D. EricS-Team180 or reach me at seabeze4@adelphia.net

We hope to be doing simple autonomous driving with the camera as a sensor, this weekend, on last year's 'bot. We are, as usual, behind schedule :)

Thanks!

EricS

Reply
Anonymous Poster
#5

Re: Team 250: Programming CMUCam2

01/24/2007 3:14 PM

Team 1677

Hey:

We read your comment and it sounds great to be able to track two boxes separately.

We are interested to do that. Could you please guide us how you did your code or email us the code to Bnl1433@gmail.com. We will get with you if we make any progress using your code.

Thanks in advance.

Reply
Anonymous Poster
#6

Re: Team 250: Programming CMUCam2

01/24/2007 9:58 PM

Nice post, I was wondering if Team 820 could also get a copy of the code. If it's possible to send it, my e-mail is canadude@gmail.com. Thanks, Bogdan Tudose Team Captain of Team 820

Reply
Anonymous Poster
#7

Re: Team 250: Programming CMUCam2

01/24/2007 11:00 PM

Hey there,

I was working on doing the same thing as you...looks like you beat me to the punch =). I'd like a copy of your source code too. Email: davidtsao [at] gmail [dot] com. Thanks and good job!

Reply
Participant

Join Date: Dec 2006
Posts: 2
#8

Re: Team 250: Programming CMUCam2

01/25/2007 10:19 PM

Thanks everyone for your interest in our work! I have sent an update message to the people who provided their addresses above. However, EricS from Team 180, your email bounced. Could you please re-post your address? If anyone else did not get the message, please leave a comment.

Thanks,

Programmers of Team 250

Reply
Anonymous Poster
#45
In reply to #8

Re: Team 250: Programming CMUCam2

02/17/2007 5:50 AM

Hi there Team 250

Team 2212 would love to see this too. Please send to alan.green.mail@gmail.com

Many thanks

Alan

Mentor

Reply
Anonymous Poster
#9

Re: Team 250: Programming CMUCam2

01/26/2007 12:18 AM

Excellent work Team 250! I wouldn't mind getting a copy of the code either. My address is manderson5192@hotmail.com

Reply
Participant

Join Date: Jan 2007
Posts: 1
#10

Re: Team 250: Programming CMUCam2

01/26/2007 1:41 PM

Team 1094 would be interested in seeing a copy of the code. We are trying to write routines to find the non light peg. By seeing the individual boxes, we should be able to extrapolate enough data to determine the non-light peg. I will post the algorithms for this if I can get it to work. mgurgol@netscape.net

Reply
Anonymous Poster
#11

Re: Team 250: Programming CMUCam2

01/27/2007 8:55 AM

Team 1885 would greatly appreciate a copy of the source code. We have also been working on an algorithm to find the nonlight peg based on proportional math. You could send it to my email at rusu.2k3.15@gmail.com


Good work and Thanks Again!

Reply
Anonymous Poster
#12

Re: Team 250: Programming CMUCam2

01/27/2007 9:24 AM

Congratz on the break-through! Could team 1551 get a copy of it also? Thanks

bronxbomber92@yahoo.com

Best of luck!

Reply
Anonymous Poster
#13

Re: Team 250: Programming CMUCam2

01/27/2007 6:04 PM

I would love to check out the code. I have been just trying to aim for one side of the bounding rectangle. Its not working out so well. Congrats on figuring that out. Thank you in advance. dmazza90@gmail.com

-David Mazza

Team 564

Reply
Anonymous Poster
#14

Re: Team 250: Programming CMUCam2

01/27/2007 10:13 PM

Team 67 would also like a copy. Thanks! waldokids@comcast.net

Reply
Anonymous Poster
#15

Re: Team 250: Programming CMUCam2

01/28/2007 12:40 PM

Only hoping you're still handing out copies - team 360 would forever be in your debt.

john.m.chilton@gmail.com

Reply
Anonymous Poster
#18
In reply to #15

Re: Team 250: Programming CMUCam2

01/28/2007 3:48 PM

I just read what you said on CD about Gmail bouncing the py2exe compiled scripts, so here's an alternate address:

johnc@bprobotics.com

thanks!

Reply
Anonymous Poster
#16

Re: Team 250: Programming CMUCam2

01/28/2007 12:40 PM

Can you send me the code also, dark_key@walla.com Thanks, Tal

Reply
Anonymous Poster
#17

Re: Team 250: Programming CMUCam2

01/28/2007 3:13 PM

One more team requesting a copy of your code and related materials. You guys are really generous! Thanks for all the posting. Team 354. Brookly, NY.

354@gwestrobotics.com

Reply
Anonymous Poster
#19

Re: Team 250: Programming CMUCam2

01/28/2007 4:18 PM

Yet another team requesting a copy of your code. You guys are really leading the way here. We will be happy to share any improvements we make. Team 2084. Manchester, MA.

Please send to cwilliams@alum.mit.edu. Thanks.

Reply
Anonymous Poster
#20

Re: Team 250: Programming CMUCam2

01/29/2007 1:02 PM

Could you send us a copy of the code too? Team 1512.

dabellard@sps.edu

Thanks for all your help!!

Reply
Anonymous Poster
#21

Re: Team 250: Programming CMUCam2

01/29/2007 1:25 PM

I would like a copy of your code also.

Thanks for the help

Joe

joep113@hotmail.com

Reply
Participant

Join Date: Jan 2007
Posts: 1
#22

Re: Team 250: Programming CMUCam2

01/29/2007 4:54 PM

Could you send the code to me also?

bobcat79568 [at] gmail [dot] com

Thanks,

Bob

Reply
Anonymous Poster
#23

Re: Team 250: Programming CMUCam2

01/29/2007 9:49 PM

Can i get a copy of the code also?

lucianetec@gmail.com

tanks

Reply
Anonymous Poster
#24

Re: Team 250: Programming CMUCam2

01/29/2007 10:11 PM

Cool Stuff! Thank You!

Please send code to whitetiger0990@gmail.com

Again..thanks...

Reply
Anonymous Poster
#25

Re: Team 250: Programming CMUCam2

01/30/2007 4:28 PM

Can you please send a copy of your code to me?

I'm currently mentoring a team also.

tom.altamura@baesystems.com

Reply
Anonymous Poster
#26

Re: Team 250: Programming CMUCam2

01/30/2007 11:48 PM

I'd be interested to see your code.

robind@sonic.net

Thanks,

Robin Davis

Reply
Anonymous Poster
#27

Re: Team 250: Programming CMUCam2

01/31/2007 6:46 AM

Yet another person would like to see your code :D

My email is akowald [at] mchsi (dot) com

Thanks very much!

Alex

Reply
Anonymous Poster
#28

Re: Team 250: Programming CMUCam2

02/02/2007 10:37 AM

Very impressive and very well done.

Team 1089 would also like to have a look at your code
MReffler@gmail.com

Reply
Anonymous Poster
#29

Re: Team 250: Programming CMUCam2

02/03/2007 11:45 AM

may I have a copy also?

greenshoes90@yahoo.com

Thanks!

Reply
Anonymous Poster
#30

Re: Team 250: Programming CMUCam2

02/03/2007 4:06 PM

The entirety of team 1139 is in awe of your skill. We'd love a copy of the code, if possible: dpfreeman@bellsouth.net

Thanks!

Reply
Anonymous Poster
#31

Re: Team 250: Programming CMUCam2

02/03/2007 8:57 PM

Job well done!

Is the code still being distributed? If so, please send me a copy at gnirts@gmail.com

Thanks in advance,

Robinson Levin

Reply
Anonymous Poster
#32

Re: Team 250: Programming CMUCam2

02/03/2007 10:01 PM

Team 236, 'TechnoTicks', from Old Lyme Ct would also be interested in your code. Great work!

jmittelman@adelphia.net

Jon Mittelman

Mentor

Reply
Anonymous Poster
#33

Re: Team 250: Programming CMUCam2

02/03/2007 11:35 PM

Hey! That is awesome! I would like to have a copy of the code: fembots_692@yahoo.com

=]

DotCom
Team 692

Reply
Anonymous Poster
#34

Re: Team 250: Programming CMUCam2

02/06/2007 7:14 PM

Wow! Good job guys! I applaud you on your success and willingness to distribute the source code. Team 1011 is interested in your code. We have created a program that drives towards a single light and would like to expand to the 2 light problem. Please contact us at numbermaniac@gmail.com

For anyone else who reads this. E-mail to the same place and we will be glad to give you our code. It quickly locks onto and drives toward the target light. If the light moves the robot corrects itsel. Very cool to watch.

Reply
Anonymous Poster
#35

Re: Team 250: Programming CMUCam2

02/06/2007 9:17 PM

Wow- you have really taken the challenge to a higher level! Team 1594 would also be interested in seeing your source code. Thank you for inspiring us and for sharing!

Katherine Hallissy Ayala

khallissy@brearley.org

Team 1594

Reply
Anonymous Poster
#36

Re: Team 250: Programming CMUCam2

02/06/2007 11:39 PM

This looks very cool; as my team's director of programming I'd also be interested in seeing the code. We were trying to work up something similar today, but we're pretty inexperienced with doing low-level CMUCam stuff.

Edward Kaplan

Team 694

(ekaplan at stuy dot edu)

Reply
Anonymous Poster
#37

Re: Team 250: Programming CMUCam2

02/08/2007 10:44 PM

I would love to see a copy of your code as well.


Jay@fraghaus.com

Reply
Anonymous Poster
#38
In reply to #37

Re: Team 250: Programming CMUCam2

02/09/2007 2:53 AM

I would also love a copy please. BTW, did anyone else "tune" the default Kevin Watson code to change the search function to make it faster or is it pretty much at "max" the way it's written? When we run it, sometimes it takes three full "pan" passes until it finds the right tilt and pan and seems to take about 5 or 6 seconds. Do others see this too?

Thanks,

johncrombe (at] gmail dot com

Reply
Anonymous Poster
#39

Re: Team 250: Programming CMUCam2

02/09/2007 2:05 PM

Hey, Programming Team from Team 369 Here. We have been struggling to modify Kevin's code to track two targets however so far we are very unlucky and pretty lost. It would be awesome if you could sent us your code.

Durytskyy@yahoo.com or Genius8001@gmail.com is fine. Thank you very much.

- Team 369

Reply
Anonymous Poster
#40

Re: Team 250: Programming CMUCam2

02/09/2007 5:40 PM

Sweet deal.

I'd like to port this to work with WPILib's camera module and easyC. I'd also like to talk to you guys about redistribution of the software once its out of beta and possibly inclusion on my videocast, The Blue Alliance.

tom.bottiglieri@gmail.com

Reply
Anonymous Poster
#41

Re: Team 250: Programming CMUCam2

02/12/2007 6:44 PM

I would appreciate a sample of the source code. email it to mc_herbboy@yahoo.com

Reply
Anonymous Poster
#42

Re: Team 250: Programming CMUCam2

02/12/2007 11:54 PM

If it's not too late, I'd like to have a peek at your code.

Thanks in advance. - baclaskya@thompson.k12.co.us

Reply
Participant

Join Date: Feb 2007
Posts: 1
#43

Project 2200: Programming CMUCam2

02/15/2007 12:11 PM

Yes, can you also send me your code as well. That will be great

1dharank@hdsb.ca

Thankyou

Regards,

Team 2200

Reply
Anonymous Poster
#44
In reply to #43

Re: Project 2200: Programming CMUCam2

02/16/2007 1:10 AM

Chimera - Team #832 states in unison "We're not worthy" and would love to see your code (especially our mentors). Please send a copy to first [at] thelowes [dot] org.

Thank you

Reply
Anonymous Poster
#46

Re: Team 250: Programming CMUCam2

02/17/2007 9:52 PM

hi,

We are the falcon - would like to see your code. The video is cool.

thanks

Chuck

Reply
Anonymous Poster
#47

Re: Team 250: Programming CMUCam2

02/19/2007 8:45 AM

I too wish to join the request list for the code. rogerculp (at) verizon (dot) net

Reply
Anonymous Poster
#48

Re: Team 250: Programming CMUCam2

02/21/2007 2:42 PM

Most impressive guys. Team 245 would love a chance to check out the code. Also, could you send us the original python implementation, it'd be interesting to see if either works better for this application. We have a 400mHz coprocessor on our robot running python, so speed is less of an issue for us (and real floating point calculations, thank god!)

If you're interested in some of our coprocessor work we'd be glad to send it to you. Great job, I can't wait to see what you guys have come up with.

pat.pannuto@gmail.com

Reply
Anonymous Poster
#49

Re: Team 250: Programming CMUCam2

02/25/2007 7:39 PM

I would very much like to get a copy of the source code as well, please e-mail me at Neo3One3@cox.net

Reply
Anonymous Poster
#50

Re: Team 250: Programming CMUCam2

03/07/2007 11:07 PM

Dear all

I would like to use CMUcam2 for mobile bobot which is follow line in the net but i have no enough information and document. Who have document or source code, please help me.

Thanks alot

Reply
Anonymous Poster
#51

Re: Team 250: Programming CMUCam2

03/12/2007 5:17 PM

I would also appreciate a copy of the code: vol1prophet@yahoo.com

it would help us over our programming problem

Very respectfully,

Melvin Guzman

Reply
Anonymous Poster
#52

Re: Team 250: Programming CMUCam2

04/10/2007 8:08 PM

can i have a copy of the code, i would really appreciate it , my email is olvinlopez@msn.com.

Reply
Anonymous Poster
#53

Re: Team 250: Programming CMUCam2

08/05/2007 1:00 PM

hi

plz send the code to zorrooguy@yahoo.com, thanks and much appreciate it.

Thank you

zorro

Reply
Anonymous Poster
#54

Re: Team 250: Programming CMUCam2

11/03/2007 11:40 PM

Please send source code to dsephiroth4@yahoo.com

Reply
Anonymous Poster
#55

Re: Team 250: Programming CMUCam2

01/19/2008 5:35 PM

Hello I am a programmer on team 67 and I would really appreciate a copy of the code which tracks multiple light boxes email me at rjcentral@gmail.com

Ryan, Team 67 H.O.T

Reply
Anonymous Poster
#56

Re: Team 250: Programming CMUCam2

02/20/2008 8:20 PM

If anyone is interested, the code is available at this ChiefDelphi post:

http://www.chiefdelphi.com/forums/showpost.php?p=580474&postcount=26

Reply
Reply to Blog Entry 56 comments
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

Comments rated to be "almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, rate them!
Copy to Clipboard

Users who posted comments:

Anonymous Poster (52); bobcat79568 (1); jtassarotti (1); mgurgol (1); Project 2200 (1)

Previous in Blog: Team 250: Robot Mock-ups   Next in Blog: Wanted: Simple Science Experiments for Kids
You might be interested in: Bar Code Scanners, Bar Code Cards, Bar Code Software

Advertisement