Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Mecanum Drifting (http://www.chiefdelphi.com/forums/showthread.php?t=91385)

dboisvert 09-02-2011 20:45

Mecanum Drifting
 
We have been working on a mecanum chassis for this years competition. We are using the mecanum cartesian function provided in the library. We feed it the following values.

Code:

(joystickx, joysticky, joysticktwist, 0.0)
The robot drives fine using this except it seems to drift one way quite a bit (especially at lower speeds). We have been trying to correct for this in the programming, but to no avail.

The motors are configured like this
| = andymark toughbox
- or _ = cim

|- -|
|_ _|

And the chains go from the output straight to the wheel (so nothing fancy there). In the code we had to invert two of the motors so they would spin in the right direction. I was wondering if that would cause the robot to drift because of the cims spinning slower in reverse.

I would just like to gather input from the community because I have racked my brain on this one for a while.

Is it mechanical / electrical?
If not suggestions for how to fix the drifting in the code?

Alan Anderson 09-02-2011 22:29

Re: Mecanum Drifting
 
Are you using Victors or Jaguars to control the motor? How are you defining the four motors in your initialization code?

dboisvert 09-02-2011 22:51

Re: Mecanum Drifting
 
We are using Victors

Code:

RobotDrive *m_robotDrive;
m_robotDrive = new RobotDrive(1, 2, 3, 4);

we inverted the right hand side motors in the code by doing this

Code:

m_robotDrive->SetInvertedMotor(RobotDrive::kFrontRightMotor, true);
m_robotDrive->SetInvertedMotor(RobotDrive::kRearRightMotor, true);


Alan Anderson 09-02-2011 23:41

Re: Mecanum Drifting
 
Quote:

Originally Posted by dboisvert (Post 1019611)
We are using Victors

Code:

RobotDrive *m_robotDrive;
m_robotDrive = new RobotDrive(1, 2, 3, 4);


I think that's the root of your problem. The version of the RobotDrive constructor that takes four PWM channel numbers sets them up as Jaguars. You need to open four Victors and pass them to the version of the RobotDrive constructor that takes four motor references.

The reason this makes a difference is that the factory-calibrated neutral PWM value for a Victor is slightly higher than the neutral PWM value for a Jaguar. Because of the incorrect translation from -1..1 speed control to PWM pulse width, you'll end up running motors a bit faster in reverse than with the same forward speed command. In your case, the right motors will go faster than the left ones when you're driving forward. At very low speeds, the difference will be relatively large.

dboisvert 10-02-2011 00:08

Re: Mecanum Drifting
 
Definitely makes sense, I see that in the RobotDrive source it defaults to jaguars.

Quote:

You need to open four Victors and pass them to the version of the RobotDrive constructor that takes four motor references.
I will give this a try sometime tomorrow and let you know how it turned out.

Thanks a ton for the help!

dboisvert 12-02-2011 01:29

Re: Mecanum Drifting
 
Just wanted to say that this did indeed fix our problem!

Thank you very much Alan!


All times are GMT -5. The time now is 13:55.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi