View Single Post
 
Old July 9th, 2011, 09:02 AM
cevripidou cevripidou is offline
Registered User
 
Join Date: Jul 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help needed subscribing to simulated compass

Hello,

I'm working on a project that involves using machine learning on the Lego Mindstorm NXT robot. Basically, I need to use the simulator in order to obtain the learning data by "letting the robot loose" through a few hundred episodes.

For the time being the robot can receive inputs solely from a color sensor. This works fine both in and out of the simulator. Now, I want to add a compass sensor to the robot. I'm having problems doing that. On the robot side (not simulation) of the code, I have the following:

Code:
using compassVirtual = Microsoft.Robotics.Services.Simulation.Sensors.Compass.Proxy;
Then I try to create the partnership with the compass, but it does not have CompassSensorOperations, like the physical compass available, so I used:

Code:
        [Partner("Compass",
            Contract = compassVirtual.Contract.Identifier,
            CreationPolicy = PartnerCreationPolicy.UseExisting,
            Optional = false)]
        compassVirtual.CombinedOperationsPort _compassSensorPort = new compassVirtual.CombinedOperationsPort();
        compassVirtual.CombinedOperationsPort _compassSensorNotify = new compassVirtual.CombinedOperationsPort();
Apparently this is wrong as I can't subscribe to the service. Also, if i ignore the subscription, and just run the code it just connects to the color sensor as it used to, and then it just waits.

Note that I added references to SimulatedCompass.Y2008.M11 and SimulatedCompass.Y2008.M11.Proxy.

Basically what I want to do, is to subscribe to the compass to use in the simulator and get frequently readings from it.

Can I please get some help with this?