Technology Forum Has Moved!

The FIRST Tech Challenge Technology forum has moved to a new location! Please take a look at our forum blog for links and instructions on how to access the new forum.

The official blog of the FIRST Tech Challenge - a STEM robotics programs for students grades 7-12.

Note that volunteers (except for FTA/WTA/CSA will still access their role specific forum through this site. The blog also outlines how to access the volunteer forums.
See more
See less

Xbox Controller Issue - Key Mappings

  • Filter
  • Time
  • Show
Clear All
new posts

  • Xbox Controller Issue - Key Mappings

    I've been remotely working with a team for the past couple of days on a strange control system issue.

    Some details about their setup
    • They have built a Pushbot, completely wired and following the build guide for that.
    • For the programming portion of the build, they are running the example file "PushbotTeleopTank_Iterative" using the default "HardwarePushbot" configuration.
    • They are using Moto G 2nd Generation phones, running Marshmallow, for both their Driver's Station and the Robot Controller
    • They are using SDK version 2.35, and both apps show this version (although the "App Build Time" under "About" for both applications shows 11/30/79 12:00 AM)
    • The controller they're using is a "Rock Candy" Xbox 360 controller, as seen here

    When they deploy the application (without changing any of the files) from Android Studio to their Robot Controller phone and run it, the left drive motor correctly uses the input value from -gamepad1.left_stick_y to determine the motor power. The right motor, however, appears to use the right_trigger off of gamepad1 (even though the code would indicate it should be getting this value from -gamepad1.right_stick_y. Moving the right trigger does indeed change the right motor speed and this is reflected in the telemetry data printed in the OpMode.

    In an attempt to troubleshoot this, the value for right in the program was set to a value of 0.9 (not using any of the gamepad values, just a constant, hardcoded value). This was the only change made to the program. Running the program again, the telemetry reflected that right = 0.9 but the right motor did not move. Also, when this change was made, the ability to control the left drive motor disappeared (even though this line was not changed).

    In another attempt to troubleshoot this, the change was made to set right = -gamepad1.right_stick_x, to see if anything could be read off of that instead. Again, this was the only line changed in the entire file from the other troubleshooting sessions. With this change, the right motor was controllable via the left_trigger on the controller (instead of the right trigger, like it was originally) and the left motor was now controllable using the A and Y buttons on the controller (even though this line was not changed).

    What would cause this? Could this be due to using the Rock Candy controllers instead of standard Xbox 360 controllers? Any help would be appreciated.

  • #2
    There are only two legal controllers so even if they get this working they're going to be unhappy finding out at an event that the controller is illegal.

    In the driver station there's a configuration setting to specify which gamepads you're using. What is their's set to?

    The only allowed gamepads are listed below. They may be used in any combination.
    • Logitech F310 gamepad (Part# 940-00010)
    • Xbox 360 Controller for Windows (Part# 52A-00004)


    • #3
      I also know that, and when I found out they were not using the correct controllers advised them to purchase the correct (and legal) ones

      Originally posted by mlwilliams View Post
      In the driver station there's a configuration setting to specify which gamepads you're using. What is their's set to?
      Their driver's station is set for Xbox 360 controllers in that configuration menu.


      • #4
        On the Logitech F310 there's a switch on the back that selects between Logitech mode and XBox mode. There's also a mode button on the front that needs to be selected properly. If either of those are set wrong you get strange behavior like you've described. I don't know if the Rock Candy controller has any similar buttons for settings but if not they may be out of luck.


        • #5
          Following up here, they were able to get ahold of a standard Xbox 360 controller and things are behaving normally, so whatever this was appears to have been caused by the third-party controllers and how they mapped the various buttons.