# Arcade vs Tank speed/power difference

My team is pretty green to programming, it using the example programs for Vex C++ the boys made a 4WD drive program for both Arcade driving and Tank driving. We are finding that the Arcade program does not have the power to get the bot on top of the platform, but the Tank program does. Nothing in those programs does anything to the velocity except take it from the joystick position. Why would this be? We can’t figure it out.

So as a follow-up, because arcade driving seems to be easier for our driver, we would like to figure out how to program it to be arcade driving up until getting on to the platform, and then either switch to Tank, or just use a couple of buttons to just drive full power straight up on the platform. We have tried a couple of variations to the arcade program, but have not been successful. How would you code this?

Thanks,
Cheryl
Coach of Mission Control

Could you post your drive code? My team has used both arcade and tank and neither one has given us issues

Can’t right now because the laptop is not here, and I’m on my iPad. But it was basically the same as the sample code in VCS, except adding a motor to each side: LeftMotorFront and LeftMotorRear with the same code, and RightMotorFront and RightMotorRear with the same code, very simple. As in the sample code, the Arcade style takes the joystick axes and averages (/2) to get the velocity and direction. We are very simple here.

Arcade drive code is often written as (pseudocode)

`` set motor power  = (drive axis + turn axis)/2``

This is to prevent providing more than 100% power to the motor. I am guessing that your students may have used such code, and are driving at half the speed they think they are telling the motor to spin. If they eliminate the /2, they can rely on the brain capping the power to the motor at 100%, or could filter that value themselves…

``````int leftPower = Controler1.Axis3.value() + Controler1.Axis4.value() ;
if (leftPower >100){leftPower = 100;}
LeftMotor.spin(directionType::fwd, leftPower, velocityUnits::pct);``````

A shorter way to do this same thing is

``````double leftPower = Controller.Axis1.value() + Controller.Axis4.value() < 100 ? Controller.Axis1.value() + Controller.Axis4.value() : 100;
``````

Interesting. Not sure if I thoroughly understand this, but gives me an idea of something to try. However, if axis 3 is at over 50 pct and axis 4 is anything over 50 pct, then it will be 100, so this will be making it harder for them to control or maintain a very slow speed, right? We will have to see if they feel this would be ok.

Think of it like this: If axis 3 is at 100 pct, then it will be 100, and if axis 4 is at a positive or negative pct, it will decrease one side of the drive to less than 100. So to maintain a speed of 50, all one has to do is push the axis 3 joystick up 50 pct.
Sorry if this doesn’t make sense, basically what I’m saying is that if you want to be able to go at full speed, then controlling a slow speed is just as easy as it can be.

(Poindexter voice) Ehheemm… excuse me, but, in this case the, um, ahem ternary is actually, ahem, more characters.

``````Controler1.Axis3.value() + Controler1.Axis4.value() ; if (leftPower > 100{leftPower = 100;}

Controller.Axis1.value() + Controller.Axis4.value() > 100 ? Controller.Axis1.value() + Controller.Axis4.value() : 100;``````

(end Poindexter voice)

but it makes sense to make it single line