|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Only half of the robot turns
We are having a peculiar issue with our arcade drive, when we drive forward or backward everything works normally, but when we try turning only the right side of our robot turns, whether we are turning left or right, while the left side doesn't move at all.
This is the code we have for driving in teleop: Code:
myRobot.arcadeDrive(stick); |
|
#2
|
||||
|
||||
|
Re: Only half of the robot turns
Quote:
Quote:
|
|
#3
|
||||
|
||||
|
Re: Only half of the robot turns
Quote:
Code:
public void arcadeDrive(double moveValue, double rotateValue, boolean squaredInputs) {
// local variables to hold the computed PWM values for the motors
if (!kArcadeStandard_Reported) {
UsageReporting.report(tResourceType.kResourceType_RobotDrive, getNumMotors(),
tInstances.kRobotDrive_ArcadeStandard);
kArcadeStandard_Reported = true;
}
double leftMotorSpeed;
double rightMotorSpeed;
moveValue = limit(moveValue);
rotateValue = limit(rotateValue);
if (squaredInputs) {
// square the inputs (while preserving the sign) to increase fine control
// while permitting full power
if (moveValue >= 0.0) {
moveValue = (moveValue * moveValue);
} else {
moveValue = -(moveValue * moveValue);
}
if (rotateValue >= 0.0) {
rotateValue = (rotateValue * rotateValue);
} else {
rotateValue = -(rotateValue * rotateValue);
}
}
if (moveValue > 0.0) {
if (rotateValue > 0.0) {
leftMotorSpeed = moveValue - rotateValue;
rightMotorSpeed = Math.max(moveValue, rotateValue);
} else {
leftMotorSpeed = Math.max(moveValue, -rotateValue);
rightMotorSpeed = moveValue + rotateValue;
}
} else {
if (rotateValue > 0.0) {
leftMotorSpeed = -Math.max(-moveValue, rotateValue);
rightMotorSpeed = moveValue + rotateValue;
} else {
leftMotorSpeed = moveValue - rotateValue;
rightMotorSpeed = -Math.max(-moveValue, -rotateValue);
}
}
setLeftRightMotorOutputs(leftMotorSpeed, rightMotorSpeed);
}
|
|
#4
|
|||
|
|||
|
Re: Only half of the robot turns
The robot is currently being re-assembled, I will be able to post the output on monday.
|
|
#5
|
|||
|
|||
|
Re: Only half of the robot turns
After the robot was rebuilt the issue disappeared. Thanks for all your help though guys.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|