locked
Newbie trying to write a service for joystick and servo controller RRS feed

  • Question

  • So, after downloading the Introductary Courseware, I have been reading and comparing the code between the JOYSTICKFORM, GAMECONTROLLER, and XINPUTCONTROLLER.  I guess, at this point, my main question is "How does windows differentiate between differnet buttons, joysticks and POV hats in DSS".  In the XINPUT, its almost as if everything is predefined, as Windows knows its an xbox controller, and you just write the states.  Interestingly enough, i read through the DSS user manual and all my hunches were confirmed, but none of my questiosn were answered.  Is there something in the drivers that i'm missing?  Or a DLL?  Or am i not finding an answer because i'm asking the wrong question.  If someone can just show me a spot of code somewhere and face me in the right direction, i can replicate it and take it from there.  I'm not great at inventing code, but i can code enough to replicate efficientlySmile

    While i'm at it, i'm going to try and create a Service for a USB Parallax Servo Controller.  It uses FDTI usb to serial drivers.  Is that going to be an issue that i will have to over come. 

    If you think i'm over my head, you're probably right, but let's be honest- no one else is going to do it for me, right?
    Sunday, June 29, 2008 5:17 AM

Answers

  • The Game Controller uses DirectX (via InputInterop.DLL) and the XInput Controller uses the XNA Framework. You won't find any low-level device driver code in these services if that is what you are looking for. So yes, it is like "everything is predefined".

     

    The Parallax USB Servo Controller probably looks like a COM port, so programming it should not be too difficult. Several of the robot implementation in MRDS use virtual COM ports, so the code to talk to a serial port is already there.

     

    Trevor

     

     

    Monday, June 30, 2008 11:47 AM

All replies

  • The Game Controller uses DirectX (via InputInterop.DLL) and the XInput Controller uses the XNA Framework. You won't find any low-level device driver code in these services if that is what you are looking for. So yes, it is like "everything is predefined".

     

    The Parallax USB Servo Controller probably looks like a COM port, so programming it should not be too difficult. Several of the robot implementation in MRDS use virtual COM ports, so the code to talk to a serial port is already there.

     

    Trevor

     

     

    Monday, June 30, 2008 11:47 AM
  • Your windows form idea for the joystick in my other thread may be the way to go for that, so i'll focus on the Servo contorller

    yes, it does look like a com port.  I have been going through the MSRDS folder trying to find the Generic Services (i think that they will have the com port).  any idea where they are?
    Monday, June 30, 2008 2:42 PM
  • Hey, sorry about being so quiet lately.  partying, researching, absorbing info, typing code.  losing code due to not saving.  Fun stuff.

    Anyways...

    So I figured out exactly what information i need to send to the serial ports to get the servo motor working.  Sadly, my coding attempt as just lost, so i have to try again.  My first question is, in SerialIOManager, which line dictates what bytes i send through the serial port?  My next question is that SerialIOManager doesn't have a "Type" or XML manifest file.  Will i still need to create that or no?

    I also took a look at InputInterop.DLL.  Can i add code to that to get the buttons i want, like make a POV1, POV2 section, or will that corrupt something?
    Saturday, July 5, 2008 7:49 AM
  • I assume that you are talking about the SerialIOManager that is part of the Arcos Core. Is that correct?

     

    This is a good implementation, but it is a little tied to the Arcos services. You will have to extract the relevant source files and add them to your service.

     

    There are other implementations, including the ones in the LEGO NXT and the iRobot services. Basically they all use the SerialPort class in System.IO.Ports.

     

    I'm not really familiar with the Game Controller code, but looking in GameController.cs it seems that there are notification messages for the POV hats. You should not need to make any changes, just subscribe and listen for UpdatePovHats messages.

     

    Trevor

    Monday, July 7, 2008 6:57 AM
  • I'm up i'm up!

    Okay, so i will check those other implementations out.  I also need to figure out how to write bytes.  I hope that this will helpSmile

    As for the Game controller, i have 4 POV hats.  I need to see messages from them allllllllll...
    Monday, July 7, 2008 7:01 AM