ROBOTC.net forums
http://www.robotc.net/forums/

FTC - Arcade Code
http://www.robotc.net/forums/viewtopic.php?f=52&t=8519
Page 1 of 1

Author:  GONZO [ Wed Apr 16, 2014 7:57 pm ]
Post subject:  FTC - Arcade Code

Hello Internet and People of FRC. My name is Daniel Gonzalez and I am registered to compete in my towns Science fair and do the robotics challenge. I am from the FRC Team 2582 Pantherbots, so therefore I know how to play with the big toys, but now that I am in the world of smaller portable Tetrix robots, I have a question.

I competed last year and got first place, but i hate the Tank Drive Code I had...

With that being said. Do any of you graciously professional Robot Folk have a working arcade Drive Code that I could use on my robot? It has four DC motors with the standard wheels, and I of course have my controllers daisy chained, if that makes life easeier for any of those who reply.

Thanks a bunch guys. (Oh yeah, don't ask for the code I have, it is quite junky and you wouldn't really like it)

:eek: :bigthumb:

Author:  MHTS [ Wed Apr 16, 2014 10:12 pm ]
Post subject:  Re: FTC - Arcade Code

If it helps you, here is the Drive code in our library. It has code for both Arcade Drive, Tank Drive Mecanum Drive and even Swerve Drive. It supports both 2-motor or 4-motor drives.
http://proj.titanrobotics.net/hg/Ftc/20 ... ib/drive.h

Author:  GONZO [ Wed Apr 16, 2014 10:22 pm ]
Post subject:  Re: FTC - Arcade Code

MHTS wrote:
If it helps you, here is the Drive code in our library. It has code for both Arcade Drive, Tank Drive Mecanum Drive and even Swerve Drive. It supports both 2-motor or 4-motor drives.
http://proj.titanrobotics.net/hg/Ftc/20 ... ib/drive.h


You my friend have just made my day. Thank you so very much! Now I can stop trying to Google things and keep writing new codes! Thanks again.

Peace, Love, and robot grease.

Author:  Bug of Doom [ Wed Feb 10, 2016 6:05 pm ]
Post subject:  Re: FTC - Arcade Code

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

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/