control track/chain vehicle with gamepad (joystick)

Hi,

I have a track vehicle with 4 dc motors and a arduino uno.
I paired my arduino with my PS3-Controller over Bluetooth and know
I need a algorithm to control the 4 motors with the joystick.
I can read the X,Y coordinates from the controller, thats fine, but I need a mapping algorithm
to map the 2D-Vector (X,Y) to the 4D-Vector (M1,M2,M3,M4) of the Motors.

M1 === M2
+++
+++
+++
M3 === M4

Regards
Thanks for help

Ronny

but I need a mapping algorithm
to map the 2D-Vector (X,Y) to the 4D-Vector (M1,M2,M3,M4) of the Motors.

You don't have a 4D vector of motors. You have 4 discrete motors.

What do you want to have happen when the stick is pushed straight forward? Pulled straight back? Pushed forward and to the right?

With a tracked vehicle, does it make sense to run the two motors on one side at different speeds or in different directions? Not to me, which means that you really only need to consider the speed and direction of the right set of motors and the speed and direction of the left set of motors.

ronnycsharp:
I paired my arduino with my PS3-Controller over Bluetooth

Cool! What hardware and software did you use?

I know a lot of people really like the PS3 controller but I think the PS3 controller isn't as easy to use with the Arduino as some of the other game controllers.

ronnycsharp:
I need a algorithm to control the 4 motors with the joystick.

I second the questions PaulS asked:

PaulS:
What do you want to have happen when the stick is pushed straight forward? Pulled straight back? Pushed forward and to the right?

A common control algorithm is to use the Y axis position for the base speed of the motors and then add the X axis position to one motor while subtracting the X axis position from the other motor.

Let's say positive X is to the right and positive Y is forward. Let's also assume positive motor speeds will propel the robot forward. With these assumptions we can use the following algorithm.

    speedLeft = joystickY + joystickX;
    speedRight = joystickY - joystickX;

I posted an example of using input from a RC receiver in this post. I don't think I tested the code posted in the other thread. The assumptions I made above about joystick directions and motor directions are not correct for the system I used when I wrote the code.

Hi,

for the ps3 controller, I have a USB-Shield and on the shield is a bluetooth speed link.
With the speed link I can connect to the ps3 controller, but first you have to get MAC-Adresse of the PS3-Controller with a Software on the PC. Its not so difficult.

control:

If my controller is Y = 0, (Zero, Middle) and I turn on the X to 1 (right), I want to rotate the vehicle to right,

if my controller is Y = 1; X = 0; it should drive forward (all motors on), also also backward,

if my controller is Y = 1; X = 1; (right, up); it should drive forward and turn to the right,

I don't know how to write a algorithm for that case.

Regards
Ronny

ronnycsharp:
I don't know how to write a algorithm for that case.

The algorithm I gave earlier should work.

Previous similar discussions.

http://forum.arduino.cc/index.php/topic,157967.0.html