AVM Object Recognition
from Canada  [6 posts]
7 years
When I use the AVM plugin I, having problems accessing the variable NV_ARR_OBJ_IDX. I'm trying to get RoboRealm/AVM to recognize 2 (or more) objects and speak their name. All is fine with the recognition part and their name is displayed properly in the AVM  display as well as their IDX number. However any attempt to   use the If.. statement to speak either name properly always fails and it either speaks only the first name (of two objects) or speaks it when the object is not visible.  

Can't figure out why the logic in the If...then statement is not working.
Like: If NV_ARR_OBJ_IDX = 0 then speak First Object
and the a second If statement:  
If NV_ARR_OBJ_IDX = 1 then speak Second Object.

I'm using the latest version 2.29.2
EDV  [328 posts] 7 years
The variable NV_ARR_OBJ_IDX is array.
You should use VBScript for this task:

TotalObj = GetVariable("NV_OBJECTS_TOTAL")
ObjIdx = GetArrayVariable("NV_ARR_OBJ_IDX")

ReDim ObjName(20)
ObjName(0) = "1"
ObjName(1) = "2"
ObjName(2) = "3"
ObjName(3) = "4"
ObjName(4) = "5"

SpeakStr = "I see"

for i = 0 to TotalObj-1 step 1
SpeakStr = SpeakStr + " " + ObjName(ObjIdx(i))

if TotalObj = 0 then SpeakStr = SpeakStr + " nothing"

SetVariable "SPEAK_STR", SpeakStr

See also attached Speak_Objects.robo file.
from Canada  [6 posts] 7 years
Yes! That works great.

Thank you very much.
I wouldn't have considered using VB Script.


This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index