Help with Blob Array
Ian Drennan from South Africa  [9 posts]
10 years
I am wanting to read the blob array and assign variables using VBScript. So far I am only able to read in 8 blob variables using the following script. It would appear that the blob array  has only 8 subscripts ( 0 to 7)

The blob filter identifies 6 blobs in my image. I need to get the coords of all 6 blobs.

How do I go about reading all 12 coords of the 6 blobs?



This is the script I am using:

Blobs = GetArrayVariable("Blobs")

SetVariable "T1_x", blobs(0)
SetVariable "T1_y", blobs(1)
SetVariable "T2_x", blobs(2)
SetVariable "T2_y", blobs(3)
SetVariable "T3_x", blobs(4)
SetVariable "T3_y", blobs(5)
SetVariable "T4_x", blobs(6)
SetVariable "T4_y", blobs(7)
Blobs array
10 years

Is it possible to include the image you are using and an example robo-file that you are using to process the image? The blob array should be capable of dealing with a maximum of 500 coordinates so I suspect that the blob filter may not be set to allow more than 4 objects to pass through the filter (check the "Select Top X objects" in the Blob filter.

You should be also able to see all the numbers if you insert in the Statements->Watch Variables module. Do you see the blobs array contain more than 8 values?

Ian Drennan from South Africa  [9 posts] 10 years

Thanks for your prompt reply.

I have attached the current image,  the image of the blobs filter and the RoboFile.

The filter is set to show 6 Blobs and yes I can see the 12 variables in the Watch_Variables module.

If however I try and access a subscript higher than 7 I get the vbScript error ' subscript out of range'.

Some hours later and a few hours sleep:-

After I changed the name of the receiving Array to Targets as opposed to Blobs which I had previously,  I can now read and assign all 12 coords. It would seem that there might be some name conflict when using the name 'Blobs' for the receiving array.

A further question please.

As you will see from my RoboFile, I am continually transmitting  4 derived CofG variables to a PC using the serial module. In order to get the most speed with RR 's processing of the other modules, the blob filter is conditionally switched in (infrequently) when the variable PC_Code  = 2. Ideally I  only want to transmit the 12 Blob coords ( without sending the other 4 CogG variables) after the the blob filter has been processed.

What is the best way to do this?   I had thought of exclusively switching a second Serial Module but don't know if this is accepted practice for reliability.


Serial Module
10 years

Thanks for the tip on the naming of the array. We'll have to investigate why naming the array blob causes a problem. It seems that the variable space and the defined variables are overlapping in some way which should not be happening.

Anyhow, back to your current question:

Adding in a second serial module will probably not work as one module will capture the com port and the second will not be able to since the first one is still active and will refuse all other connection attempts.

Once possibility is to just transmit all variables at once.

The other possibility is to use the VBScript module to build a string that will contain the values that you are sending over dependent on if the PC_Code is 2 or not. In that way the serial module will always transmit the same variable but the contents of which will change depending on other factors.

For example, your serial module would just transmit:


and the VBScript would be something like

if GetVariable("pc_code") = 2 then
  SetVariable "data_to_pc", "X" &_
    GetVariable("Red-Y") & "#"
  SetVariable "data_to_pc", "T1_x" &_
    GetVariable("T1_x")& "#"
end if

or something to that effect ... you could even use your current VBScript module to do this.

Ian Drennan from South Africa  [9 posts] 10 years

Thanks for your suggestion of sending a selected packaged string with a generic name.
This method is preferred rather than sending all the data every time, as my VB6 Navigation App on the PC needs to finish processing the previous data
before the next packet of strings arrives from RR.

I found that if I did send all the data variables every time, then my Navigation program would start behaving abnormally. Or more accurately my Robot developed a mind of its own!  I suspect this was because procedures in the VB program were being interrupted by the new data arriving from RR. Maybe it is time to upgrade to a faster PC.

Incidentally I have RR running on my faster laptop so as to speed up the image processing.

Your help is much appreciated


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