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);
}
}
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);
}
}
Comment