Rob Sim -- Braintech

Hi all,

While both webcam and simulatedwebcam implement the same webcamoperations port, there seems to be a subtle difference between the way the two treat the message types. The simulated webcam requires that the user send an UpdateFrame request before a new image can be queried, whereas afaict the webcam service appears to use UpdateFrame messages to inform subscribers when a new image is ready. The good news is that webcam also appears to ignore UpdateFrame requests, so there's no harm in sending these requests regardless of whether you're partnered with a webcam or the simulator. Am I correct in this assessment

This brings me to my second question. I want to partner my service with a user-defined camera at run-time. My options as I see them:
1. Use a [Partner ... UseExisting] directive in the class definition, and start the webcam in the manifest. This approach works fine if there's only one camera, and it's not a simulated camera (I think it will have some trouble since the simulator may take some time to start the simwebcam service, but I haven't tested this). UseExistingOrCreate has similar issues- connecting to the right camera service is problematic.
2. Programmatically partner with the service by querying the directory. To make this work, I need to communicate to my service which webcam service it should partner with- is there an easy way to pass 'command-line' arguments to my service The only way I can think of is to use an initial state partner. Again, since the simulator may take some time to fire up, I may need to poll the directory repeatedly until the service is available.

You addressed this 'multiple services of the same type' issue here [1]. But in order to make the service user-configurable I need to provide my service with the name of the camera to partner with. Is there a simple way to do this through the manifest

[1] http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1649157&SiteID=1

thanks,
R



Re: Microsoft Robotics - Hardware Configuration and Troubleshooting Differences between webcam and simulatedwebcam, reliable partnering

Omid K. Rad

Yes you are correct about the inconsistency in the way UpdateFrame is used in MultiDeviceWebCam and SimulatedWebCam. This is an issue we discovered recently. Both of them should have similar behaviors so that a client service can talk to them the same way which is the reason of using the generic webcam. I think a better implementation would be to grab and respond with the current frame as soon as QueryFrame message is received, and use UpdateFrame for notifications only.

To provide the name of your partner service in the manifest, you can specify the partner service to be loaded in the manifest and give it a name, and then provide it in the partners list of the partnering service.

Code Snippet

<Manifest
xmlns="http://schemas.microsoft.com/xw/2004/10/manifest.html"
xmlns:d="http://schemas.microsoft.com/xw/2004/10/dssp.html"
xmlns:my="http://schemas.tempuri.org/2007/05/myservice.html"
>
<CreateServiceList>
<ServiceRecordType>
<d:Contract>http://schemas.tempuri.org/2007/05/myservice.html</d:Contract>
<d:PartnerList>
<d:Partner>
<d:Name>my:Camera-01</d:Name>
</d:Partner>
</d:PartnerList>
</ServiceRecordType>
<ServiceRecordType>
<d:Contract>http://schemas.tempuri.org/2007/05/mycamera-01.html</d:Contract>
<d:Service>http://localhost/camera-01</d:Service>
<d:PartnerList>
<d:Partner>
<d:Service>Camera01.config.xml</d:Service>
<d:Name>d:StateService</d:Name>
</d:Partner>
</d:PartnerList>
<Name>my:Camera-01</Name>
</ServiceRecordType>
</CreateServiceList>
</Manifest>





Re: Microsoft Robotics - Hardware Configuration and Troubleshooting Differences between webcam and simulatedwebcam, reliable partnering

Rob Sim -- Braintech

Thanks Omid,

One question: will using a named partner work with the simulated webcam My concern is that the partnership will fail because the simulator takes too long to get started.

cheers,
R





Re: Microsoft Robotics - Hardware Configuration and Troubleshooting Differences between webcam and simulatedwebcam, reliable partnering

Rob Sim -- Braintech

Ok, I gave it a shot with the simulator and it seems ok, but it only gets me halfway there. I can partner a webcamoperations port with a named partner and I'm now working out the details of how to optionally partner with a named webcamserviceoperations port- which I'll need to do only if I'm using a real camera. Could you explain for me the difference between the UseExisting and UsePartnerListEntry creation policies

Given this code snippet:
Code Snippet

[Partner("CameraConfig", Contract=camera.Contract.Identifier,
CreationPolicy=PartnerCreationPolicy.UsePartnerListEntry,
Optional=true)]
camera.WebCamServiceOperations _camConfigPort = new camera.WebCamServiceOperations();



how do I determine whether or not the _camConfigPort successfully partnered

thanks again,
R





Re: Microsoft Robotics - Hardware Configuration and Troubleshooting Differences between webcam and simulatedwebcam, reliable partnering

Rob Sim -- Braintech

To answer my own question, use PartnerCreationPolicy.UseExisting and afaict if the port does not exist then _camConfigPort will be automagically set to null.