
Hey guys.
I need a little help with some script. As the title suggests, I'm trying to get an EZ Builder script to speak an identified object using RoboRealm. It is all set up and passing variables to EZ Builder, and I have a couple of objects trained, but I'm having trouble writing a correct script. Here's what I've got so far...Code:
if($RR_NV_ARR_OBJ_NAME[0])
say("Steve")
elseif($RR_NV_ARR_OBJ_NAME[1])
say("control")
endif
I would be grateful for any help with this to get me started.
Thanks.
It would be easier that way as I would not have to rewrite everything that was tried in it.
I want to have EZB say the name of the object that RoboRealm has detected.
First off (if you see this) thanks David for the great video about setting up RoboRealm it helped me a great deal.
Where to start ...
I have 3 different items detected by RoboRealm.
The variable ($RR_NV_ARR_OBJ_Name) does show in the variable watch list in EZB.
Have tried all the scripts that were mentioned in this post and none seem to work for me.
I must be missing something easy but can't seem to figure out just what it is.
Any help would be greatly appreciated.
It may be an hour or so.
Thanks
David
Code:
This can run by itself and just loop. it will say the name of the object when the name of the object changes. The variable initialization in the first line could be moved to an init script that launches when the robot first starts up. This is there because the script will probably fail if you haven't yet launched RoboRealm to identify an object yet as the variable wouldn't exist yet. Once RoboRealm has been launched, the variable is initialized and set by RoboRealm so it wouldn't be needed anymore. This is why it is outside of the loop.
The WaitForChange line will wait for the object name from RoboRealm to change before it continues so you shouldn't have to worry about this script consuming many resources.
If this script fails, please send me the error message it returns.
Thanks
David
Yes there is a [0]
#Replace $RR_NV_ARR_OBJ_NAME with the name of the variable in all of the lines below.
$RR_NV_ARR_OBJ_NAME[0] = ""
:startofloop
waitforchange($RR_NV_ARR_OBJ_NAME[0])
#use Say or SayEZB in the next line
Say($RR_NV_ARR_OBJ_NAME[0])
goto(startofloop)
I still must be doing something wrong or miss understanding this.
Can you give me a example, say with the variable name of "box".
I have been getting nowhere ... lol
Thanks
This is the code that I am running without any issue. This will say the value of the first item in the array. Roborealm can identify a lot of objects so it is possible to have more items than just the one in position 0. These would be 1 and up. Can you see the value of the variable changing as you show the camera different objects? If the original object is in the view of the camera, it will hold position 0 and the new object will get position 1. if the old object is not in the view of the camera any longer, the new object will be in position 0. It would be possible to modify the code to say the name of multiple objects but we need to get it saying the name of one of them first.
Code:
Another option is to connect to your robot from your main machine, but my assumption is that roborealm isnt installed on this computer so it wouldnt work. If it is on your main computer, I could connect and check it out from start to finish for you.
Sent you a email.
say("Steve")
elseif($RR_NV_ARR_OBJ_NAME[1])
say("control")
endif
The code mentioned in the previous post isn't what should be used and is not good code. It won't do what you want it to do.
This code is working code that allows the name of the object, as specified in RoboRealm to be said. There is no need to do what is being done in the code above.
Code:
The script you supplied in post #34 was copied from what I originally posted in post #1. This script, as already mentioned by others and tried by the poster, does not and will not work. That is the reason why I started this thread, so I could get the correct script from somebody and compair where I went wrong to help others facing the same issue. 10 out of 10 for your willingness to help which is great, but be sure any advice you offer is tried and tested and correct. My advice for what it's worth is to study the tutorials in depth and learn what ARC has to offer. That way you will have great fun building and controlling robots and you will become a great asset to the community.
@Herr Ball.
Sorry I couldn't reply to you sooner to offer some help. I've been away from the forum for a while dealing with life's little problems it seems to be throwing at me at the mo. I'm pleased David got you sorted out and you finally got it working.