|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Programming Mecanum
Hi! I'm having trouble programming the mecanum wheels. I can make the robot move sideways and rotate but I cannot make it move forward and backward and I'm not sure why. I included the important parts of my code below.
Code:
Joystick joy1 = new Joystick(1); RobotDrive drivetrain = new RobotDrive(1, 3, 2, 4);//Front Left - 1, Rear Left - 2, Front Right - 3, Rear Right - 4 double magnitude = joy1.getMagnitude(); double direction = joy1.getDirectionDegrees(); double rotation = joy1.getZ(); drivetrain.mecanumDrive_Polar(magnitude, direction, rotation); Last edited by PANTHERPROJECT : 04-02-2014 at 14:47. |
|
#2
|
|||||
|
|||||
|
Re: Programming Mecanum
Have you tried just using the X, Y, and Z axis instead of the Magnitude and Direction?
|
|
#3
|
||||
|
||||
|
Re: Programming Mecanum
I have but it didn't help.
|
|
#4
|
||||
|
||||
|
Re: Programming Mecanum
Put the bot up on blocks (wheels off the ground) and give it a pure forward command. Tell us what each of the four wheels do. |
|
#5
|
||||
|
||||
|
Re: Programming Mecanum
You could check to see if your drive motors need to be inverted. You could do this in code, or just swap red/black on one side of your robot.
Might not be the answer but another thing to try! |
|
#6
|
|||
|
|||
|
Re: Programming Mecanum
Quote:
Code:
RobotDrive drivetrain = new RobotDrive(1, 2, 3, 4); Last edited by nyaculak : 04-02-2014 at 22:10. Reason: Forgot to close code tag in the quote...like html all over again ;) |
|
#7
|
||||
|
||||
|
Re: Programming Mecanum
All the wheels spin inwards
|
|
#8
|
||||
|
||||
|
Re: Programming Mecanum
Quote:
|
|
#9
|
||||
|
||||
|
Re: Programming Mecanum
That's why it won't go forward of course.
What do the wheels do when you give a pure reverse command? A pure strafe right command? etc Last edited by Ether : 09-02-2014 at 18:37. |
|
#10
|
||||
|
||||
|
Re: Programming Mecanum
When given the pure reverse command, I believe they all spin outward but the wheels work fine while shifting to the right, left and rotating so if I were to invert the motors it wouldn't help much.
|
|
#11
|
|||||
|
|||||
|
Re: Programming Mecanum
Quote:
Code:
RobotDrive(int frontLeftMotor, int rearLeftMotor, int frontRightMotor, int rearRightMotor)
Constructor for RobotDrive with 4 motors specified with channel numbers.
|
|
#12
|
|||
|
|||
|
Re: Programming Mecanum
Code for doing Mecanum with joysticks looks like this:
Code:
myRobotDrive.mecanumDrive_Cartesian(joy1.getX(), joy1.getY(), joy1.getTwist()); One possible problem is that some of the motors may need to be inverted depending on how they are configured. To determine that, put the robot on blocks and drive it with the joysticks and see what it is doing. You can call the Code:
setInvertedMotor() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|