View Single Post
  #2   Spotlight this post!  
Unread 23-02-2012, 21:09
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Arcade drive method bug?

We also found a potential bug in ArcadeDrive. According to the code below, a positive rotateValue will make the robot turn left and negative will make it turn right. As far as I understand it, this is opposite to convention. I cross checked this with MecanumDrive_Cartesian where positive rotation will turn right and negative rotation will turn left (which agrees with convention). We found this by accident because we had to change our wheels from Mecanum to regular and all the sudden the robot turns the other way.
Code:
void RobotDrive::ArcadeDrive(float moveValue, float rotateValue, bool squaredInputs)
{
    ....
    if (moveValue > 0.0)
    {
        if (rotateValue > 0.0)
        {
            leftMotorOutput = moveValue - rotateValue;
            rightMotorOutput = max(moveValue, rotateValue);
        }
        else
        {
            leftMotorOutput = max(moveValue, -rotateValue);
            rightMotorOutput = moveValue + rotateValue;
        }
    }
    else
    {
        if (rotateValue > 0.0)
        {
            leftMotorOutput = - max(-moveValue, rotateValue);
            rightMotorOutput = moveValue + rotateValue;
        }
        else
        {
            leftMotorOutput = moveValue - rotateValue;
            rightMotorOutput = - max(-moveValue, -rotateValue);
        }
    }
}
__________________
Reply With Quote