View unanswered posts | View active topics It is currently Sun Oct 25, 2020 4:48 am

Reply to topic  [ 3 posts ] 
Programe for Ligth and sound Sensor 
Author Message

Joined: Wed Jun 11, 2008 7:44 pm
Posts: 2
Post Programe for Ligth and sound Sensor
Hello every body,

I am attempting to write a sensors programe for my NXT robot.I need your help if any body send me code..for example i have a board in which my robot run, i put white paper also in some where that light sensor sence, when my robot reach at white paper and sound occur as same its become dangerous area for my robot. so when light sensor sence the white part and sound sensor detect the sound by using both sensors..if sound not occur then its not dangerous for robot so robot can move on white part but still dangerous as sound appears..please help me regarding this..i am using robotc. thanks in advance..

Mon Jun 16, 2008 8:12 am

Joined: Sat Apr 12, 2008 11:09 am
Posts: 60
Location: holland
What do you want your robot to do when there is no danger, when it has to be alert and when there is danger?

Tue Jun 17, 2008 1:40 pm
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
your question reminds me on a YouTube video where a robot has been trained not to be scared if a 2nd big robot appears in his environment...

I'll suggest to write a subsumption program with at least 2 elementary behavior routines:
cruise() // dark surface or sound: drive around, whistle a happy song
scared() // white surface, but no sound : stop, squeeze, turn, toggle and go back

maybe you'll need a 3rd behavior
avoid() // to avoid obstacles

a 4th behavior
escape() // searching his dark and save home as quick as possible, his heart bumping quick and loud

a 5th behavior
cooldown() // staying at home in a dark corner and waiting until becoming calm

and maybe you'll need a 6th behavior
cautious() // is already a little accustomed to the white surface or not quite sure about that: slow down, listen, look a little to the left and right side

if you want to train your robot to subsequently loose his initial fear of an unknown environment if a sound signal appears, in this case you'll wish to combine cautious() and scared() with a neural net.

I'm actually not sure if you are a more advanced programmer - if you're not, I'll suggest not to try this, I'm afraid this project will lead to a big frustration... :?

HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}

Sun Jun 29, 2008 5:23 am
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.