4 Motor Arcade Driving Control
Page 1 of 1

Author:  Sudo [ Sun Sep 20, 2009 6:14 pm ]
Post subject:  4 Motor Arcade Driving Control

I have been trying to get four motor drive on one stick for a few weeks now. I took the sample code for two motors and tryed to adapt that for four. So far my code looks like this.
task main()
   bMotorFlippedMode[port2] = 1;    
   bMotorFlippedMode[port4] = 1;
   bVexAutonomousMode = false;         

   while (true)   
      motor[port1] = vexRT[Ch4] - vexRT[Ch3];
      motor[port3] = vexRT[Ch3] + vexRT[Ch4];
      motor[port2] = vexRT[Ch3] + vexRT[Ch4];
      motor[port4] = vexRT[Ch4] - vexRT[Ch3];
    motor[port5] = vexRT[Ch5];

I need motor 2 and 4 going the opposite way, as they are only one gear over from the wheels. Right now as my code is set, If I push the left stick forward, it will go forward. Back goes back, but left goes right and right goes left. Is there anyway to get this working?

Author:  fryfrog [ Sun Oct 25, 2009 3:16 pm ]
Post subject:  Re: 4 Motor Arcade Driving Control

This is what I use:

#pragma config(Motor,  port1,           LeftMotor1,           tmotorNormal)
#pragma config(Motor,  port2,           RightMotor1,          tmotorNormal)
#pragma config(Motor,  port7,           LeftMotor2,           tmotorNormal)
#pragma config(Motor,  port8,           RightMotor2,          tmotorNormal)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
  bMotorFlippedMode[LeftMotor1] = 1;
  bMotorFlippedMode[LeftMotor2] = 1;
  bVexAutonomousMode = false;
  while (true) {
    motor[LeftMotor1]  = vexRT[Ch3] + vexRT[Ch4];
    motor[RightMotor1] = vexRT[Ch3] - vexRT[Ch4];
    motor[LeftMotor2]  = vexRT[Ch3] + vexRT[Ch4];
    motor[RightMotor2] = vexRT[Ch3] - vexRT[Ch4];

But it sounds like you just need to flip the direction on the correct motors. I'd just experiment, making sure one of the paired motors is unplugged so that they don't fight each other (assuming they are directly connected). Also, I noticed that I always do Ch3 (+ or -) Ch4 where as you swap the two sometimes.

Author:  JarredCool [ Thu Aug 15, 2013 9:18 pm ]
Post subject:  Re: 4 Motor Arcade Driving Control

I'm new to robot c and I'd like to convert my 4-wheel arcade drive to robot c. How can I do that? All 4 wheels go the same direction. (If looked everywhere for a tutorial without luck)

Author:  Bug of Doom [ Wed Feb 10, 2016 6:11 pm ]
Post subject:  Re: 4 Motor Arcade Driving Control

Totally a long over-due reply, but coding in a simpler version at some point needs to be provided. (Hah, Mathew, how about looking now. . . ? sorry)

This is the coding we used for our holonomic drive, but it's pretty much the same. We wanted to be able to strafe, so arcade drive was pretty much a must. (We need it for states. Go 1231E!)

      motor[backLeftChassis] = vexRT[Ch3Xmtr2] - vexRT[Ch1Xmtr2] + vexRT[Ch4Xmtr2];
      motor[frontLeftChassis] = vexRT[Ch3Xmtr2] - vexRT[Ch1Xmtr2] - vexRT[Ch4Xmtr2];
      motor[backRightChassis] = vexRT[Ch3Xmtr2] + vexRT[Ch1Xmtr2] - vexRT[Ch4Xmtr2];
      motor[frontRightChassis] = vexRT[Ch3Xmtr2] + vexRT[Ch1Xmtr2] + vexRT[Ch4Xmtr2];

Other note: We placed our drives on our second controller, and of course all teams do not need to. If something went wrong, we wanted to still be able to shoot, even if we wouldn't be able to move. (Pre-loads, whoop, whoop!)
The first part, vexRT[Ch3Xmtr2] is to make the robot go forward. Pretty simple.
The second part allows the robot to turn. The - and + tell the robot how the motors should run, telling them to either run normally (+) or inversly (-).
The third part was made for our strafeing. Anyone with a regular drive needn't worry about this. But it follows the same principle as going forward and backwards. (The - or + can easily be determined by checking which way your wheels spin. Remember the rules of a holonomic drive when coding!

PM me with any questions! Bug

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group