|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Syncronous motor speed with encoders
Hello! We're considering using building another robot with Mecanum wheels for an off-season project to apply what we know as far as programming, but there may be a problem.... From what I've read, there can be a lot of problems when using holonomic steering if the motors aren't spinning at exactly the correct speed. I'm fairly certain that the absolute value of the wheel speed always has to be the same. I know that the simplest code for holonomic drive is
Code:
public void mecanumDrive_Cartesian(double x, double y, double rotation, double gyroAngle) |
|
#2
|
|||
|
|||
|
Re: Syncronous motor speed with encoders
I don't know if this is a live thread, but I will suggest two options anyway.
If you want to use the WPI code you linked, the most straight forward method would be to use CAN Jaguar speed controllers and hook up encoders on each wheel connected directly to the Jaguar. Then you setup the Jaguars to do the PID loop on each wheel. There are many posts on how to do this, but the most successful seems to be to adjust the I term first and then the P term. The other option would be to write your own Holonomic code - it is not that difficult. Ether has a link to some pseudo code that works well. My team took this approach and the robot was driving in about an hour. To address the wheel speed issue, the consensus is that you need gyro feedback. Keep in mind that even if the wheels are all spinning at exactly the correct speeds, the force vector they create is a function of the weight on the wheel. If the CG is off or one wheel is lifted off the ground the robot could spin violently. The gyro can help redirect power to the wheels to compensate. |
|
#3
|
||||
|
||||
|
Re: Syncronous motor speed with encoders
Hey! This thread isn't entirely dead :P We did end up completing our mecanum chassis (3 days from start to finish). What we wound up doing was writing our own mecanum code (thanks Ether) and ten compensating for the speed differences by multiplying each value by a constant which we figured out by trial and error (probably the simplest and worst solution). It looked like this:
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)
}
Code:
Motor->Set(speedval*(fix(speedval)) |
|
#4
|
|||
|
|||
|
Re: Syncronous motor speed with encoders
Quote:
As for your wheel velocity correction method, yes it will work (for some time) but will not adapt for changes in the environment or robot. Your range of gains is larger than I have seen in the past, and you might want to look for the root cause. The only time I have had one wheel off that much, we tracked it down to a CIM with a very slightly bent output shaft, which caused the spur gear to over engage the gearbox and load the motor more. Start by looking at your slowest wheel and check your weight distribution. Is the frame planar? With the robot on a flat surface, try sliding a piece of paper under each wheel. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|