Hello friends, I'm using Google Translate!
Maybe the translation is not very good.
I am needing help developing code to control 2 DC Motors + 2 Bridge-H IBT2 + PS3 Joystick.
My Robo is TANK type
The problem is that I want to control both using only 1 Analog Stick (Left), then using the X and Y Axis.
The Right Stick will remain to control the paintball gun.
The problem is that as I push the joystick forward (Y-axis) the two motors go forward!
BUT if I push forward and to the right (Y axis + X axis) the right motor needs to slow down, and the left one to increase! So that it turns to the right.
pagoto:
The problem is that I want to control both using only 1 Analog Stick (Left), then using the X and Y Axis.
The problem is that as I push the joystick forward (Y-axis) the two motors go forward!
BUT if I push forward and to the right (Y axis + X axis) the right motor needs to slow down, and the left one to increase! So that it turns to the right.
Conceptually this is simple, you need to linearly combine the X and Y values appropriately like:
int X = read_joystick_X () - X_centre_value;
int Y = read_joystick_Y () - Y_centre_value;
int left_drive = Y+X ;
int right_drive = Y-X ;
Note all values are signed, which you'll have to take account of when converting to outputs for a motor driver.