Announcement

Collapse
No announcement yet.

Mecanum Tank Drive

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

  • Mecanum Tank Drive

    Basically, whenever I try to use tank controls with mecanum wheels only the front two move, and I was wondering if anyone else had this problem and/or knows how to fix it. (also how do I post my code)


  • #2
    package org.firstinspires.ftc.teamcode;

    import com.qualcomm.robotcore.eventloop.opmode.LinearOpMo de;
    import com.qualcomm.robotcore.hardware.DcMotor;
    import com.qualcomm.robotcore.eventloop.opmode.TeleOp;

    @TeleOp(name = "MecanumTank")
    public class MecanumTankDrive extends LinearOpMode {


    public DcMotor frontLeft;
    public DcMotor backLeft;

    public DcMotor frontRight;
    public DcMotor backRight;

    public void runOpMode()


    {
    backRight = hardwareMap.dcMotor.get("backRightDrive");
    backLeft = hardwareMap.dcMotor.get("backLeftDrive");

    frontRight = hardwareMap.dcMotor.get("frontRightDrive");
    frontLeft = hardwareMap.dcMotor.get("frontLeftDrive");

    waitForStart();


    while(opModeIsActive())
    {

    backLeft.setPower(gamepad1.left_stick_y);
    frontLeft.setPower(gamepad1.left_stick_y);

    backRight.setPower(gamepad1.right_stick_y);
    frontRight.setPower(gamepad1.right_stick_y);

    }


    }





    }

    Comment


    • #3
      There is nothing obviously wrong with your code, but several things could be causing this behavior:
      • The mode button is activated on the gamepad so that the d-pad and left stick are swapped
      • The configuration file you are using does not match the wiring setup of your motor controllers
      • The motors are not plugged in correctly
      One of the most useful ways to figure out why any bit of code is working is too simplify it to identify where the issue is. (This is like if your car is malfunctioning and you test different components to figure out what part is having the problem.) In your case, I would try using the same gamepad control for all the motors first. If, still, only two move then the issue is likely not with the gamepad inputs. Then, I would try double-checking your configuration file. Make sure there are no warnings on the Robot Controller screen about motor controllers not being found. Make sure the ports the motors are attached to are the ones you have specified in the configuration file. If you have encoders attached to the motors, you can try printing their values using telemetry. If they are not updating when you spin the motor axles, the motors are likely misconfigured. One final thing to try is swapping the wires for the working motors with the ones that aren't working, to check whether the problem is with the motors themselves.

      Comment


      • #4
        Turns out that the front motors weren't plugged in correctly and when I plugged them in correctly it works just fine. (thanks for the advice)

        Comment

        Working...
        X