Clap back robot

I haven't had time to build or blog about one of my own creations for a while, so when I found myself with a few hours spare I put this together. Yes I know its a copy of one that I posted before but I've wanted to do my own version for quite a while.

It's written in NXC and full source can be see here





--
Damien Kee

Comments

Anonymous said…
Thank you for sharing the NXC code.
But I think there must be something missing in your program, in the "while ((CurrentTick()-t0) < 5000)",there is no statement for increasing value of "i".
Am I wrong? Thank you for your code.
Damien Kee said…
whoops, thanks for that. I pulled out some debugging lines (like displaying the number of claps etc to the screen) and it must have gone with them.

Have fixed up.

damo
Anonymous said…
Thanks!
I will introduce your bot in my blog(In traditional Chinese)
I will try to build mine with NXT-G.
Thanks for your code again!
Damien Kee said…
Hunter,

I'll be very interested to see how you implement the arrays. Keep us updated.

damo
David Levy said…
I created a NXT-G version of this that you can [download here]

The Array Block came from
http://www.teamhassenplug.org/NXT/

It could use some my-block refactoring and I'm sure other improvements.

David
Chris Bracken said…
Nice activity Damo, and nice NXT-G adaption David, thanks
David Levy said…
I noticed that with the NXT-G version, I had to be very careful not to clap my hands too fast. It looks like from Damien's video that NXC may be more responsive in that respect ( or perhaps I inadvertently coded in the latency myself).

By the way. I just refactored my version of taps with Myblocks.
You can download the zip file here

David
Damien Kee said…
David,

I noticed that you rotate the motor for 25 degrees then wait for 0.1 seconds. How do you determine exactly how long that action takes?

I rotate for 0.075 seconds down and then 0.075 seconds up which gives me a predictable 0.15 seconds for the complete movement.

I love the NXT-G implementation and am amazed that it can handle it, but I think this is a good example of showing how different languages are suited to different projects. I wouldn't want to try and 'teach' that NXT-G example to a classroom. :)

damo
David Levy said…
Damien,
I'm not familiar with NXC but the text was very easy to read.
However I did trip up on
OnFwd(OUT_A, 100);
Wait(75);

I thought the 100 was some sort of rotational count and the wait was there just to pause before pulling the drumstick back up.
A a result I guessed at the 25 degrees with wait for 0.1 seconds.
There is probably also a discrepancy between my robot and yours ( i.e. the distance the drumstick needs to travel before tapping the drum).

"I wouldn't want to try and 'teach' that NXT-G example to a classroom"

That's something I think about all the time. I'm currently working with 4th and 5th graders who need to start learning how to datalog.

click here for to see details
. They are staring to use text concatenation techniques, defining variables, and files, and lots of wiring to boot.. So should they learn a text based language at this point.. I don't know.

I'm a text based programmer all the way however I do believe that any debate on text -vs- graphics ( or for that matter, any debate on programming languages ) is usually biased because the preference usually is based on what the person is more familiar with.

Also before making assertions about where the graphical paradigm falls short, consider what is currently being done today with Labview.

David
Damien Kee said…
David,

"OnFwd(OUT_A, 100);
Wait(75);"

This means turn Output A on 100% power for 75 milliseconds.

It really is a difficult topic and I think there will never be an answer that suits everyone. I absolutely love NXT-G. It has made my job as a trainer so much easier. I'm really impressed that you are managing to use the datahubs and wiring with your students and can't wait to see the results they come up with. *for this particular project*, I think the array implementation in NXT-G is just a little too messy.

I know all too well the power of Labview (flashbacks to final year engineering degree) and don't dispute for a second a graphical languages power.

I'm going to go the cheats way out and paraphrase Brian Davis "the right tool for the right job" :)

damo
damo
Anonymous said…
Hi! damo:
I finished my NXT-G program.
You can download from:
http://touchclass.myweb.hinet.net/CLAPBACK4.rbt
Because you just use one dimension array, so I can use file access to store the time stamp, just like what I used in my "NXT Simon game".
It is hard to find out the proper way to make motor work correctly.
NXT-G is more slow responsive than NXC, I hope NI can improve NXT-G ASAP.
Also Thanks for David's program.
(BTW My hands are painful !*_*)
David Levy said…
Hunter,
Yes using a file does seem to work since all you really need to do is read the array sequentially.

Damien,
I found the array block on Hassenplug's site ( hassenray?)
I'm not sure about the internals but the interface is very easy. This is the first time I used it and was not planning to show the this program or the array to the kids. They do have a simple wiring example screenshot that they uploaded to the Files section of the hale-teams google group ( see link in my prior thread)

I think I may introduce them to NXC to see if they can pick it up.

Cheers,
David

Popular Posts