loading
 
Multiple Instances
vasant from United States  [15 posts]
15 year
hey ,

I would like to create a separate instance for each of the simulated webcams i have.
what changes do i make to send info from cam1 to first robo instance and from cam2 to second robo instance ?
Also how do i keep track of the getvariable from both the instances ?

In your sample simulation code assuming you have two robots ,i have 2 camentities - entity1= cam1 and entity2 for cam 2  

I have created another service realm1 along with realm.this opens up 2 roborealm instances however it does not communicate with the instance with port 6061 !where do i mention which port is to be used?assuming i have to extend the logic to 2 other cams.

i have read through your forums for multiple instances but i am unable to make it work.
Anonymous 15 year
Hi,

I assume you are talking about the MSRDS services?

We have updated the 2008_Express.zip file to include a configuration right at the start of the service to specify the hostname and port number for the API. You can re-download this file at

http://www.roborealm.com/downloads/MSRS_2008_Express.zip

and see the section

            realm.SetCaptureRequest req = new realm.SetCaptureRequest();
            req.captureImage = false;
            req.captureVariable = true;
            req.Hostname = "localhost";
            req.Port = 6060;
            _realmPort.SetCapture(req);

which is used to config this information. Naturally you would change that for each instance you need to communicate to.

Also note that the simulation.robo file was a little off so we updated that too.

http://www.roborealm.com/help/Simulation.php

Thanks for the donation!

STeven.
vasant from United States  [15 posts] 15 year
hey,
i am using the academic version of Robotics Studio. does your change support it ? i am getting error where it says the proxy does exist in the namespace 'roborealm',and also im getting a few errors on the webcam proxy as well for webcam state-C# says it does not exist in namespace.

the last time around as well i had to re-add the services as it could not find them itself.

thanks

Vasant
vasant from United States  [15 posts] 15 year
ok..false alarm !! i am using the current interface.dll with older code to make it work.and i can change the ports !
thanks a ton ! :)

vasant from United States  [15 posts] 15 year
hey steven ,

sorry to trouble you again !.

I have tried changing ports individually and it works !. however when i try to start 2 instances i cant see any image on the roborealm.
this is setting for the first robot
realm.SetCaptureRequest req = new realm.SetCaptureRequest();
            req.captureImage = false;
            req.captureVariable = true;
            req.Hostname = "localhost";
            req.Port = 6060;
            _realmPort.SetCapture(req);

setting for the 2nd robot wld be -
realm1.SetCaptureRequest req1 = new realm1.SetCaptureRequest();
            req1.captureImage = false;
            req1.captureVariable = true;
            req1.Hostname = "localhost";
            req1.Port = 6061;
            _realmPort1.SetCapture(req1);
and define -using realm1=roborealm.proxy.. and start partner services for realm 1 defining  _realmport1 and _realmnotify1.

is this approach right ?

thanks for your help !

Vasant
Anonymous 15 year
Yes, that seems correct. Note that you'll have to duplicate all entries for the _realmPort including in UpdateFrameHandler

                                _realmPort.SetFrame(newFrame);

which would then be

                                _realmPort.SetFrame(newFrame);
                                _realmPort1.SetFrame(newFrame);

for you. Perhaps try with one instance only, ensure that that is working and then add the second.

When you say that the image does not work is that the case for both instances? Or just when running both?

Note that if you are setting RR for the same image there are easier ways to do this ... the base assumption we are making is that two versions of RR are being used to process two different images ... is that correct?

STeven.
vasant from United States  [15 posts] 15 year
thanks for your prompt reply !

i have multiple robots following this main robot.also the main robot wld have to find these other agents through vision as well as lead them out to safety.so i thought of using an instance instead of a marker,as they each have different images to process.

well it works when i run only port 6060.however when i run both simultaneously i dont get any image on roborealm.I have changed _realmport at all locations. I thk somewhere the 1st instance is messing with the 2nd.As i did not understand the updateframe handler class i just made logical extensions to your code.
I made modifications to your code to learn and am attaching it here.

thanks for your time !

Vasant
RoboRealmSimulation.zip
vasant from United States  [15 posts] 15 year
hey ,

i have been at this for last cpl of hrs..and i thght maybe i shld add new webcam entities webcam1 and webcam2 so that i have unique updateframehandlers update frame1 and updateframe2 ,along with getvariable1 and getvariable2. The thg is it works fine for the 1st port,how ever nothing happens when i try to run them together or only the 2nd instance alone. ! oh and also i get a out of internal memory dialog box in C# when i run the code.
fyi my goal is to just add another legonxt robot and make it go to the yellow cone in the simulation ,however it processes it in a different instances.

thanks for your help.I have a feeling at this rate i wld owe you a dinner by the end of next week :)  

Vasant
vasant from United States  [15 posts] 15 year
hey steven

I thk i knw what the problem is . since i am using 2 webcams and 1 update handler service, i need to differentiate between the 2 webcams. Do you know how to do that in MSRS ?
Anonymous 15 year
Vasant,

You had some old copies of earlier Interface.cs dlls in your file that you included. Just to be sure that the RR api is operating correctly in multiple instances we've updated the

http://www.roborealm.com/downloads/MSRS_2008_Express.zip

with a MultipleInstanceSimulation project which loads in two Lego NXT robots and expects that two instances of RR are running one on port 6060 and the other on 6061 with the simulation.robo program loaded.

Note that simulating many robots will slow down your computer and increase the visual to motor feedback loop. This makes the robots seem somewhat loopy and can cause them to crash into the yellow cone since their motor commands are lagging behind the visual image. You'll need a fast computer to run this reliably. Note that they will also crash into each other since no obstacle avoidance other than the cone is implemented. (cool to watch!)

Hopefully this gets you further along.

STeven.
vasant from United States  [15 posts] 15 year
awesome..you guys are the best ! thanks .
vasant from United States  [15 posts] 15 year
hey, i am sorry for getting back to you guys so late , i am still getting errors when i run the code and i feel its a problem with interface proxy file. initially i had used the academic studio version ... then later i thght maybe it wasnt compatible, so installed the express version and ran the code as per the procedure in the simulation help page(i copy pasted the new batch of dll files in to bin folder,and the manifest in config).it executed but i got the follow error and no simulation.

*   Service started [03/15/2009 17:42:35][http://vasant:50000/directory]
*   Service started [03/15/2009 17:42:35][http://vasant:50000/constructor]
*   Service started [03/15/2009 17:42:35][http://vasant:50000/console/output]
*   Starting manifest load: file:///C:/Documents and Settings/Administrator/Micr
osoft Robotics Dev Studio 2008 Express/samples/Platforms/RoboRealm/Interface/Int
erface.manifest.xml [03/15/2009 17:42:35][http://vasant:50000/manifestloaderclie
nt]
Rebuilding contract directory cache. This will take a few moments ...
Contract directory cache refresh complete
**  Error creating service. Service type:http://www.roborealm.com/2008/12/interf
ace.html [03/15/2009 17:42:38][http://vasant:50000/constructor]
*** Service creation failure most common reasons:
    - Service contract identifier in manifest or Create request does not match C
ontract.Identifier
    - Service references a different version of runtime assemblies
    - Failure to load referenced assemblies (not found in binary folder or unabl
e to load types)
    Additional information can be found in the system debugger log.
[03/15/2009 17:42:38][http://vasant:50000/manifestloader/c2fcc423-324d-456c-9a2
5-1a68d8484ef0]
*   Manifest load complete [03/15/2009 17:42:38][http://vasant:50000/manifestloa
derclient]

As you can guess .i am new to MSRS , the problem might be trivial but i have no clue on what to do !
I am currently developing robot behaviors based on vision on Roborealm with a single instance and its awesome !

thanks for all your help steven and sorry for bothering you on a sunday !

Vasant




vasant from United States  [15 posts] 15 year
hey ,


yay ! i finally got it working !

i knew that you guys would have def tested the code..and the prob was with interface proxy file..so i build the interface file first and then used dlls..or atleast i hope i did that ..but well it works ! i dont know y it wasnt finding the proxy file initially itself even thgh i copied pasted it in the bin folder...
any now im on to using roborealm finally..
and sorry for all trouble caused :) !

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