United Kingdom
Asked — Edited

Using Scripts

Hi guys, so i have a quick question regarding scripting, basically im trying to make some kind of maping code with ARC, for some reason the sonar scan module doesnt work to well with my robot but thats another story, what i wanna know is

1 - can i jump to another script from within a running script and then back again , ie if i made a simple script for forward motion i could include some kind of sub script to check the ping sensor and if nothing is within range jump back to the origional script and carry on ?

2 - from within a subscript can i use ie, if(D1 < 10 goto (another script) )

3 - can i save a value somewhere or somehow , ie move sonar servo left, save value then move right and save value then figure out which way is best ?

I know its basically what the sonar sweep does but like i said that doesnt work to well on my omnibot, he senses something then just spins around in a circle, also i would rather do it with scripts so i can add in other variables and sounds etc etc.

Hope that makes sense

Thanks Kurt


ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.

PRO
Synthiam
#1  

If he's spinning in a circle, the Turn Delay is set too long in the radar scan.

If you post your EZB Project File in this thread, I can take a look at it for you.

As for scripting, you can't call another script control and "wait" for it to finish. What you can do is embed many "modules" in the script control. Check out these commands: LABEL, GOTO and RETURN

There will be assignable variables in the script in a few releases. I currently have a partial version working. But that won't be for a bit.

There's another version of ARC, EZ-SDK and EZ-B Firmware tomorrow that I have been working on this weekend. It has some neat new goodies:)

United Kingdom
#2  

Sounds good DJ, i like goodies :-) so i will post my ez b file on here later on when i get home and have access to it, never thought of the turn delay, its a bit of figuring out because im using the sabertooth h bridge, there are some basic basic script i have written to control the sabertooth, then added them into the movement control script, only by doing this does the modified servo Movement Panel work, if i dont have the movement script pane set the modified servo Movement Panel doesnt work, i guess the sabertooth has a different threshold than the ez b modified servo panel uses. for example the movement pane works but the speed setting makes no difference, also another slightly annoying thing is every now and then the sabertooth just fires up and starts moving the bot by itself, mostly when the ARC is not connected to he ez b board, maybe the ez board resets its servo ports to a value that the sabertooth interpretates as a command, anyway this is just me rambling on, i will post my ez file then you will see what i mean.

Thanks Kurt

United Kingdom
#3  

Ok so please find attached, my ez b file, if i use this file my bo just spins in circles if he senses something, and sometimes if i just set him off, without the sonar section it works fine, apart from setting of on his own sometimes if im not connected by bluetooth. i think that has something to do with the sabertooth sensing some strange readings from the ez b board, i wondered if when im not connected does the ez b set the ports im connecting the sabertooth to as stop which in my case is a reading of 35 or ??? if so is there any config files i can change to sort this out, its not a major issue but just means i cant leave him turned on without being connected..

Regards Kurttest sonar omnibot.EZB

Australia
#4  

Your programming is looking pretty good. Just a script related things that you can fix:

You have three scripts in the bottom right corner- Head Centre, Head Left and Head Right, all of which can be started by using the joystick or speech recognition. All three of these scripts have only one command. This means that instead of starting the script by pressing a button you can just write that single command in the Button Down/Up collumn e.g. Servo(D1, 35)

This is the same with Speech Recognition

I know this is not quite related to your question. Hopefully it helps anyway

PRO
Synthiam
#5  

Are you getting correct distances with the ping sensor? Meaning, is it connected correctly?

Also the camera control has both movement and servo tracking enabled. If you reference my wall-e big example. You can see that I set the tracking mode by commands. That way it doesn't try to do both all the time. Part of your issue is related to camera servo and movement tracking.

Start with a simple project that just has radar and a movement panel. Do you still experience the same issue?

United Kingdom
#6  

okies i will give that a try and let you know, if i just disconnect the camera panel and run the scenario i presume thats the same thing.

Thanks alot Kurt

United Kingdom
#7  

sorry one othe thing DJ, i have noticed (if you look at my ezb file) hmm how to explain this one, so .... i have setup scripts for basic movement because im using the sabertooth motor controller, i have also setup the Movement Panel module to reference those script ie forward, stop etc etc, im wondering if because im not using the modified servo movement module, or the H bridge movement panel, does the sonar tracking use those movement modules or will it run ok just using my scripts? it seems like it goes forward, sees an object, turns to avoid it but just never stops turning, ie it doesnt move forwards again, just keeps calling for left etc etc,

Regards Kurt

United Kingdom
#8  

Mmmm this is complicated I think the spinning is caused by the movement script panel left and right commands should reference your nudgeleft and nudgeright scripts. The other left and right scripts would just make it turn left and right until you stopped it

What sabretooth controller are you using?

#9  

DJ, I went to down load the "If you reference my wall-e big example" and it does not appear to be there any longer. Where have you hidden it??

PRO
Synthiam
#10  
  1. Launch ARC

  2. Select File

  3. Select Examples

  4. Select Robot - Wall-e Bit

  5. Smile