Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   My mecanum method wont strafe (http://www.chiefdelphi.com/forums/showthread.php?t=82804)

Robototes2412 16-02-2010 11:55

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)

BradAMiller 16-02-2010 15:55

Re: My mecanum method wont strafe
 
There is a macanum drive method built into the RobotDrive class in WPILib. If you create a RobotDrive object with the port numbers for the 4 SpeedControllers, you can call the holonomicDrive method that takes a direction (X and Y value) and a rate of rotation. There are a number of teams that are using that code and it seems to be working for them.

If you would like to write it yourself, feel free to check out the source code for that class. The math is pretty well tested.

Robototes2412 16-02-2010 16:34

Re: My mecanum method wont strafe
 
the holoNomic Drive function wont let my robot go forwards

BradAMiller 16-02-2010 17:13

Re: My mecanum method wont strafe
 
Quote:

Originally Posted by Robototes2412 (Post 921428)
the holoNomic Drive function wont let my robot go forwards

It's designed for 4 macanum wheels toed in 45 degrees. Is that what you have?

Here are the comments for the holonomicDrive method:
Code:

    /**
    * Holonomic drive class for Mecanum wheeled robots.
    *
    * Experimental class for driving with Mecanum wheeled robots. There are 4 wheels
    * on the robot, arranged so that the front and back wheels are toed in 45 degrees.
    *
    * For holonomic drive with omni-wheels, the rotation value will need to be
    * offset based on the drive configuration.
    *
    * @param magnitude The speed that the robot should drive in a given direction.
    * @param direction The direction the robot should drive in degrees. The direction and maginitute are
    * independent of the rotation rate.
    * @param rotation The rate of rotation for the robot that is completely independent of
    * the magnitute or direction.
    */


Robototes2412 16-02-2010 17:58

Re: My mecanum method wont strafe
 
We have the wheels as such (birds-eye view):
Code:

\/
/\

(from bottom)
Code:

/\
\/


Daedalus 16-02-2010 19:26

Re: My mecanum method wont strafe
 
Quote:

Originally Posted by Robototes2412 (Post 921475)
We have the wheels as such (birds-eye view):
Code:

\/
/\

(from bottom)
Code:

/\
\/


You need to switch your wheels. The bottom view should look like your top view currently does. That should fix your problem, the reason your robot will not work right now is because the force vectors are incorrect and will prevent your robot from moving.

jhersh 17-02-2010 02:51

Re: My mecanum method wont strafe
 
Quote:

Originally Posted by Daedalus (Post 921556)
You need to switch your wheels. The bottom view should look like your top view currently does. That should fix your problem, the reason your robot will not work right now is because the force vectors are incorrect and will prevent your robot from moving.

Actually he has it correct and you are recommending that he make it wrong. The bottom should be a diamond.

Robototes2412 17-02-2010 13:18

Re: My mecanum method wont strafe
 
then we spent an hour switching the wheels for nothing?

jhersh 17-02-2010 14:04

Re: My mecanum method wont strafe
 
Quote:

Originally Posted by Robototes2412 (Post 922099)
then we spent an hour switching the wheels for nothing?

It would seem so. It appears that is the only post that user account has made. Perhaps if you had searched you would have seen this thread or this thread or this thread.

Searching is your friend... you don't have to wait for a reply and others don't have to keep answering the same questions.

-Joe


All times are GMT -5. The time now is 09:38.

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