XInput Controller

Microsoft Robotics

Glossary Item Box

Microsoft Robotics Developer StudioSend feedback on this topic

XInput Controller

XInput Controller Icon

The XInput Controller service provides access to an Xbox 360 controller such as an Xbox Gamepad. Therefore you need an Xbox Gamepad or other controller that is compatible with XInput to use this service. If you have a conventional joystick, look at the Game Controller service instead. Note that the Xbox 360 controller will also work with the Game Controller service as a joystick.

XInput is an Application Programming Interface (API) that is part of DirectX and allows applications to receive input from the Xbox 360 Controller for Windows. Controller rumble effects and voice input and output are supported.

Getting an Xbox 360 wireless controller to work can be difficult, especially if you have previously paired it with an Xbox. You should consult the discussion forums for the latest information. A wired (USB) controller works with no problems.

Mostly you work with an XInput controller by listening for notifications.

The XInput Controller is similar to the Game Controller and you might find it useful to read the documentation for the Game Controller as well.

For additional information see the XInput Controller in the VPL reference section.

Requests and Notifications

The XInput Controller supports the following requests:

OperationDescription
ButtonsChangedIndicates when one or more buttons are pressed or released.
ControllerChangedSend this message to change which controller this service instance is using. This notification is sent when the controller is changed or when the controller is connected or disconnected.
DPadChangedIndicates when the directional pad position is changed.
PollRequests the controller to read current values. However, you do not need to issue this request because the service updates itself 20 times per second.
QueryControllersReturns a list of attached controllers.
SetVibrationSets the amount of vibration in the left and right rumble motors. The left motor is the low-frequency rumble motor. The right motor is the high-frequency rumble motor. This notification is sent when the vibration settings are changed.
ThumbsticksChangedIndicates when a thumbstick position is changed.
TriggersChangedIndicates when the position of a Point-Of-View (POV) hat switch is changed.

 

Service State

The state contains the following properties. Note that each of the different fields has its own data type. All of the types associated with input devices have a TimeStamp property.

NameTypeDescription
ButtonsButtonsCurrent state of all the buttons. See below.
ControllerControllerInformation about the current controller.
DPadDPadCurrent direction of the DPad as a set of Boolean fields: Left, Down, Right, Up.
ThumbsticksThumbsticksContains two sets of float values: LeftX, LeftY and RightX, RightY.
TriggersTriggersCurrent positions of the triggers as floats: Left and Right.
VibrationVibrationCurrent values of the vibration motors as floats: Left and Right.
TimeStampDateTimeThe timestamp of the most recent update.

The Buttons data type has the following Boolean fields:

  • A
  • B
  • X
  • Y
  • Back
  • Start
  • LeftStick
  • RightStick
  • LeftShoulder
  • RightShoulder

 

 

© 2012 Microsoft Corporation. All Rights Reserved.

Show: