Asked — Edited

Help Me With Security Guard Script Please

:start stop()

:test #See if someone comes too close to it GetPing( d18, d17) GetPing( d9, d8 )
Ping_wait(d18,d17,LOWER,20) Ping_wait(d9,d8,LOWER,20) if (ADC(ADC1 < 120) sleep(500)

   if (ADC(ADC2 < 120)
       sleep(500)
       goto (alarm)
       goto(test)

:alarm

ControlCommand("Soundboard",Track_10)
    goto(start)

    #If speech recognition hears "Halt!"

 say ("Exit ting Security Mode!")
   halt()
RETURN()


ARC Pro

Upgrade to ARC Pro

Harnessing the power of ARC Pro, your robot can be more than just a simple automated machine.

#1  

oh, sorry. This is the Security Guard script. I have two sonars. A horizontal and a Vertical Sonar. I have two IR units. Both Sharp IR.

Any comments welcome.

Australia
#2  

I would love to have a sentry like your setting up and wish I could help MovieMaker but I have no idea on how these script things work except at a basic level. This is where I thought EZ-ROBOTS could help us with cloud examples - unfortunately - no change tired tired sleep

PRO
Synthiam
#3  

I'll help you understand what's wrong with the script... Write in point form what you think each line does.

#4  

Thanks, D.J.

ok,

:start ; #this is the start of the program stop();# I stop the robot while I am making measurements

#It is to become a Security Guard simply TESTing the environment and Alarming if anything #gets too close. I have two IRs and two sonars watching both vert and horz.

:test ; #this is a label to start the test #See if someone comes too close to it ;this is a remark GetPing( d18, d17) ;#i am getting the echo information from the Ping no. 1 Horizontal GetPing( d9, d8 ) ;#here I am getting information from the Ping no. 2 Vertical Ping
Ping_wait(d18,d17,LOWER,20) # here I am waiting for a value of the ping to get lower than 20 Ping_wait(d9,d8,LOWER,20) # here the same on ping number 2, lower than 20

  if (ADC(ADC1 < 120) ;#here I am checking sharp IR unit for a value under 120 on Horizontal IR
   sleep(500) #here I am waiting a half of a second

   if (ADC(ADC2 < 120) ;#same as above but Vertical IR
       sleep(500) ;#rest for a half of a second
       #If anyone gets too close I sound the Alarm, if not I test again.
       goto (alarm) ;#sound the alarm
       goto(test) ;# go back and test everything again

:alarm ;#another label name

ControlCommand("Soundboard",Track_10) ;#this actually plays the Alarm noise
    goto(start) ;#got back and do everything from the start

    #If speech recognition hears "Halt!"

 say ("Exit ting Security Mode!") ;#let everyone know we are through with this script
   halt() ;halt this script
  RETURN(); # go back where it was called from. 
   #Needs to goto speech recognition and wait for command.

   #I planned to use the little subroutine for antonymous navigating.

do I need two more RETURNS in there? I mean do I have to have a return for every goto?

I know that it is hard to believe, but in my prime, I have written some vertical markets and was a good programmer. I programmed in BASIC and DBASE and some c. But, that was a long time ago when my brain actually worked.

PRO
Synthiam
#5  

Programs read from top to bottom like a book. Each command is executed and the next command is not executed until the previous command finishes.

For example, the two ping_wait() commands. If I asked you to wait for something, you'd wait, right? Look at them a bit closer. You're waiting for two things in an order. Is that what you expect?

Also, getping()? What are you getting it for an where are you assigning it?

I may eventually rewrite it for you, but not until you try longer :)

You can give a man a fish and he'll eat for a day. Teach a man to fish, and.........

#6  

I appreciate it. What I am trying to do is all four at once. I don't know how to word it. I need when it is running here and there to stop and not run into things. That is what I was trying for in the little center part. Get the ping information, all of it. If the horizontal ping doesn't see it, I need the vertical one to see it. If the sonic doesn't see it, I need the IR to see it. Most of the robot is complete except it was sometimes sounding the alarm correctly and then it did it over and over and over and my wife threatened to kick me out of my own apartment. I guess when I try again, I'll have to lower the volume.

So, before I did the antonymous navigating, I thought i would start with a simple Security guard program. Everything is tied to the speech recognition. It is always on and listening. So, after it complete one assignment it needs to go back and listen. I also have a master program trying to call the different modes.

I am getting a ping value. and I don't know where it is going. I figured once I pinged it it would be where it needed to be in order to test it. Also, I am running get the value,ping wait,ping radar , and all of the ping stuff. Maybe I only need part of it running.

I have:

Master: init Security Mode Chat Mode (this gets all of the rss, and things like that from speech rec.) Find the Red Ball Mode Operate the Hand Mode

Are you saying that I should be using the Ping_Wait OR the get_Ping instead of both? But the question would be HOW are the other units going to be read in time to stop a collision?

sorry for being so dense.

anyway, that is an overview what I am trying to accomplish. I will continue my work.

Thanks,

Mel

#7  

poor guy is trying,hope you can fix it MEL dont give up,scripts are little hard sometimes to takes about 4 or 5 times to get it right,then soon other scripts will be much easy to do JUST DONT GIVE UP

#8  

Fred,

I will not give up on this one. I gave up on the turtle-bot. But, I am still planning to tackle ROS. I have to have ROS for QBO.

Thanks for the Moral support. While I have you, what do you think about NAO?

PRO
Synthiam
#9  

Visit the ARC's download page and update to v2012.08.12.00

Click File->Examples and load the Example - Script - Security Guard

#10  

man I'm right behind you Moviemaker - keep at it, I'm sure you'll crack it.

Lets make sure that we all help each other as much as possible with any issues we have with scripts - for the uninitiated they can be damn daunting (like myself) :) There a a heap of really smart guys on this forum who need to appreciate that for some of us, this is a brave new world and sometimes a little confusing.

Oh and for the record - the best robot in a movie was in Rocky IV -Pauli's advances were a little worrying though!

#11  

the best robot of all time is Bicentennial Man with ROBIN Williams and was made by the worlds greatest robotic writer ISSAC ASIMOV and gave us the 3 LAWS OF ROBOTICS ,HE IS THE ONE WHO STARTED ROBOTS and my favorate robot is JOHHNY FIVE from short circuit,and working on a full detail and size of him

Spain
#12  

Totally agree with you robotmaker, Isaac Asimov is my favorite writer, and a movie Bicentennial Man fantastic. :)

#13  

he is the creator of robots,plus the writer of IROBOT and more

#14  

Thanks guys and Thank You, D.J;. I haven't looked at it yet, but I bet I am going to be amazed.

I USED to be a good programmer back in the DOS days. I programmed in Basic. The way I learned to program was to read three books. The first one I forget the title was like Beginning Basic. But, the second two I will NEVER forget. One was called BASIC BASIC, The other was called ADVANCED BASIC. Each book had over a hundred programs listed in a readable format. I had all of that in the palm of my hand. I started off slow like "hello world." By the time I finished I was writing short useful programs. Then, I owned a computer store for 12.5 years. I was an authorized Peach-Tree Dealer. Software would come in on a regular basis not working. So, I had to correct it. Sometimes, I called the factory, but mostly by then, I could correct it myself. Then I started Customizing software for my customers. When Wayne Ratlif came out with Vulcan database it was Heaven. I started to program in DbaseII, and III. That is when Aston Tate bought out Vulcan and changed it's name to Dbase. I had all of the knowledge and was so good at it. But, that was about 35 years ago and one forgets. I am hoping to get back into programming. I just need a few good books. I did good with c for the arduino. But, like you said that is Mickey-Mouse compared to the EZB.

If I do succeed in all of this, it will be because of D.J. and the Wonderful People of this forum that gave me moral support.

God Bless All of you.

Mel

#15  

D.J. !!! You are the Son I never had!

Thank You soooooo much. It is Perfect!!!!!!!!

I will use those subroutines to do many more projects.

Mel

:D

Australia
#16  

I've just seen the example in the new EB version. I'm really happy for you Moviemaker, this is what I've been pushing for. I like the fact they have explained a lot of it in the notepad. I think if we all rally together we can get the help we need in a way we can understand it. There is no better way than a good - fully explained example.

.:) :) :)

PRO
Synthiam
#17  

@hazbot, you can find more examples in ARC under File->Examples. Since day 1, examples are documented using the notepad. You have been told nearly 8 times.

Australia
#18  

I'm glad Moviemaker understands the example and it works - that's the main thing. The examples are improving and it would be great if they were catagorised - like a Dictionary or like any data that is referenced in a logical order. eyeroll

#19  

I actually sort of made a list of the Examples and the things that they illustrated. I printed it out and put it in a three ring binder. I didn't save it. But, it was helpful to do that. You can easily do that. Just go down the list and see what you have and make a note on a pad, then type it in and print it out.

thanks for the kind words.

:D