4 Wheel Drive Programming Help

Whenever I drive my robot it’s always very twitchy, I’m trying to find a solution to that and I think it has something to do with how fast my robot is to which I hope to slow it down.

This is my program:

  int AxisValue1=(Controller1.Axis3.value()+Controller1.Axis4.value())/2;
   int AxisValue2=(Controller1.Axis3.value()-Controller1.Axis4.value())/2;
   FrontLeftDrive.spin(directionType::fwd, AxisValue1,velocityUnits::pct);
   FrontRightDrive.spin(directionType::fwd, AxisValue2,velocityUnits::pct);
   BackLeftDrive.spin(directionType::fwd, AxisValue1,velocityUnits::pct);
   BackRightDrive.spin(directionType::fwd, AxisValue2,velocityUnits::pct);

Can someone help me find a way I can slow the motors a bit and make it so that turning left or right isn’t as fast?

Maybe the twitchiness has something to do with the amount of weight on your robot. Is your robot very light?
Also, I find it quite strange that you have defined your axis values outside of your spin commands. I would recommend trying out putting your axis values inside, like this example:

 BLDrive.spin(directionType::fwd, Controller.Axis3.value() + Controller.Axis1.value(), velocityUnits::pct);

However, this is for arcade driving, not tank driving, so if you don’t prefer arcade driving then don’t use my code character for character.
You could also try setting your brakeType to coast.
Hope that helps. Good luck with your coding! :smiley:

2 Likes

Verify that the brake setting for your drivetrain motors are set to Coast. If during auton you are using the “rotate to” commands on the drivetrain, then the brake setting will automatically be set to Hold.

1 Like

You should look into a cubic filter for your joystick signal: Anybody linearized the motor power yet?

2 Likes