|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
My mecanum method wont strafe
I wrote this after looking at some documentation someone wrote up.
Code:
public void mechanumDrive(double v, double r, double s){
/*
* You all love Dr. Tran, so Try His mega-awesome MECANUM DRIVE!!!
*/
double FLval; double FRval; double RLval; double RRval;
FLval = v - r - s;
FRval = v + r + s;
RLval = v - r + s;
RRval = v + r - s;
FLjag.set(FLval);
FRjag.set(FRval);
LRjag.set(RLval);
RRjag.set(RRval);
/*if (leftStick.getRawButton(2)) {
v = v * Math.sqrt(2.0);
double dirInRad = (s + 45.0) * 3.14159 / 180.0;
double cosD = Math.cos(dirInRad);
double sinD = Math.sin(dirInRad);
FLval = sinD * v - r;
FRval = cosD * v + r;
RLval = sinD * v + r;
RRval = cosD * v - r;
FLjag.set(FLval);
FRjag.set(FRval);
LRjag.set(RLval);
RRjag.set(RRval);
}*/
}
void rawStrafe(String direction, double speed) {
direction.toLowerCase();
if (direction.compareTo("left") == 0) {
FLjag.set(-speed);
FRjag.set(speed);
RRjag.set(-speed);
LRjag.set(speed);
} else if (direction.compareTo("right") == 0) {
FLjag.set(speed);
FRjag.set(-speed);
RRjag.set(speed);
LRjag.set(-speed);
}
}
Last edited by Robototes2412 : 16-02-2010 at 11:57. Reason: cruft removal |
|
#2
|
|||
|
|||
|
Re: My mecanum method wont strafe
There is a macanum drive method built into the RobotDrive class in WPILib. If you create a RobotDrive object with the port numbers for the 4 SpeedControllers, you can call the holonomicDrive method that takes a direction (X and Y value) and a rate of rotation. There are a number of teams that are using that code and it seems to be working for them.
If you would like to write it yourself, feel free to check out the source code for that class. The math is pretty well tested. |
|
#3
|
||||
|
||||
|
Re: My mecanum method wont strafe
the holoNomic Drive function wont let my robot go forwards
|
|
#4
|
|||
|
|||
|
Re: My mecanum method wont strafe
Quote:
Here are the comments for the holonomicDrive method: Code:
/**
* Holonomic drive class for Mecanum wheeled robots.
*
* Experimental class for driving with Mecanum wheeled robots. There are 4 wheels
* on the robot, arranged so that the front and back wheels are toed in 45 degrees.
*
* For holonomic drive with omni-wheels, the rotation value will need to be
* offset based on the drive configuration.
*
* @param magnitude The speed that the robot should drive in a given direction.
* @param direction The direction the robot should drive in degrees. The direction and maginitute are
* independent of the rotation rate.
* @param rotation The rate of rotation for the robot that is completely independent of
* the magnitute or direction.
*/
|
|
#5
|
||||
|
||||
|
Re: My mecanum method wont strafe
We have the wheels as such (birds-eye view):
Code:
\/ /\ Code:
/\ \/ Last edited by Robototes2412 : 16-02-2010 at 18:20. Reason: oops |
|
#6
|
|||
|
|||
|
Re: My mecanum method wont strafe
You need to switch your wheels. The bottom view should look like your top view currently does. That should fix your problem, the reason your robot will not work right now is because the force vectors are incorrect and will prevent your robot from moving.
|
|
#7
|
|||
|
|||
|
Re: My mecanum method wont strafe
Actually he has it correct and you are recommending that he make it wrong. The bottom should be a diamond.
|
|
#8
|
||||
|
||||
|
Re: My mecanum method wont strafe
then we spent an hour switching the wheels for nothing?
|
|
#9
|
|||
|
|||
|
Re: My mecanum method wont strafe
It would seem so. It appears that is the only post that user account has made. Perhaps if you had searched you would have seen this thread or this thread or this thread.
Searching is your friend... you don't have to wait for a reply and others don't have to keep answering the same questions. -Joe |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Dashboard wont work... | nadavsen2 | C/C++ | 2 | 22-09-2012 15:43 |
| SIGNAL LIGHT WONT WORK | kick3nitx360 | Electrical | 57 | 18-02-2010 22:36 |
| Team 930's bump strafe | Brewerboy82 | Robot Showcase | 23 | 08-02-2010 19:35 |
| cRIO wont run software | ThisAintJeff | NI LabVIEW | 4 | 02-02-2010 15:47 |
| G4 wont turn on! | MattK | General Forum | 14 | 26-08-2003 09:44 |