Chief Delphi

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

Ether 23-01-2010 13:30

Re: Programming Mecanum
 
Quote:

Originally Posted by Daniel Jones (Post 901675)
The holonomic drive function will work with either mecanum or with a 4-wheel omni drive if the wheels are oriented 90 degrees from eachother, arranged like this:
/\
\/

on your diagram above for holonomic drive, when using mecanum wheels does it matter which way they are oriented?

.

Zrob 27-01-2010 18:41

Re: Programming Mecanum
 
Ah, yes it works pretty well, except there's you gotta use

Code:

drive.holonomicDrive(leftStick.getMagnitude(), leftStick.getDirectionDegrees(), rightStick.getX());
holonomicDrive takes magnitude first, then direction.

One thing though: There's these weird delays, which I'm attempting to fix.

Imadapocalypse 29-01-2010 01:38

Re: Programming Mecanum
 
Okay at this moment our programmers are working on trying to figure out the holonomic drive method. The motors are connected to the correct PWMs and we've been using the exact code given here in the forum but through our misfortune we have came up with the notion that the holonomic drive class has errors. Depending on what we do to our code the wheels will run in opposite directions, forward, or rotate; but never reverse.

We think it has something to do with the order of the parameters. Our programming works better if we put rotation where magnitude goes and vice versa. Direction is still much of a mystery.

As you can probably surmise from this entry our troupe of programmers are confused at this point. Right now our mentor is planning to copy the holonomic drive class in order to play with it to see if that yields any positive results.

omalleyj 29-01-2010 13:20

Re: Programming Mecanum
 
Do you need to set the motors on one side inverted? When we first just tried we noticed the wheels on one side were reversed and we needed to add:

setInvertedMotor(RobotDrive.MotorType motor, boolean isInverted)

Robototes2412 15-02-2010 21:43

Re: Programming Mecanum
 
Can someone please post the java scource code for the holonomicDrive Function?

BradAMiller 16-02-2010 17:10

Re: Programming Mecanum
 
Quote:

Originally Posted by Robototes2412 (Post 920921)
Can someone please post the java scource code for the holonomicDrive Function?

The code is posted below, but anyone with Java can simply look at the source code by opening the project that comes with the distribution:
Code:

    public void holonomicDrive(double magnitude, double direction, double rotation) {
        double frontLeftSpeed, rearLeftSpeed, frontRightSpeed, rearRightSpeed;
        magnitude = limit(magnitude);
        double cosD = Math.cos((direction + 45.0) * 3.14159 / 180.0);
        double sinD = Math.cos((direction - 45.0) * 3.14159 / 180.0);
        frontLeftSpeed = limit((sinD * magnitude + rotation));
        rearLeftSpeed = limit((cosD * magnitude + rotation));
        frontRightSpeed = limit((cosD * magnitude - rotation));
        rearRightSpeed = limit((sinD * magnitude - rotation));

        m_frontLeftMotor.set(frontLeftSpeed * m_invertedMotors[MotorType.kFrontLeft_val]);
        m_frontRightMotor.set(frontRightSpeed * m_invertedMotors[MotorType.kFrontRight_val]);
        m_rearLeftMotor.set(rearLeftSpeed * m_invertedMotors[MotorType.kRearLeft_val]);
        m_rearRightMotor.set(rearRightSpeed * m_invertedMotors[MotorType.kRearRight_val]);
    }


PapaRobocat 17-02-2010 16:11

Re: Programming Mecanum
 
How do we program these wheels when they do not drive straight? In stupid terms cause I do not understand all the programming lingo.

jase728 04-04-2010 23:00

Re: Programming Mecanum
 
A good idea is to set up each motion (eg front or strafe) separately
then get the axis from your joystick this will get the magnitude
you will have to figure out the math


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

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