loading
 
Socket extension: protocol for arrays
Texx from Austria  [8 posts]
14 year
I need to send the BLOBS and the MER_COORDINATES array to a robot via socket extension, but I don't know how the arrays are sent. I have no problem with single values like width or height. I have just a problem with receiving arrays.
It would be great if somebody can help me.
Anonymous 14 year
Texx,

The arrays should be send as a four byte sequence of numbers using the Socket plugin. This is similar to the single valued width and height but will just have more of them in a single name/value sequence. I.e. width and height will be of size 4 but the MER_COORDINATES will be a multiple of 4, eg. 8 or 16 or etc depending on the number of MER_COORDINATES.

Are you receiving something different in the plugin/extension?

STeven.
Texx from Austria  [8 posts] 14 year
This is exactly the problem. Instead of the lengh of the value of the arrays I get values like this:

604034248
604035272
604036296
...

but I'm sure that this variabe consists out of 2 values and can't be longer than 20 characters.

This only happens if an array is sent.

This is the result I get in my c++ programm:

Processing 1
1: 4 name 14 Socket_Program
2: 13 MOUSE_CLICK_X 3 209
3: 15 IMAGE_PROCESSED 2 64
4: 18 POWER_LIFE_PERCENT 3 100
5: 6 Farbe4 1 0
6: 20 COLOR_SAMPLE_NEAREST 0
7: 6 Farbe2 1 0
8: 12 POWER_DEVICE 2 AC
9: 5 count 1 1
10: 16 MOUSE_CLICK_TIME 10 1256664546
11: 24 COLOR_SAMPLE_NEAREST_RGB 0
12: 7 Winkel3
13: 7 Winkel1
14: 5 COG_1
15: 15 MER_COORDINATES
16: 5 COG_3
17: 12 PROCESS_TIME 2 15
18: 11 IMAGE_COUNT 2 64
19: 10 IMAGE_TIME 8 0.000000
20: 13 MOUSE_CLICK_Y 3 336
21: 14 IMAGE_FILENAME
57 C:\Users\Christoph\Pictures\Logitech Webcam\Picture 8.jpg
22: 12 IMAGE_HEIGHT 4 1200
23: 6 Farbe3 1 0
24: 6 Farbe1 1 1
25: 3 FPS 0
26: 7 Winkel2
27: 23 COLOR_SAMPLE_CONFIDENCE 0
28: 12 COLOR_SAMPLE 6 3E3730
29: 5 COG_2
30: 15 POWER_LIFE_TIME 2 -1
31: 7 Winkel4
32: 5 COG_4
33: 5 BLOBS
34: 16 COLOR_SAMPLE_RGB 10 62, 55, 48
35: 12 POWER_CHARGE 4 HIGH
36: 11 IMAGE_WIDTH 4 1600
37: 5 width 4 @♠
38: 6 height 4 ░♦
39: 5 image 5760000 ░♦
40: Processing 2
1:
Disconnected.

COG_1 to 4, Winkel1 to 4, BLOBS and MER_COORDINATES are arrays.


Texx from Austria  [8 posts] 14 year
I forgot to write that I get this result only if I skip to receive the value of all variables were the length of the value is bigger than 10 000 000 otherwise the programm crashes at 12:

thanking you in anticipation
Texx from Austria  [8 posts] 14 year
Sometimes the length of the value looks like this:

...
12: 7 Winkel3 -590297916
13: 7 Winkel1 -590297916
14: 5 COG_1 -590297916
15: 15 MER_COORDINATES -590297916
16: 5 COG_3 -590297916
...
25: 7 Winkel2 -590297916 0.7
...
29: 5 COG_2 -590297916
31: 7 Winkel4 -590297916
32: 5 COG_4 -590297916
33: 5 BLOBS -590297916
...
Anonymous 14 year
Texx,

Thanks for the description. We found the issue ... a fix will be up in the next couple of hours. Indeed, the problem is with arrays in that they were not sending the correct array via the socket plugin. I'll post again when the fix is live.

Thanks!
STeven.
Anonymous 14 year
Texx,

Please download version 2.10.7 which has that fix.

Also, there is a minor error in the socket example plugin. The line

    if (len>DATA_BUFFER)

in the ProcessVariable function should read

    if (len>=DATA_BUFFER)

note the inclusion of the '='. You may also want to up the DATA_BUFFER define to something much bigger than 1024 otherwise you may skip over some of the larger arrays.

Let us know if this helps ...

STeven.
Texx from Austria  [8 posts] 14 year
Thank you very much STeven!

and thank you for the fastest support I've ever seen.
This update fixes all problems. Now I receive the right length of value and the right data.

Texx

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