Announcement

Collapse
No announcement yet.

Right side of the Joystick analog doesn't respond.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Right side of the Joystick analog doesn't respond.

    Our team tried to control the left wheels of the robot using the left analog stick and the right wheels right the right analog stick.
    However when we ran the program, only the left side of the wheels worked. We changed the program so that the left analog stick drives the right wheels and it worked, so it wasn't a hardware connection problem. The telemetry data changes when we move the left analog stick but remains 0.0 for the right stick.
    Any ideas?

    Here's our code:

    public class gamepad_01 extends OpMode {

    DcMotor leftMotor;
    DcMotor rightMotor;

    @Override
    public void init() {
    leftMotor = hardwareMap.dcMotor.get("left_drive");
    rightMotor = hardwareMap.dcMotor.get("right_drive");
    leftMotor.setDirection(DcMotor.Direction.REVERSE);

    }

    @Override
    public void loop() {

    float LeftY = gamepad1.left_stick_y;
    float RightY = gamepad1.right_stick_y;

    telemetry.addData("1", "joy left" + LeftY);
    telemetry.addData("2", "joy right" + RightY);

    leftMotor.setPower(LeftY);
    rightMotor.setPower(RightY);

    }
    }

  • #2
    Code:
        float leftDrivePower = scaleMotorPower(-gamepad.left_stick_y);
        float rightDrivePower = scaleMotorPower(-gamepad.right_stick_y);
    
       leftMotor.setPower(leftDrivePower);
       rightMotor.setPower(rightDrivePower);
    Code:
     /**
         * Taken from FTC DSK PushBot example
         * Scale the joystick input using a nonlinear algorithm.
         */
        private float scaleMotorPower (float p_power)
        {
            //
            // Assume no scaling.
            //
            float l_scale = 0.0f;
    
            //
            // Ensure the values are legal.
            //
            float l_power = Range.clip (p_power, -1, 1);
    
            float[] l_array =
                    { 0.00f, 0.05f, 0.09f, 0.10f, 0.12f
                            , 0.15f, 0.18f, 0.24f, 0.30f, 0.36f
                            , 0.43f, 0.50f, 0.60f, 0.72f, 0.85f
                            , 1.00f, 1.00f
                    };
    
            //
            // Get the corresponding index for the specified argument/parameter.
            //
            int l_index = (int)(l_power * 16.0);
            if (l_index < 0)
            {
                l_index = -l_index;
            }
            else if (l_index > 16)
            {
                l_index = 16;
            }
    
            if (l_power < 0)
            {
                l_scale = -l_array[l_index];
            }
            else
            {
                l_scale = l_array[l_index];
            }
    
            return l_scale;
    
        } // scale_motor_power

    Comment


    • #3
      Originally posted by ves View Post
      Our team tried to control the left wheels of the robot using the left analog stick and the right wheels right the right analog stick.
      However when we ran the program, only the left side of the wheels worked. We changed the program so that the left analog stick drives the right wheels and it worked, so it wasn't a hardware connection problem. The telemetry data changes when we move the left analog stick but remains 0.0 for the right stick.
      Any ideas?
      Some combinations of different Android OS and Game controller types can end up with different mappings for the right joystick (eg: try activating the left and right triggers instead).

      Are you using the standard ZTE Phones (Android 4.4.4) and Logitech 310 Game controllers?
      Have you accidentally played with the Joystick settings on the Phone? Driver Station/menu/Settings/Gamepad Type? Should be set to Logitech 310.

      Phil.

      Comment


      • #4
        Originally posted by Philbot View Post
        Some combinations of different Android OS and Game controller types can end up with different mappings for the right joystick (eg: try activating the left and right triggers instead).

        Are you using the standard ZTE Phones (Android 4.4.4) and Logitech 310 Game controllers?
        Have you accidentally played with the Joystick settings on the Phone? Driver Station/menu/Settings/Gamepad Type? Should be set to Logitech 310.

        Phil.
        We've tried controlling the motors with buttons and they work. It's just the right joystick not working.
        We are using the standard phone and Logitech 310 controllers. The Settings on the Gamepad type is correct.

        Basically everything works on the controller except the right joystick. It's not reading in any values according to the telemetry.

        Comment


        • #5
          Sounds like a bad gamepad.

          Comment


          • #6
            Originally posted by mlwilliams View Post
            Sounds like a bad gamepad.
            Our gamepads work on an online API tester but the right analog still would not feed back any values in telemetry.

            Comment


            • #7
              Thank you, it works when we change the code 'right trigger' instead of 'right_stick_y'.

              Comment


              • #8
                Originally posted by ves View Post
                Thank you, it works when we change the code 'right trigger' instead of 'right_stick_y'.
                Hi

                Then there must be something miss-configured on your driver station.
                You should be able to use right_stick_y.

                Please check these two things again..

                1) You are still running Android 4.4.x (5.0 has different mappings for the right JS. Maybe somone did an update without you knowing)
                2) Go to menu/settings (top right menu on DS) and look at your Joystick types. It must be set to "Logitech F310 Gamepad". "Microsoft X-BOX" and "Standard Android" will flip the right JS and Trigger buttons.

                Phil.

                Comment


                • #9
                  Originally posted by Philbot View Post
                  Hi

                  Then there must be something miss-configured on your driver station.
                  You should be able to use right_stick_y.

                  Please check these two things again..

                  1) You are still running Android 4.4.x (5.0 has different mappings for the right JS. Maybe somone did an update without you knowing)
                  2) Go to menu/settings (top right menu on DS) and look at your Joystick types. It must be set to "Logitech F310 Gamepad". "Microsoft X-BOX" and "Standard Android" will flip the right JS and Trigger buttons.

                  Phil.
                  For us newbies, does anyone have a simple picture of the F310 controller with callouts for each button and it's programming name?

                  Comment


                  • #10
                    Originally posted by FTC9765 View Post
                    For us newbies, does anyone have a simple picture of the F310 controller with callouts for each button and it's programming name?
                    Here you go: gamepad_mapping.pptx

                    I have not tested all of these but according to the SDK they should work.

                    Comment


                    • #11
                      Originally posted by envisim View Post
                      Here you go: gamepad_mapping.pptx

                      I have not tested all of these but according to the SDK they should work.
                      Thanks! My programmers will be happy tonight!

                      Comment


                      • #12
                        What you labelled as "left_button" and "right_button" are actually called "left_stick_button" and "right_stick_button".

                        Comment

                        Working...
                        X