Thread: 4 Motor Drive
View Single Post
  #3   Spotlight this post!  
Unread 08-02-2010, 00:58
imcmahon01 imcmahon01 is offline
Registered User
FRC #1143
 
Join Date: Feb 2010
Location: Scranton, PA
Posts: 8
imcmahon01 has a spectacular aura aboutimcmahon01 has a spectacular aura aboutimcmahon01 has a spectacular aura about
Re: 4 Motor Drive

There is a specific function built for Mecanum wheel drive that you may find useful called holonomic drive. Now, it's not tank drive, but it does provide videogame-like controls for left-right strafing:

in the RobotTemplate() constructor, as before:

m_robotDrive = new RobotDrive(1, 3, 2, 4);
m_rightStick = new Joystick(1);
m_leftStick = new Joystick(2);

and in teleopPeriodic()
m_robotDrive.holonomicDrive( m_leftStick.getMagnitude(), m_leftStick.getDirectionDegrees() ,m_rightStick.getX());


We got this code to work, and plugged the PWM cables in as such:

Front of Robot
1 2

3 4
Rear of Robot

The only thing to note is, in this configuration motors 2 & 4 need to have their Jaguar M- and M+ motor power outputs reversed to the motors in order to work properly. Otherwise, you could fix this issue in your code by using the setInvertedMotor() function on 2 & 4. You can see our robot in action here. Hope this helps!
Reply With Quote