View Single Post
  #1   Spotlight this post!  
Unread 02-10-2013, 10:05
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Maintaining perfect control of mecanums using encoders?

Hey! My team and I built a robot with mecanum wheels over the course of three days a few weeks ago, and right off the bat we had issues driving, because the motor controllers were extremely biased to move faster in one direction than the other. We solved this by running all of our motor outpute through these methods
Code:
	//motor speed control method
	public static float fix (float fixme) {
		return fixme < 0.00f ? 1.00f : 0.95f;
		//manipulates motor values based on direction only
	}
	
	//overload motor speed control method
	public static float fix (int motorID, float fixme) {
		if      (motorID == 1){ return (fixme < 0f)? 1:0.95f; }  //frontLeft
		else if (motorID == 2){ return (fixme < 0f)? 1:0.85f; }  //frontRight
		else if (motorID == 3){ return (fixme < 0f)? 1:0.75f; }  //backLeft
		else if (motorID == 4){ return (fixme < 0f)? 1:0.65f; }  //backRight
		else return 0;
		//manipulates motor values based on direction and ID (slower, more precise)
	}
At the competition last year, there were two or three teams using mecanum wheels, two of which said that they were using encoders to maintain perfect movement (probably also using PID loops...). I would like to learn how to do this. I have no idea where to begin, though, because mecanum wheels tend to spin in any direction at any speed depending on the actions being performed. Any ideas on how to do this would be greatly appreciated! Thanks!