Holonomic Drive System Issues, Robot Drives Diagonally...

Our robot is acting a bit wonky. We have a holonomic drive system made with the omni wheels, and mechanically everything seems sound. So, all that is left is the code. Here is our code:

  public void operatorControl() {

        System.out.println("operatorControl");
        initAll(); //init all variables
        while (true && isOperatorControl() && isEnabled()) {
            getReadings(); //Get the readings for the drive
            spikeTrigger(); //Get the readings for the actuator on the arm and map them, comment out to debug
            driveRobot.mecanumDrive_Polar(leftMagnitude, leftDirection, rotationRate);
 

            Timer.delay(0.01);
        }

That code is just for our drive. Here is where we declare things and such:

  private void getReadings() {


        leftMagnitude = leftStick.getMagnitude();
        leftDirection = leftStick.getDirectionDegrees();
        rotationRate = rightStick.getAxis(Joystick.AxisType.kX);
        Timer.delay(0.01);

    }

Here are some more:

 Joystick leftStick = new Joystick(1);
    Joystick rightStick = new Joystick(2);
    Jaguar jagFrontLeft = new Jaguar(1);
    Jaguar jagFrontRight = new Jaguar(2);
    Jaguar jagBackLeft = new Jaguar(3);
    Jaguar jagBackRight = new Jaguar(4);
    Victor victorLeft = new Victor(5);
    Victor victorRight = new Victor(6);
   Relay spike1 = new Relay(7);
    Relay spike2 = new Relay(8);
    RobotDrive driveRobot = new RobotDrive(jagFrontLeft, jagBackLeft, jagFrontRight, jagBackRight);
    Gyro roboGyro = new Gyro(2);
    double leftMagnitude = 0;
    double leftDirection = 0;
    double rotationRate = 0;

Can anyone here spot anything that seems off to you? I have never programmed a holonomic drive, nor was I really prepared, but I wanted to give it a try. Any help would be appreciated.

Attached is a diagram of what our robot tends to do. The green arrow is the direction that it is supposed to travel, and the red arrow is the direction that it actually travels. :confused:

We are using the Logitech Attack3 Joysticks, and yes I have tried to read most of the documentation that is already present on this forum. Specifically the posts by “Ether,” those posts really helped… The problem exists in the fact that I don’t really understand the calculations and diagrams presented in them.

Thanks in advance.

2745

OH! and all of our PWM cables are plugged in properly/in the right slot

lolbot.png


lolbot.png

If you are using omniwheels, they should be mounted at 45 degree angles from your frames edges. If you mount them parallel to your frames edges, the robot will travel diagonally when you command it straight if you use the holonomic code from wpilib. What does your drive system look like?

Our wheels are mounted at the 45 degree angles needed.

Here is a link to our frame pictures:
http://www.chiefdelphi.com/media/photos/36312

Wheels@45.png


Wheels@45.png

I am working with this team as a mechanical mentor but I am not an engineer. (just an old chemistry teacher with 10 years of FRC experience)
Here is an image of their drive-base prior to mounting of the electronics board.
http://www.chiefdelphi.com/media/photos/36312
The battery is currently mounted just behind the front right wheel and other than that massive object, all of the current weight distribution is very symmetrical.

Could you do the following very simple test and post the results? This would help greatly to diagnose the problem:

  • put the robot up on blocks

  • command pure forward motion and observe and record what each of the four wheels is doing

  • do the same for reverse, strafe right, strafe left, rotate clockwise, and rotate counter-clockwise

And one more thing: you don’t need to understand all the calculations and diagrams if that is not your area of interest. There are some posts and papers which just show how to program, for example:

http://www.chiefdelphi.com/media/papers/download/2906

We have a similar drive base as you do. I don’t see anything wrong with your code but I know that we switched from the Meccanum Polar method to the Meccanum Cartesian because polar seemed to be giving odd results. (I know it shouldn’t matter but it seemed to help us and it makes positioning easier for us).

When you put the robot on blocks and run the code does it still not power all the wheels? It may be that they are all trying to go strait but without some sort of programmed correction they are at such different speeds that it drives diagonally. Wheel slip with an omni holonomic platform is really hard to remove completely with a mechanical solution.

We corrected for this by getting field centric control working with the gyro. Without that our drive base becomes much harder to control. The gyro is able to control our angle and keeps our heading. If we do drift off of strait the driver has a much easier time correcting because he only has to correct one axis (the X axis if we are trying to drive strait forward).

This is a link to our code repository. If you have any questions please ask.
Our Code

We are also attempting to get Velocity control working but haven’t been successful yet because our encoders have been giving us some problems.

Hope this helps and I look forward to seeing you at Alamo,
Allen Gregory

Are you aware that this is a known bug in the FPGA code, and solutions have been posted?

http://www.chiefdelphi.com/forums/showthread.php?t=89153

http://www.chiefdelphi.com/forums/showthread.php?t=89257

Usually two motors need to be inverted. Are any of yours inverted in HW, because I don’t see them inverted in the code.

That is not actually correct, straight forward and back are the only things that will work correctly if using omni’s mounted parallel to the frame. But you are certainly correct, they must be at 45s to work for anything else.

Thank you Ether, I did know it was a known issue but I actually hadn’t seen one of the solutions that you posted. I’ll see if it works tonight. We also have a hardware problem where one of our encoders is not returning the right number of counts per revolution, but that is either a mounting problem or a broken encoder.

Joe said “If you mount them parallel to your frames edges,”

He meant mount each one parallel to its respective edge, like the attached image.

**

omni.png


omni.png

I always forget about that option. It would appear to be a bit unstable in the corners as drawn. I know you just drew it up for discussion purposes. I wonder how many FRC applications have used the “+” holonomic verses the “X” holonomic system. I suppose one could set up a traditional 4 wheel tank steer with omniwheels all the way around and then add the center front and center rear wheels to add stafe and diagonal motions…:cool:

Ah! Oops! :o
My apologies for doubting you, Joe.
Thanks Ether

We tried this last year and I can say that it is extremely hard to get traction on all six wheels. If your robot is not perfectly level and balanced it will be extremely easy to lose traction and not be able to strafe. It gave us nothing but headaches. I am not saying it’s impossible it just is very difficult (more so than the standard x configuration).

One thing to note about the plus configuration is that you will travel slower in the robots orthogonal directions then you would traveling at 45 degree angles. Omni wheeled holonomic robots gain velocity when all 4 wheels are powering them because each wheel actually has a velocity vector perpendicular to it’s normal velocity. The whole robot is able to travel faster than any one wheel velocity. In a perfect world a 4 wheeled omni wheel holonomic platform with wheels 90 degrees apart will travel ~1.4 times faster than wheel velocity when traveling 45 degrees to any wheel.

You could just redesign the robot so the “front” is on one of the corners but that could make things tricky for manipulators. I agree that the plus would be harder to balance as well.

yes

Omni wheeled holonomic robots gain velocity when all 4 wheels are powering them because each wheel actually has a velocity vector perpendicular to it’s normal velocity.

not sure I follow that

The whole robot is able to travel faster than any one wheel velocity. In a perfect world a 4 wheeled omni wheel holonomic platform with wheels 90 degrees apart will travel ~1.4 times faster than wheel velocity when traveling 45 degrees to any wheel.

I think you need explain that more clearly. The robot will go at its maximum speed in the direction any pair is going in for the omni@45 arrangement. And .7071 of that speed in the regular front-back side-side directions. The ratio is 1.4, but you give the impression that it will go faster than its wheels are turning, which is impossible in any direction.

I have found that Ether is better at explaining this than me. You can look at the gif that he attached on this page

There are several research papers published on this (mostly for robocup).

Thus, the addition of angled omni-wheels can result in a net body velocity that is greater than the maximum radial velocity of the wheel (Ashmore and Barnes, pg. 7).

That paper goes on to say that by traveling with rotation and in an arch a holonomic robot can travel even faster. We have thought about creating a control scheme that takes advantage of this but it would be very difficult, in the context of a FIRST robot.

Omni vehicle with 45 degree-mounted wheels goes faster in the forward direction than omega*R (R being wheel radius and omega being wheel angular velocity in rad/sec).

A chart comparing omni, mecanum, and standard wheels can be found here.

A force analysis of mec vs omni can be found here. A kinematic analysis can be done using a similar approach.

**

Ether, I have to go build a robot now, I’ll take a look.

So, judging by the responses that I have seen so far, the consensus is that it is not a coding problem? ::rtm::

I would say that it is not a problem with the code that you posted here.

It may be a problem with cRIO or the electronics. (Have you updated your cRIO image to the one that was released this week?)

Also you may want to try using mecanumDrive_Cartesian(giving x and y axis instead of magnitude and direction) instead of polar and see if that works better for you.

Have you tested on blocks and seen which wheels spin when you move each joystick axis? When you move the joysticks, do all four wheels ever spin? If you apply full power forward do your Jaguars light up in the way they are supposed to? (two red and two green most likely)

If you are still having this problem at Alamo(I hope you resolve it by than), I’ll try and stop by your pit and see what we can do.