Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Programming Mecanum Wheels (http://www.chiefdelphi.com/forums/showthread.php?t=134303)

michaelyork 10-02-2015 17:08

Programming Mecanum Wheels
 
I have tried searching CD and WPILib for a while now, and tried everything. How do you do mecanum wheel programming?

legts 10-02-2015 18:19

Re: Programming Mecanum Wheels
 
Hi! I've dug up a few mechanum links from wpi located here: http://wpilib.screenstepslive.com/s/...botdrive-class and here: http://wpilib.screenstepslive.com/s/...-mecanum-drive.

I don't know if they particularly relate to your team's robot, but they will hopefully be useful! My team has done mechanum drivetrain for the two years I have been on the team, so let me know if you have any questions or need more explanation! :)

Ether 10-02-2015 18:52

Re: Programming Mecanum Wheels
 
Quote:

Originally Posted by michaelyork (Post 1441415)
I have tried searching CD and WPILib for a while now, and tried everything. How do you do mecanum wheel programming?

WPILib RobotDrive.java

Code:

    /**
    * Drive method for Mecanum wheeled robots.
    *
    * A method 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.
    * When looking at the wheels from the top, the roller axles should form an X across the robot.
    *
    * This is designed to be directly driven by joystick axes.
    *
    * @param x The speed that the robot should drive in the X direction. [-1.0..1.0]
    * @param y The speed that the robot should drive in the Y direction.
    * This input is inverted to match the forward == -1.0 that joysticks produce. [-1.0..1.0]
    * @param rotation The rate of rotation for the robot that is completely independent of
    * the translation. [-1.0..1.0]
    * @param gyroAngle The current angle reading from the gyro.  Use this to implement field-oriented controls.
    */
    public void mecanumDrive_Cartesian(double x, double y, double rotation, double gyroAngle) {
        if(!kMecanumCartesian_Reported) {
            UsageReporting.report(tResourceType.kResourceType_RobotDrive, getNumMotors(), tInstances.kRobotDrive_MecanumCartesian);
            kMecanumCartesian_Reported = true;
        }


michaelyork 12-02-2015 19:31

Re: Programming Mecanum Wheels
 
I have no idea why this code is not working, any ideas, I have been stressing about it for the past two hours. :ahh:
Code:

        double magnitude = driveStick.getMagnitude();
        double direction = driveStick.getDirectionDegrees();
        double rotation = otherStick.getTwist();
        RobotDrive driveTrain = new RobotDrive(3,4,5,6);
        while (isEnabled() && isOperatorControl()) {
               
                driveTrain.mecanumDrive_Polar(magnitude, direction, rotation);
                Timer.delay(0.005);
        }

This is located in teleopPeriodic() in Robot.java.

Any ideas?

cstelter 12-02-2015 22:43

Re: Programming Mecanum Wheels
 
You probably want to fetch the current values from your joystick *inside* the while(isEnabled && isOperatorControl()) loop. Otherwise you take the reading once and keep sending them over and over.


All times are GMT -5. The time now is 10:53.

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