locked
irobot Create and irobot lite service RRS feed

  • Question

  • Hi,
    I was wondering if it is possible to partner with lite and create at the same time? 
     
    I have my iRobot Create and I want to send DigitalOutputs command to the robot. In order to do that i have to partner with create service using (Microsoft.Robotics.Services.IRobot.Create.Proxy). 
    I also want to subscribe to the sensors and read the odometry informations of the create, and to do that ( to the best of my knowledge) i need to use the lite service (Microsoft.Robotics.Services.IRobot.Lite.Proxy). But I constantly get errors when I add both services in my code and my manifest. 
    Below is the snap shot of my code and my manifest file. I am sure either there is something in the manifest file that is wrong or it is just not possible.
      [Partner("IRobotService", Contract = lite.Contract.Identifier, CreationPolicy = PartnerCreationPolicy.UseExistingOrCreate)]
            lite.IRobotLiteOperations _iRobotPort = new IRobotLiteOperations();
            lite.IRobotLiteOperations _irobotNotify = new lite.IRobotLiteOperations();
    
            [Partner("CreateService", Contract = create.Contract.Identifier, CreationPolicy =  PartnerCreationPolicy.UseExistingOrCreate)]
            create.CreateOperations _createPort = new CreateOperations();
    
    <?xml version="1.0"?>
    <!--This file was created with the Microsoft Visual Programming Language.-->
    <Manifest xmlns:irobot="http://schemas.microsoft.com/robotics/2007/01/irobot.html" xmlns:irobotlocalization="http://cs.uga.edu/2011/09/irobotlocalization.html" xmlns:this="urn:uuid:8360735b-504c-4f4b-bbae-062350cff6e9" xmlns:dssp="http://schemas.microsoft.com/xw/2004/10/dssp.html" xmlns:stream="http://schemas.microsoft.com/robotics/2006/12/irobot/stream.html" xmlns="http://schemas.microsoft.com/xw/2004/10/manifest.html">
      <CreateServiceList>
        <ServiceRecordType>
          <dssp:Contract>http://cs.uga.edu/2011/09/irobotlocalization.html</dssp:Contract>
          <dssp:PartnerList>
            <dssp:Partner>
              <dssp:Contract>http://schemas.microsoft.com/robotics/2007/01/irobot/create.html</dssp:Contract>
              <dssp:PartnerList />
              <dssp:Name>irobotlocalization:CreateService</dssp:Name>
              <dssp:ServiceName>this:iRobotCreateRoomba</dssp:ServiceName>
            </dssp:Partner>
          </dssp:PartnerList>
          <Name>this:irobotlocalization</Name>
        </ServiceRecordType>
        <ServiceRecordType>
          <dssp:Contract>http://schemas.microsoft.com/robotics/2007/01/irobot.html</dssp:Contract>
          <dssp:PartnerList>
            <dssp:Partner>
              <dssp:Contract>http://schemas.microsoft.com/robotics/generic/2006/12/dssstream.html</dssp:Contract>
              <dssp:PartnerList />
              <dssp:Name>irobot:irobotstream</dssp:Name>
              <dssp:ServiceName>this:iRobotStreamCommunications</dssp:ServiceName>
            </dssp:Partner>
          </dssp:PartnerList>
          <Name>this:iRobotCreateRoomba</Name>
        </ServiceRecordType>
        <ServiceRecordType>
          <dssp:Contract>http://schemas.microsoft.com/robotics/2006/12/irobot/stream.html</dssp:Contract>
          <dssp:PartnerList />
          <Name>this:iRobotStreamCommunications</Name>
        </ServiceRecordType>
      </CreateServiceList>
    </Manifest>
    
    in order to run my code, I insert
    /p:50000 /t:50001 /m:"Projects/iRobotLocalization/iRobotLocalization/iRobotLocalization.manifest.xml" /m:"C:\Users\Anousha\Microsoft Robotics Dev Studio 2008 R3\samples\Config\irobot.user.manifest.xml"
    With this partners I am able to do 
      Activate(Arbiter.Choice(_createPort.CreateDigitalOutputs(true, true, true),
                                         s => Console.WriteLine("Set"),
                                         f => Console.WriteLine("Failed " + f.ToString())));
    
    and
    
    _iRobotPort.CreateDriveDirect(100, 100);
    
    successfully. Both works, my robot drives straight and my digital outputs are set. however, in the output window and my console window I get so many errors like this:
     Invalid Response Packet 7 bytes. [09/14/2011 18:18:21][http://anousha-pc:50000/irobot/1112a6b9-937a-4dcd-9513-eace5d655583]
    *   00 00 00 00 00 00 12  [09/14/2011 18:18:21][http://anousha-pc:50000/irobot/1112a6b9-937a-4dcd-9513-eace5d655583]
    *     Invalid Response Packet 7 bytes. [09/14/2011 18:18:21][http://anousha-pc:50000/irobot/1112a6b9-937a-4dcd-9513-eace5d655583]
    *   00 00 00 00 12 00 A5  [09/14/2011 18:18:21][http://anousha-pc:50000/irobot/1112a6b9-937a-4dcd-9513-eace5d655583]
    *     Invalid Response Packet 7 bytes. [09/14/2011 18:18:21][http://anousha-pc:50000/irobot/1112a6b9-937a-4dcd-9513-eace5d655583]
    *   Set Mode from Full to Passive. [09/14/2011 18:18:21][http://anousha-pc:50000/irobot/1112a6b9-937a-4dcd-9513-eace5d655583]
    *   00 00 12 00 A5 13 0F  [09/14/2011 18:18:21][http://anousha-pc:50000/irobot/1112a6b9-937a-4dcd-9513-eace5d655583]
     
    and 
    *** Multiple pending commands are not allowed [09/14/2011 18:18:22][http://anousha-pc:50000/irobot/1112a6b9-937a-4dcd-9513-eace5d655583]
     
    and 
    *** "TaskExecutionWorker:HandleException": Exception:System.ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
       at System.Buffer.BlockCopy(Array src, Int32 srcOffset, Array dst, Int32 dstOffset, Int32 count)
       at Microsoft.Robotics.Services.IRobot.Roomba.ByteArray.SubArray(Byte[] data, Int32 start, Int32 length)
       at Microsoft.Robotics.Services.IRobot.Create.IRobotUtility.UnpackPose(RoombaState currentState, Byte[] data, Int32 ix, Dictionary`2& namedValues)
       at Microsoft.Robotics.Services.IRobot.Create.IRobotUtility.ProcessSensorCode(CreateSensorPacket code, Byte[] data, Int32 ix, RoombaState currentState, DateTime timestamp, Dictionary`2& namedValues)
       at Microsoft.Robotics.Services.IRobot.Create.ReturnStream.ParseNamedValues(RoombaState currentState)
       at Microsoft.Robotics.Services.IRobot.Create.ReturnStream.RetrieveChangedValues(RoombaState currentState)
       at Microsoft.Robotics.Services.IRobot.Roomba.IRobotService.UpdateStreamNotificationHandler(UpdateNotifications updateNotifications)
       at Microsoft.Ccr.Core.Task`1.Execute()
       at Microsoft.Ccr.Core.TaskExecutionWorker.ExecuteTaskHelper(ITask currentTask)
       at Microsoft.Ccr.Core.TaskExecutionWorker.ExecuteTask(ITask& currentTask, DispatcherQueue p, Boolean bypassExecute)
       at Microsoft.Ccr.Core.TaskExecutionWorker.ExecutionLoop()
     
    So many of these errors that it blocks my output windows and console windows completely.
     
    Any help please???? What is it that I am doing wrong???
    Thanks in advance,
    Anousha
     





    • Edited by Anousha.mMicrosoft employee Wednesday, September 14, 2011 10:34 PM formating
    • Moved by Anthony Toivonen Friday, October 7, 2011 8:21 PM Not a HW question (From:Microsoft Robotics - Hardware Configuration and Troubleshooting)
    Wednesday, September 14, 2011 10:31 PM

Answers

  • I am not using a turtlebot board. I made my own turtlebot with the kinect, and a chip-set that  powers the kinect from the create. It might be that the service has issued some command but gets shut down; however, I wait for the service to do its job and then terminate the node.

    Anyway I went around this problem by writing a C++ code to set the digital output.

    I was just wanted to inform you guys about this. 

    Thanks,

    Anousha

    • Marked as answer by Gershon Parent Wednesday, March 7, 2012 12:00 AM
    Wednesday, December 14, 2011 3:14 PM

All replies

  • Hi Anousha, I am looking into this and will get back to you shortly.

    Thanks

    Nick

    Thursday, September 22, 2011 9:47 PM
    Moderator
  • Thanks :)
    Friday, September 23, 2011 5:05 PM
  • Hi Anousha,

    I haven't been able to repro this locally. I have an identical manifest to the one above. I assume the other manifest - irobot.user.manifest.xml - has only your localization service in it? Could you also send me your irobot state file so I can try with the same configuration?

    Are you issuing an explicit Connect to the Create, or is the Create configured to connect on startup?

     

    Thanks

    Nick.

     

    Friday, September 23, 2011 11:39 PM
    Moderator
  • Hi Nick,

     

    The other manifest is actually the same as irobot.manifest.xml that is shipped with R3. Even with irobot.manifest.xml i get the same error. I have configured the create using the web browser as well as the manifest edditor. In either case I get the same errors. Here is my configuration file for create.

     

    <?xml version="1.0" encoding="utf-8"?>
    <RoombaState xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:d="http://schemas.microsoft.com/xw/2004/10/dssp.html" xmlns="http://schemas.microsoft.com/robotics/2007/01/irobot.html">
    	<Name>Sunny</Name>
    	<FirmwareDate>0001-01-01T00:00:00</FirmwareDate>
    	<SerialPort>1</SerialPort>
    	<BaudRate>57600</BaudRate>
    	<IRobotModel>Create</IRobotModel>
    	<ConnectionType>RoombaSerialPort</ConnectionType>
    	<StopOnResync>false</StopOnResync>
    	<Mode>Uninitialized</Mode>
    	<MaintainMode>Full</MaintainMode>
    	<LastUpdated>2011-09-15T16:35:38.4780572-04:00</LastUpdated>
    	<PollingInterval>0</PollingInterval>
    	<SongDefinitions>
    		<CmdDefineSong>
    			<SongNumber>1</SongNumber>
    			<Notes>
    				<RoombaNote>
    					<Tone>B_Hz_493p9</Tone>
    					<Duration>20</Duration>
    				</RoombaNote>
    				<RoombaNote>
    					<Tone>B_Hz_987p8</Tone>
    					<Duration>10</Duration>
    				</RoombaNote>
    			</Notes>
    		</CmdDefineSong>
    		<CmdDefineSong>
    			<SongNumber>2</SongNumber>
    			<Notes>
    				<RoombaNote>
    					<Tone>B_Hz_987p8</Tone>
    					<Duration>10</Duration>
    				</RoombaNote>
    				<RoombaNote>
    					<Tone>B_Hz_493p9</Tone>
    					<Duration>20</Duration>
    				</RoombaNote>
    			</Notes>
    		</CmdDefineSong>
    	</SongDefinitions>
    	<WaitForConnect>false</WaitForConnect>
    </RoombaState>
    

     

     

    Thanks,

    Anousha

     

    Monday, September 26, 2011 3:11 AM
  • Ok I just wanted to Test and see what happenes when i only partner with the create service. So I removed the partnership with lite service in the manifest and my code.

     

     /// <summary>
            /// CreateService partner
            /// </summary>
            [Partner("CreateService", Contract = create.Contract.Identifier, CreationPolicy = PartnerCreationPolicy.UseExistingOrCreate)]
            create.CreateOperations _createPort = new CreateOperations();
    

     

    I have the following in my manifest: 

     

    <?xml version="1.0"?>
    <!--This file was created with the Microsoft Visual Programming Language.-->
    <Manifest xmlns:irobot="http://schemas.microsoft.com/robotics/2007/01/irobot.html" xmlns:setdigitaloutput="http://schemas.tempuri.org/2011/09/setdigitaloutput.html" xmlns:this="urn:uuid:330fe853-7861-4e1c-88f2-0f3655db0db8" xmlns:dssp="http://schemas.microsoft.com/xw/2004/10/dssp.html" xmlns="http://schemas.microsoft.com/xw/2004/10/manifest.html">
      <CreateServiceList>
        <ServiceRecordType>
          <dssp:Contract>http://schemas.tempuri.org/2011/09/setdigitaloutput.html</dssp:Contract>
          <dssp:PartnerList>
            <dssp:Partner>
              <dssp:Contract>http://schemas.microsoft.com/robotics/2007/01/irobot/create.html</dssp:Contract>
              <dssp:PartnerList />
              <dssp:Name>setdigitaloutput:CreateService</dssp:Name>
              <dssp:ServiceName>this:iRobotCreateRoomba</dssp:ServiceName>
            </dssp:Partner>
          </dssp:PartnerList>
          <Name>this:setdigitaloutput</Name>
        </ServiceRecordType>
        <ServiceRecordType>
          <dssp:Contract>http://schemas.microsoft.com/robotics/2007/01/irobot.html</dssp:Contract>
          <dssp:PartnerList>
            <dssp:Partner>
              <dssp:Contract>http://schemas.microsoft.com/robotics/2007/01/irobot.html</dssp:Contract>
              <dssp:Service>irobotcreateroomba.config.xml</dssp:Service>
              <dssp:PartnerList />
              <dssp:Name>dssp:StateService</dssp:Name>
            </dssp:Partner>
          </dssp:PartnerList>
          <Name>this:iRobotCreateRoomba</Name>
        </ServiceRecordType>
      </CreateServiceList>
    </Manifest>
    

     

    My robot configuration is the same as I posted above.

    I still get the bad data error  as well as 

    *     Invalid Response Packet 7 bytes. [11/02/2011 17:10:59][http://anousha-pc:50000/irobot/cfe022f6-0fdb-40c5-8e6b-bdbb4997e9b1]

    *   00 00 00 00 00 00 12  [11/02/2011 17:10:59][http://anousha-pc:50000/irobot/cfe022f6-0fdb-40c5-8e6b-bdbb4997e9b1] 

    etc when I try to set digital output. Even if i don't set the digital output and just simply partner with the create i get the errors.

    When I get bad data error my sensors don't work (Ex: bumper) !!! I don't understand why this happens when i partner with create!! Is there any bug in the code? is there any specific configuration for the robot that I do not follow? what is it?

    Wednesday, November 2, 2011 9:13 PM
  • Thanks, I'll take another look over the next couple of days
    Thursday, November 10, 2011 5:40 PM
    Moderator
  • The first time through, this works for me. I have a small service that continually calls SetDigitalOutputs and it works fine.

    But if I shutdown the node and bring it back up again, then I can repro some of the errors. I suspect this is a problem in the interaction with the serial port, although on whose side I'm not sure yet. I suggest that when you shutdown (or kill) the node, you also power-cycle the iCreate. This works for me.

    Monday, November 21, 2011 9:17 PM
    Moderator
  • Yes. When I shutdown the node, and run another code for my iRobot Create I get the errors. The problem is that, I need the digital outputs to be set when I run my other code. and If i power-cycle the create, it kills the whole purpose of setting it on.

     

    I have the kinect service in another code and in order for my kinect service to run, kinect has to have the power, and in order for my kinect to have the power it needs the digital outputs set. That's why I cannot have the setdigital output and in the same service as the kinect, because the service won't run if the digital outputs are not set. I have to shut down the set digital output once i set it, and run my other code! So you think this is a bug?

    For going around my problem, i am no longer using the Microsoft robotics service to set the digital output, I just wrote a C++ low level script to set it. and I don't get any errors when i shut it down and run my Kinect service. I guess this is a bug in the Microsoft create library.

     

    Thanks for looking into this.

    Anousha

     

    Monday, December 12, 2011 3:28 PM
  • Hi Anousha,

    Are you doing this because you are using a Turtlebot board on your Create?

    I don't really know what causes this problem. I'm not sure what state the iRobot service leaves the Create in. That might be the problem. The other possibility is that the service has issued a command but gets shut down before it receives the response, so when the next service starts up it gets a response from the last command from the previous service and gets confused.

    Without watching the serial IO it is hard to diagnose.

    Anyway, your solution of just setting the digital output with a small progam works because the Create service does not initialize the digital outputs.

    Trevor

     

    Wednesday, December 14, 2011 8:20 AM
  • I am not using a turtlebot board. I made my own turtlebot with the kinect, and a chip-set that  powers the kinect from the create. It might be that the service has issued some command but gets shut down; however, I wait for the service to do its job and then terminate the node.

    Anyway I went around this problem by writing a C++ code to set the digital output.

    I was just wanted to inform you guys about this. 

    Thanks,

    Anousha

    • Marked as answer by Gershon Parent Wednesday, March 7, 2012 12:00 AM
    Wednesday, December 14, 2011 3:14 PM
  • Thanks Anousha :-)

    Trevor

     

    Friday, December 16, 2011 4:36 AM