locked
Building a service for a HiTechnic prototypeboard. RRS feed

  • Question

  • So I am building a service for the HiTechnic prototype board (by the way I am way out of my league here but I have managed to get the service working - well connecting). At the moment it implements PortSet<DsspDefaultLookup, DsspDefaultDrop, Get, ConnectToBrick> and I created "public class I2CReadHiTechnicPrototypeBoard : nxtcmd.LegoLSWrite" and "public class I2CResponseHiTechnicPrototypeBoard : nxtcmd.LegoResponse". In my connect to brick handler I have this

                attachRequest.InitializationCommands = new nxtcmd.NxtCommandSequence(
                    (nxtcmd.LegoCommand)new nxtcmd.LegoSetInputMode((NxtSensorPort)registration.Connection.Port, LegoSensorType.I2C_9V, LegoSensorMode.RawMode));
    
                //attachRequest.PollingCommands = new nxtcmd.NxtCommandSequence(_state.PollingFrequencyMs,
                //    new I2CReadHiTechnicAccelerationSensor(_state.SensorPort));
                attachRequest.PollingCommands = new NxtCommandSequence(500, new I2CReadHiTechnicPrototypeBoard(NxtSensorPort.Sensor4));

    As you can see I have hardcoded the port because my state information isn't seeming to get there but none the less, it seems to work. When I fire up the service I created that partners with it (and the brick obviously) it seems to work. I can click the link from the page that shows me board is connected to the brick and shows the response from the get operation (sans XLST like you guys have buts that's fine for now).

    Here is where I get tripped up - the nxt brick seems to do the heavy lifting for me regarding the gory details of I2C communication however I don't know enough to understand what this part is doing.

     public I2CReadHiTechnicCompassSensor(NxtSensorPort port)
                : base()
            {
                TXData = new byte[] { NxtCommon.DefaultI2CBusAddress, 0x41 };
                this.ExpectedI2CResponseSize = 5;
                Port = port;
            }

    I think you are telling it to read 5 bytes starting from the hex address 41? can someone tell me a little more about this? Basically I just want to get some data from this thing. It isn't like I have a circuit or anything, I just want to read some default values? Once I get there I can start to make sense of it (I hope). Anyway - if someone could give me a shove in the right direction that would be fantastic.

    OK - Thanks a lot for your time. I look forward to figuring this all out so I can tell the world how to use MSRDS to connect to their prototype board.

    Wednesday, October 10, 2012 12:48 AM

Answers

All replies

  • Hmm, well I thought I was connecting but I am not. I changed my manifest to look like this.

    <?xml version="1.0"?>
    <!--This file was created with the Microsoft Visual Programming Language.-->
    <Manifest xmlns:prototypeboardconnectiontest="http://schemas.tempuri.org/2012/10/prototypeboardconnectiontest.html" 
              xmlns:brick="http://schemas.microsoft.com/robotics/2007/07/lego/nxt/brick.html" 
              xmlns:user="http://schemas.microsoft.com/robotics/2012/10/hitechnic/nxt/prototypeboard.user.html" 
              xmlns:dssp="http://schemas.microsoft.com/xw/2004/10/dssp.html" 
              xmlns:this="urn:uuid:d205aafa-8bdf-44fc-8276-f86df885ca58" 
              xmlns="http://schemas.microsoft.com/xw/2004/10/manifest.html">
      <CreateServiceList>
        <ServiceRecordType>
          <dssp:Contract>http://schemas.tempuri.org/2012/10/prototypeboardconnectiontest.html</dssp:Contract>
          <dssp:PartnerList />
          <Name>this:prototypeboardconnectiontest</Name>
        </ServiceRecordType>
        <ServiceRecordType>
          <dssp:Contract>http://schemas.microsoft.com/robotics/2007/07/lego/nxt/brick.html</dssp:Contract>
          <dssp:PartnerList>
            <dssp:Partner>
              <dssp:Contract>http://schemas.microsoft.com/robotics/2007/07/lego/nxt/brick.html</dssp:Contract>
              <dssp:Service>legonxtbrickv2.config.xml</dssp:Service>
              <dssp:PartnerList />
              <dssp:Name>dssp:StateService</dssp:Name>
            </dssp:Partner>
          </dssp:PartnerList>
          <Name>this:LegoNXTBrickv2</Name>
        </ServiceRecordType>
        <ServiceRecordType>
          <dssp:Contract>http://schemas.microsoft.com/robotics/2012/10/hitechnic/nxt/prototypeboard.user.html</dssp:Contract>
          <dssp:PartnerList>
            <dssp:Partner>
              <dssp:Contract>http://schemas.microsoft.com/robotics/2012/10/hitechnic/nxt/prototypeboard.user.html</dssp:Contract>
              <dssp:Service>userhitechnicprototypeboard.config.xml</dssp:Service>
              <dssp:PartnerList />
              <dssp:Name>dssp:StateService</dssp:Name>
            </dssp:Partner>
            <dssp:Partner>
              <dssp:Contract>http://schemas.microsoft.com/robotics/2007/07/lego/nxt/brick.html</dssp:Contract>
              <dssp:PartnerList />
              <dssp:Name>user:brick</dssp:Name>
              <dssp:ServiceName>this:LegoNXTBrickv2</dssp:ServiceName>
            </dssp:Partner>
          </dssp:PartnerList>
          <Name>this:UserHiTechnicPrototypeBoard</Name>
        </ServiceRecordType>
      </CreateServiceList>
    </Manifest>

    You can see that I am forcing it to partner with the brick but I get this in the output.

    *** #### Failed to reserve port [10/10/2012 03:19:27][http://127.0.0.1:50000/hitechnic/nxt/prototypeboard/506364ea-f777-472c-8c86-658122fa3b33]
    *** Fault: [Message = ] [Reason = Body type not expected:Microsoft.Robotics.Services.Sample.Lego.Nxt.Brick.Proxy.Registration] [Fault = http://www.w3.org/2003/05/soap-envelope:Receiver -> http://schemas.microsoft.com/xw/2004/10/dssp.html:OperationFailed]  [10/10/2012 03:19:27][http://127.0.0.1:50000/hitechnic/nxt/prototypeboard/506364ea-f777-472c-8c86-658122fa3b33]

    I am a little stumped the code that does the registration is really just copied from the compass sensor and it doesn't even look like a problem with the actual "attempt to reserve the port" it says the body type is not expected? Hmm, i am really stuck with this so any help would be awesome!

    Thanks

    • Edited by r0k3t Wednesday, October 10, 2012 3:32 AM
    Wednesday, October 10, 2012 2:47 AM
  • This thread is from a user who ran into similar issues and error conditions as you.

    http://social.msdn.microsoft.com/Forums/en-US/roboticsccr/thread/a21b154a-89df-4b04-b3db-87ef2ef7ddb8

    Friday, October 19, 2012 6:04 PM
    Moderator