View unanswered posts | View active topics It is currently Thu Apr 28, 2016 4:19 pm






Reply to topic  [ 4 posts ] 
4 Motor Arcade Driving Control 
Author Message
Rookie

Joined: Sun Sep 20, 2009 6:00 pm
Posts: 1
Post 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.
Code:
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?


Sun Sep 20, 2009 6:14 pm
Profile
Rookie

Joined: Sat Aug 30, 2008 2:25 am
Posts: 25
Post Re: 4 Motor Arcade Driving Control
This is what I use:

Code:
#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];
    wait1Msec(10);
  }
}


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.


Sun Oct 25, 2009 3:16 pm
Profile
Rookie

Joined: Thu Aug 15, 2013 9:11 pm
Posts: 1
Post 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)


Thu Aug 15, 2013 9:18 pm
Profile
Rookie

Joined: Thu Jan 28, 2016 1:26 pm
Posts: 6
Location: Virginia, USA
Post 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!)

Code:
     
      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

_________________
PM me with any and all questions! I can tackle programming and mechanical issues.

Bug


Wed Feb 10, 2016 6:11 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.