loading
 
Distributor client, transmitting variables
from Australia  [87 posts]
9 years
I am using the image distributor server module to transmit an image and variables, which gets processed by the client module. This works just fine.

I would like the client module to return some variables back to the server, but I cannot get it to do so. So I have selected the three options: receive variables, receive images and send variables. I do recall that in the previous RR versions it did return variables, sometimes. It does not make any difference if the variable is declared inside the client module statement.

Can you please check in your lab if you come up with the same problem.

Thanks alot,
Nemanya
Anonymous 9 years
Nemanya,

We double checked the module and the variables appear to be getting sent back and forth correctly. Note that from the client point of view the image and variables are requested, processing within the distributor_client and end_distributor_client module happens, and then the image and variable is sent back to the server.

The issue that we often deal with is when variables collide on the server or client side if they have the same name. Would it be possible to include two posts with the client and server side robofile that you are using to test this issue? We have tried various combinations but are not able to replicate your error. Be also sure to have downloaded the most recent RR copy (perhaps that is what you did and what has caused the errors?).

Thanks,
STeven.
from Australia  [87 posts] 9 years
Hi Steven,

Here is the server file. I believe that it might be something with the server module being within an if statement.

I'll send you the client file in the follow up post.

Cheers,
Nemanya
program.robo
from Australia  [87 posts] 9 years
Here is the client file.
program.robo
from Australia  [87 posts] 9 years
Hi Steven,

Have you had a chance to look at the rr files I sent you? I am not sure, but the problem might be that the server module is within an if statement which is accessed only once a second. So it might be missing the packets of information sent by the client module.

Cheers,
Nemanya
Anonymous 9 years
Nemanya,

Yes, that is a possibility. I'd keep the distributor server outside of any if statement. I'm not sure it really helps to keep the server within an if statement.

At any rate, that is most likely not the problem. We noticed in your client robofile that the end_distributor_client tag is missing. This was caused by a bad earlier version that eliminated this tag. When this tag is encountered RR will use it to trigger the variable send back to the server. (It uses the first Distributor tag to grab image and variables FROM the server). So without this tag the client will never send back image or variables to the server.

The quickest way to fix this is to directly edit the client robofile in a text editor and then paste

<End_Distributor_Client/>

at the end of the file. Reload that in the client RR and that should hopefully do the trick!

Sorry for the delay ... sometimes business takes priority :-)

STeven.
from Australia  [87 posts] 9 years
Steven, you're right about the missing 'end_distributor_client' part. I didn't expect it to go missing.

Now that I do get the variables back to the server, there seems to be a clash when both 'request' and 'send variables' are active, even though the client program does not do anything to the variables.

The server program (attached) has a bi-stable variable 'sample_latch' that just changes between 1 & 2. When the client program has 'request variables' and 'request image' selected, everything works fine. But when the 'send variables' is also selected, the 'sample_latch' stops changing.

Attached is a really simple demo for what I mean.
program.robo
from Australia  [87 posts] 9 years
And here is the client program which is just the 'client modules' and 'watch_variables'
program.robo
Anonymous 9 years
Nemanya,

Have a look at v1.8.23.35 as we have made adjustments to the distributor system to better sync the messages. We also noticed a couple other problems that were fixed. Your robofiles appear to work ok. Can you try it out and see if you get the same results?

Thanks,
STeven.
from Australia  [87 posts] 9 years
Steven,

The robofiles work fine when sending & requesting images, but it does jam up when both sending & requesting variables are selected.

Have a merry xmass and enjoy the holidays.

Nemanya
Anonymous 9 years
What do you mean by jam up?? Does the image processing just stop? Do the variables overwrite each other??

We tested with sending and requesting both images and variables with no issues.

Are you using exactly the same robofiles as before?

thanks,
STeven.
from Australia  [87 posts] 9 years
Well the sample_latch variable, in the server, stops changing once the request and send variables options have been selected in the client.

Yep, using the same robofiles.

Cheers,
Nemanya
Anonymous 9 years
Nemanya,

Can you double check those results with 1.8.23.37 with the above robofiles? We've tested those files and see the simple_latch variable change as would be expected.

Thanks,
STeven.
from Australia  [87 posts] 9 years
Steven,

I've tried it again but the same happens. Make sure that the client program has both the 'send variables' and 'request variables' ticked.

The server program (attached) shows under 'watch_variables' that 'sample_latch' changes regularly from 1 to 2 and back. But when the client program has both 'send..' and 'request variables' selected the value starts flickering between 1 & 2 like crazy, as variable from the client  program interfere with the one from the server program.

Is it possible to have the server variables and client variables differentiated by some ID. e.g. 'sample_latch' from the server gets sent to the client, which automatically returns it with all the other variables. Is it possible to concatenate a client number or something onto the returning variables, e.g. "sample_latch_c01".

This should remove the interference of data between server and the client.

Thanks,
Nemanya
program.robo
Anonymous 9 years
Nemanya,

Ok, we used the original files and made these modifications:

1. Added end_distributor_client tag at the end of the client robofile.

2. Moved Distributor_Server OUT of the if statement in the server robofile.

3. Edited Distributor_Server and checked the Sync checkbox.

I think you are probably missing #3. Normally the distributor server will not wait for the client to complete processing and will continue in the pipeline. Checking the checkbox will force the server to wait. This also ensures that the variables are received correctly. Without this checked we get your symptoms, with it checked we don't.

Note that if you wish to rename variables you can use the Set_Variable module to rename variables into other variables by setting their values into a new variable. Perhaps some combo of this would do the trick if #3 above does not work.

STeven.
from Australia  [87 posts] 9 years
Thanks a lot Steven. The third point was the crucial one.

Have a great new years.

Nemanya
from Australia  [87 posts] 9 years
Hi Steven,

My client program uses the MOUSE_CLICK_X and MOUSE_CLICK_Y variables to calculate and send the results back to the server program.

However this takes us back to the original problem with the exchange of variables between server and client. I cannot use the mouse click variables in the client program outside the client statements, as the server overwrites them with the server mouse click variables.

This seems to again point to the need to have each variable name extended with the program number or some unique distinction from another instance of RR. This would make allow one to have a server and a number of clients where there is no confusion of variables.

Or at least to be able to select what variables are sent and which are received?

Cheers,
Nemanya
Anonymous 9 years
Good point. For the immediate need you should be able to use the Set_Variable module to name the Click variables to something different that the server will not know and thus will not overwrite. Can you try that and see if it works for you? I.e. add a set_variable module to the client.

STeven.
from Australia  [87 posts] 8 years
Hi Steven,

Are you planning on adding the varibale selection feature to server/client modules?

So to be able to select what variables are sent and which are received? Just to eliminate the potential cross communication issues.

It would really take my program idea out of a deep freeze.

Cheers,
Nemanya
Anonymous 8 years
Yes, this has been added. Please download the new version and see the distributor client interface. Note that you will need to update all instances of RoboRealm as the addition has required changes to the client and server sides.

Hopefully this will help thaw out your project!

STeven.
from Australia  [87 posts] 8 years
STeven,

It works like a charm. Now I just need to find some time to put into actually making the robot behave as it should! hahaha

Cheers,
Nemanya

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