Go to Post Of course even though its less than a week until kickoff, dave can still change the rules to make bearhugging me in automode a bonus - Mike Schroeder [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-02-2011, 20:45
dboisvert dboisvert is offline
Registered User
AKA: Dan Boisvert
FRC #2405 (Divided by Zero)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Michigan
Posts: 57
dboisvert is an unknown quantity at this point
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?
Reply With Quote
  #2   Spotlight this post!  
Unread 09-02-2011, 22:29
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Mecanum Drifting

Are you using Victors or Jaguars to control the motor? How are you defining the four motors in your initialization code?
Reply With Quote
  #3   Spotlight this post!  
Unread 09-02-2011, 22:51
dboisvert dboisvert is offline
Registered User
AKA: Dan Boisvert
FRC #2405 (Divided by Zero)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Michigan
Posts: 57
dboisvert is an unknown quantity at this point
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);
Reply With Quote
  #4   Spotlight this post!  
Unread 09-02-2011, 23:41
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Mecanum Drifting

Quote:
Originally Posted by dboisvert View Post
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.
Reply With Quote
  #5   Spotlight this post!  
Unread 10-02-2011, 00:08
dboisvert dboisvert is offline
Registered User
AKA: Dan Boisvert
FRC #2405 (Divided by Zero)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Michigan
Posts: 57
dboisvert is an unknown quantity at this point
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!
Reply With Quote
  #6   Spotlight this post!  
Unread 12-02-2011, 01:29
dboisvert dboisvert is offline
Registered User
AKA: Dan Boisvert
FRC #2405 (Divided by Zero)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Michigan
Posts: 57
dboisvert is an unknown quantity at this point
Re: Mecanum Drifting

Just wanted to say that this did indeed fix our problem!

Thank you very much Alan!
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 15:22.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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