|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? |
|
#2
|
|||
|
|||
|
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)?
|
|
#3
|
|||
|
|||
|
Re: Holonomic Drive Issues With Strafing
Quote:
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); |
|
#4
|
||||
|
||||
|
Re: Holonomic Drive Issues With Strafing
Quote:
|
|
#5
|
|||
|
|||
|
Re: Holonomic Drive Issues With Strafing
It does the exact same thing when trying to strafe either direction.
|
|
#6
|
|||||
|
|||||
|
Re: Holonomic Drive Issues With Strafing
Quote:
Quote:
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. Last edited by GeeTwo : 12-16-2016 at 11:57 AM. Reason: fixed quote tag |
|
#7
|
|||
|
|||
|
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.
|
|
#8
|
|||||
|
|||||
|
Re: Holonomic Drive Issues With Strafing
Quote:
Quote:
Quote:
Code:
double joystick_adj(double raw)
{
return raw * pow(abs(raw),0.3);
}
|
|
#9
|
||||
|
||||
|
Re: Holonomic Drive Issues With Strafing
Quote:
|
|
#10
|
|||
|
|||
|
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
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|