Go to Post the Robotics team isn't just a club, it's a family. - 1086Programmer [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 29-01-2013, 15:17
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: Error with the RobotDrive

If you are using ArcadeDrive, there is a bug in WPILib in my opinion. I have reported it last year and I am surprise to see it not fixed for this year. See code excerpt below:
If both moveValue and rotateValue are positive, I am expecting the robot to go forward and turn to the right by convention. But as you can see, when both values are positive and for demonstration purpose, let's say moveValue equals to rotateValue. leftMotorOutput will be zero and rightMotorOutput will be some positive number. This will make the robot to turn left, not right!
If you want to argue that my understanding of the convention is wrong, then please look at MecanumDrive_Cartesian and apply the same values (both Y and rotation being positive and equal and X is 0). You will see the left motor powers will be the sum of Y and rotation which are both positive and the right motor powers will be zero. So the robot is turning right. So the convention in mecanum drive is different from the arcade drive! So my conclusion is that ArcadeDrive is wrong.
Code:
WPILib\RobotDrive.cpp line 439:
if (moveValue > 0.0)
{
        if (rotateValue > 0.0)
        {
                leftMotorOutput = moveValue - rotateValue;
                rightMotorOutput = max(moveValue, rotateValue);
        }
        else
        {
                leftMotorOutput = max(moveValue, -rotateValue);
                rightMotorOutput = moveValue + rotateValue;
        }
}
Code:
WPILib\RobotDrive.cpp line 501:
    wheelSpeeds[kFrontLeftMotor] = xIn + yIn + rotation;
    wheelSpeeds[kFrontRightMotor] = -xIn + yIn - rotation;
    wheelSpeeds[kRearLeftMotor] = -xIn + yIn + rotation;
    wheelSpeeds[kRearRightMotor] = xIn + yIn - rotation;
BTW, the way we fixed it was to have our own DriveBase class that inherits the RobotDrive class. We then override the ArcadeDrive method that negates the rotation argument.
__________________

Last edited by mikets : 29-01-2013 at 15:24.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:06.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi