This is my program for arcade drive and a strafe with mecanum wheels. The problem is, when i download it to the robot, only the strafing works and not the drive. please help
PercentUnits::pct is a parameter for the motor, it doesn’t do anything to the axis value itself. Your spin params should just be (direction, axis3 - axis4, units), not (direction, axis3,units,axis4, units).
To clarify, to get the axis values, just do controller.axisx.position()
Your else statement at the end is turning your motors off from the previous statements. Try changing it to else if axis3 < 10 and axis 3 > -10 and axis4 < 10 and axis4 >-10
I am going off of this code.
if(controller1.ButtonA.pressing() ) {
frontLeftDrive.spin(directionType::fwd, strafe, percentUnits::pct);
frontRightDrive.spin(directionType::fwd, strafe, percentUnits::pct);
backLeftDrive.spin(directionType::rev, strafe, percentUnits::pct);
backRightDrive.spin(directionType::rev, strafe, percentUnits::pct);
Basically you are telling the robot if A is pressed, strafe one direction and if Y is pressed, strafe the other way. Though you are telling the robot that if neither of those buttons are pressed, then none of the wheels should move.