locked
Unable to connect to robots and drive them. RRS feed

  • Question

  • Hey,
    I can't manage to connect any of the bots that I add to the drive port. 
    I connect to the drive port with:
            private drive.DriveOperations _simulatedDifferentialDriveServiceNotify = new drive.DriveOperations();
     
            [Partner("SimulatedDifferentialDriveService", Contract = drive.Contract.Identifier, CreationPolicy = PartnerCreationPolicy.UseExistingOrCreate)]
            private drive.DriveOperations _simulatedDifferentialDriveServicePort = new drive.DriveOperations();
    
    
    and then when I create my bots with 
                            Pioneer3DX Creature = new Pioneer3DX(pos);
                Creature.EntityState.Name = "Creature" + numberID;
                CreateService(drive.Contract.Identifier,
                                Microsoft.Robotics.Simulation.Partners.CreateEntityPartner("http://localhost/" + Creature.EntityState.Name)
                              );
                postToVSE(Creature, false);

    I can't control them at all- not even with the simple dashboard (which I partnered with). I know I have to connect them to the drive port, but I am not sure how to do that, I can only get them to appear in the simulation. Once I connect to the drive port I know how to programmaticly drive them, but I need to be connected first. As well, does each robot need it's own drive port to send commands on, or is there a way to distinguish between who receives the command from one port.

    The two errors that I get consistently are:

    Partner service enumeration failure. Partner Name: LeftMotor

    Partner URI resolution failed. Partner field name:_simulatedDifferentialDriveServicePort

    For now I just want to connect and drive the robot programmaticly (with very little functionality other than driving in random circles)

    My code adds many robots- So I would like to avoid using the manifest to declare them.

    Tuesday, December 3, 2013 3:23 AM

All replies

  • Hi, jra59

    The code sample is too short and fragmented, but:

    1. If you dynamically create entities and services for them there is no use in statically created and connected _simulatedDifferentialDriveServicePort. In fact, if no URI resolution error,  you'll get: your service starts, tries to find partners, waits for partners enumeration timeout, finds no any DiffDrives, creates one, which is in control of nothing, and then continues with your code, where eventually creates some other diff drive services. I have no idea what is URI resolution error. Wrong contract id?

    2. One entity in simulator - one simulation service. Simulation service controls only one entity, it tracks only one entity name insertion/removal to simulation engine. So you need to create sim service for each created sim entity.

    3. Once you created service dynamically (I've never done it, but your code looks well) you can get its port via ServiceForwarder method. It gets service Uri as an argument, which you can acquire by listening on the return port of CreateService.

    Hope that helps.

    Friday, December 6, 2013 8:20 AM
  • Hey Matvey,

    Thank you for your reply- the timing was unfortunate though since I had my Presentation/Demonstration a few hours after your post this morning, so I was dead asleep by the time your reply came in and didn't have any time to make changes. I still appreciate the reply, and I think you're on the right track- so I will reference your answer in my final write up. 

    My demonstration went well, I did eventually connect to my differential drive entities, although I was never able to resolve either of these errors (It  was a little awkward when I launched my program and got 250 "Partner service enumeration failure. Partner Name: LeftMotor" errors).

    My contract ID's are all declared pulling them directly from the single definition of one, and even a macro to make sure it is copied directly the same into the manifest, so I am not sure what went wrong there either.

    My simulation uses a kinect for voice readings, and I am relatively certain that the reason my Kinect bombs out occasionally is when it tries to connect to the _simulatedDifferentialDriveServicePort and is unable to get any response from it (or someone mentioned after my presentation that the Kinect may just be running out of internal memory). 

    I know that this post doesn't really give you any information that is relevant to you - or anyone else's development - but I figured I would give you a quick response/wrap up and say thank you. 

    - Jake

    Friday, December 6, 2013 5:28 PM