Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Holonomic Drive Issues With Strafing (http://www.chiefdelphi.com/forums/showthread.php?t=152694)

minisolarclown 15-12-2016 19:01

Holonomic Drive Issues With Strafing
 
I'm having issues with holonomic driving with our meccanum robot. Driving forwards and backwards on the y-axis is working, and so is turning left and right with the twist-axis, but moving left and right on the x-axis isn't working. I know that in order to drive sideways, the wheels on one side have to be spinning away from each other, while the wheels on the other side need to spin towards each other. The moving back and forth and turning left and right is working, but when I try strafing, both sets of wheels spin away from each other, which is not correct. Here is my drive code (java):

Code:

double x = -Math.pow(joy1.getRawAxis(0), 3);
                            double y = -Math.pow(joy1.getRawAxis(1), 3);
                            double rot = -Math.pow(joy2.getRawAxis(0), 3);
                           
                            if(Math.abs(x)>=0.1 || Math.abs(y)>=0.1 || Math.abs(rot)>=0.1) {
                                    mainDrive.mecanumDrive_Cartesian(x, rot, y, gyro.getAngle());
                            }


The -Math.pow(); statements are for sensitivity, while the if statement is for a threshold. "x" is the x-axis, "y" is the y-axis, and "rot" is rotation. joy1 and joy2 are joysticks. If this is a mechanical problem, how do I fix it? If it is a programming problem, how do I fix it?

Christopher149 15-12-2016 20:40

Re: Holonomic Drive Issues With Strafing
 
How did you initialize mainDrive? Are the motors in the order (int frontLeftMotor, int rearLeftMotor, int frontRightMotor, int rearRightMotor) (from documentation)?

minisolarclown 15-12-2016 21:38

Re: Holonomic Drive Issues With Strafing
 
Quote:

Originally Posted by Christopher149 (Post 1621653)
How did you initialize mainDrive? Are the motors in the order (int frontLeftMotor, int rearLeftMotor, int frontRightMotor, int rearRightMotor) (from documentation)?

I initialized it a little differently. I used victors instead of ints, but it still gives the same effect. All of the victors are programmed and wired correctly. The parameters inside Victor(x) is its pin.

Code:

Victor backLeftMotor = new Victor(1);
Victor backRightMotor = new Victor(2);
Victor frontLeftMotor = new Victor(3);
Victor frontRightMotor = new Victor(4);
       
RobotDrive mainDrive = new RobotDrive(frontLeftMotor, backLeftMotor, frontRightMotor, backRightMotor);


Ether 16-12-2016 01:13

Re: Holonomic Drive Issues With Strafing
 
Quote:

Originally Posted by minisolarclown (Post 1621597)
when I try strafing, both sets of wheels spin away from each other

Does this happen when you trying strafing to the right, or to the left?



minisolarclown 16-12-2016 07:14

Re: Holonomic Drive Issues With Strafing
 
Quote:

Originally Posted by Ether (Post 1621702)
Does this happen when you trying strafing to the right, or to the left?



It does the exact same thing when trying to strafe either direction.

GeeTwo 16-12-2016 09:20

Re: Holonomic Drive Issues With Strafing
 
Quote:

Originally Posted by Ether (Post 1621702)
Does this happen when you trying strafing to the right, or to the left?

Quote:

Originally Posted by minisolarclown (Post 1621721)
It does the exact same thing when trying to strafe either direction.

Please double check that - do the spin towards each other when strafing left and away from each other when strafing right, vice versa, or always away from each other?

If either of the first two cases, it sounds like the front and rear wheels on one side are swapped, as for rotation and driving forward/reverse, the two wheels on each side do the same thing.

Edit: The simplest scenario I can think of for the last case is if you are squaring the strafe joystick instead of cubing it. (or some other even power) on top of having one side wheels swapped.

minisolarclown 16-12-2016 17:38

Re: Holonomic Drive Issues With Strafing
 
When trying to move left and right, the wheel always move towards each other. The exponent is three, so it's not a parabola when you graph it. The exponent is to give more control over the lower speeds. At my next robotics practice, I'll try switching motors around.

GeeTwo 16-12-2016 21:08

Re: Holonomic Drive Issues With Strafing
 
Quote:

Originally Posted by minisolarclown (Post 1621597)
..when I try strafing, both sets of wheels spin away from each other..

Quote:

Originally Posted by minisolarclown (Post 1621828)
When trying to move left and right, the wheel always move towards each other.

Both of these conditions will result in no net movement, but they are not the same. Put the robot on blocks and attempt a strafe to the right. The front left wheel and rear right wheels should drive forward, and the other two in reverse. If I'm understanding you at all, two of these will be the opposite of what they should be. Swap these two motors. Whether you do this through declarations in software, swapping of PWM cables, or swapping of power cables from the motor controllers to the motors will not make any functional difference, but you should double check that the wiring and software match each other; hopefully you will find the problem on inspection and fix the "right" thing. If you swap the "wrong" things, it will work for now, but you will be even further confused if you ever encounter another issue, or if someone notices that the documentation and wiring don't match and quietly "fix" the problem by making reality match the documentation.



Quote:

Originally Posted by minisolarclown (Post 1621828)
The exponent is three, so it's not a parabola when you graph it. The exponent is to give more control over the lower speeds.

Yes, I have seen the "raising to power" solution to enhance sensitivity at the low end. The biggest downside of this seems to be expansion of the deadband. The Victor SSP has a 4% deadband, and the Victor 888 a 5.4% deadband. If the joystick inputs are cubed, this gives the SSP an effective 34% deadband, and the 888 an effective 38% deadband. If, instead, you square the results but preserve sign (e.g. with joy * abs(joy)), the deadbands are only expanded to 20% and 23%, which are still rather large. I recall once writing a "joystick_adj" function which allowed me to tune the amount of gain. On that occasion, I wound up using something like:
Code:

double joystick_adj(double raw)
{
    return raw * pow(abs(raw),0.3);
}

Which would have given a dead band of 8.4% or 10.6% for these victors, but which still resulted in considerably more effective sensitivity at the low end. The neat thing about the form above is that you can modify that 0.3 up or down until your drivers are most happy with it.

Ether 16-12-2016 22:18

Re: Holonomic Drive Issues With Strafing
 
Quote:

Originally Posted by minisolarclown (Post 1621828)
The exponent is three, so it's not a parabola when you graph it. The exponent is to give more control over the lower speeds.

https://www.chiefdelphi.com/media/papers/2421



minisolarclown 19-12-2016 21:16

Re: Holonomic Drive Issues With Strafing
 
Thank you guys so much for helping me! All I had to do was invert the motors on the right and change some parameters


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

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