|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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?
|
|
#2
|
||||
|
||||
|
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);
Then add Code:
drive.tankDrive(leftStick,rightStick); 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 ![]() |
|
#3
|
|||
|
|||
|
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! |
|
#4
|
||||
|
||||
|
what if were are using victors ? what does it need to be done on the code to use victors ?
|
|
#5
|
||||
|
||||
|
Re: 4 Motor Drive
Victors more or less = jaguars
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Single Motor Drive | Team2339 | NI LabVIEW | 1 | 02-04-2009 11:43 PM |
| Tracking Servo motor with drive motor in Labview | mbone206 | Technical Discussion | 5 | 01-28-2009 05:32 PM |
| Motor drive function? | Mike | Programming | 3 | 02-15-2006 11:55 AM |
| Screw drive motor | top dog | Motors | 7 | 02-01-2005 09:43 AM |
| 8 Drive Motor Robot | Dan Izzo | Motors | 9 | 04-28-2002 11:08 PM |