Go to Post I've been busier than a hog farmer at feedin' time. - Andy Baker [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 06-02-2010, 08:09
gbf1991 gbf1991 is offline
Registered User
FRC #3011
 
Join Date: Jan 2010
Location: Wiesbaden, Germany
Posts: 6
gbf1991 is an unknown quantity at this point
4 Motor Drive

Hello, our team is having trouble, and we need help. We're using a 4 wheeled drive (w/Mecanum wheels), but we can't figure out how to program it as a tank drive. Can anyone out there help us?
Reply With Quote
  #2   Spotlight this post!  
Unread 06-02-2010, 13:35
phencer42's Avatar
phencer42 phencer42 is offline
Registered User
FRC #1517 (P4)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2005
Location: NH
Posts: 40
phencer42 is on a distinguished road
Send a message via MSN to phencer42
Re: 4 Motor Drive

Start with the given Simple Robot Template and add the import "edu.wpi.first.wpilibj.*"

Then add
Code:
    RobotDrive drive = new RobotDrive(1,2,3,4);
    Joystick leftStick = new Joystick(1);
    Joystick rightStick = new Joystick(2);
under "public class RobotTemplate extends SimpleRobot"

Then add
Code:
drive.tankDrive(leftStick,rightStick);
under "public void operatorControl()".

This will give you a tank drive system for a four motor robot with front left motor in port 1, back left in port 2, front right in port 3, and rear right in port 4 using the left joystick in port 1 and the right joystick in port 2. Best of luck
__________________
Study=No Fail
No Study=Fail
No Study+Study=No Fail+Fail
(No+1)Study=(No+1)Fail
Study=Fail
Reply With Quote
  #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
  #4   Spotlight this post!  
Unread 20-02-2010, 11:01
/*P4bl0*/'s Avatar
/*P4bl0*/ /*P4bl0*/ is offline
Registered User
FRC #0231
 
Join Date: Apr 2008
Location: Pasadena Tx.
Posts: 12
/*P4bl0*/ can only hope to improve
Question Re: 4 Motor Drive

what if were are using victors ? what does it need to be done on the code to use victors ?
Reply With Quote
  #5   Spotlight this post!  
Unread 20-02-2010, 17:41
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: 4 Motor Drive

Victors more or less = jaguars
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Single Motor Drive Team2339 NI LabVIEW 1 04-02-2009 23:43
Tracking Servo motor with drive motor in Labview mbone206 Technical Discussion 5 28-01-2009 17:32
Motor drive function? Mike Programming 3 15-02-2006 11:55
Screw drive motor top dog Motors 7 01-02-2005 09:43
8 Drive Motor Robot Dan Izzo Motors 9 28-04-2002 23:08


All times are GMT -5. The time now is 11:12.

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