Separately Controlled Drive Motors Help

For my Over Under bot I’m using separate motors for autonomous programming (Left motors are L1, L2 and the right is r1, and r2) I find this makes programming more consistent so I want to stick with it. The problem I have run into is how do I have the joysticks control the 4 motors based on their position? I want both forwards and reverse and turning on the left joystick but I cant get a code to work. The code I made would only allow for forward or backwords or turn so I can drive while turning. Does anyone have any ideas to help? Thank you

Here’s some pseudo-pseudocode:


void Drive::control_arcade(){
  float throttle = deadband(controller(primary).Axis3.value(), 5);
  float turn = deadband(controller(primary).Axis1.value(), 5);
  DriveL.spin(fwd, to_volt(throttle+turn), volt);
  DriveR.spin(fwd, to_volt(throttle-turn), volt);
}

1 Like

This is a common technique some teams use called arcade drive. More information is available here: Arcade Drive - BLRS Wiki

1 Like

Manually coding the motors requires a little bit of adding and subtracting if you’re using arcade control, with different math for the left motors than the right.
Here’s a screenshot of a drivecode I just whipped up in blocks (using your setup and motor names)
image
This drivecode will allow you to turn while driving forwards, so you’re able to move in an arc

2 Likes