View Single Post
  #1   Spotlight this post!  
Unread 16-02-2010, 11:55
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
My mecanum method wont strafe

I wrote this after looking at some documentation someone wrote up.

Code:
    public void mechanumDrive(double v, double r, double s){
        /*
         * You all love Dr. Tran, so Try His mega-awesome MECANUM DRIVE!!!
        */
        double FLval; double FRval; double RLval; double RRval;
        FLval = v - r - s;
        FRval = v + r + s;
        RLval = v - r + s;
        RRval = v + r - s;

        FLjag.set(FLval);
        FRjag.set(FRval);
        LRjag.set(RLval);
        RRjag.set(RRval);
        
        /*if (leftStick.getRawButton(2)) {
            v = v * Math.sqrt(2.0);
            double dirInRad = (s + 45.0) * 3.14159 / 180.0;
            double cosD = Math.cos(dirInRad);
            double sinD = Math.sin(dirInRad);

            FLval = sinD * v - r;
            FRval = cosD * v + r;
            RLval = sinD * v + r;
            RRval = cosD * v - r;

            FLjag.set(FLval);
            FRjag.set(FRval);
            LRjag.set(RLval);
            RRjag.set(RRval);
            
        }*/
        
    }

    void rawStrafe(String direction, double speed) {
        direction.toLowerCase();
        if (direction.compareTo("left") == 0) {
            FLjag.set(-speed);
            FRjag.set(speed);
            RRjag.set(-speed);
            LRjag.set(speed);
        } else if (direction.compareTo("right") == 0) {
            FLjag.set(speed);
            FRjag.set(-speed);
            RRjag.set(speed);
            LRjag.set(-speed);
        }
    }
I cannot get either if these to strafe. what happens when I try is the wheels "stick" in place (thats about the best way I can describe it)

Last edited by Robototes2412 : 16-02-2010 at 11:57. Reason: cruft removal
Reply With Quote