PS3 controller


I was able to link a PS3 controller and bluetooth dongle to the raspberry pi and run the It is working, but I noticed when I turn left or right the inner wheels stop driving completely and only the outer wheels drive.

If I hold down R2, then the inner wheels change direction and drive at the same speed as the outer wheels. My question is whether the inner wheels stopping is normal behavior during a turn. It seems that it would turn better if they reversed direction but drove at a slower speed.

piborg's picture

The way DiddyBorg is moving for you is how we intended him to work, however he can be configured differently fairly easily as well.
The controls are setup in the following mode by default:

No special butons held:
Drive at full speed, only use braking to turn DiddyBorg.

R2 held:
Drive at full speed, use full tank steering (wheels on the other side turn the opposite way).

L2 held:
Drive at half speed, only use braking to turn DiddyBorg.

L2 + R2 held:
Drive at half speed, use full tank steering (wheels on the other side turn the opposite way).

If you would rather have R2 work the other way around so it disables tank steeing instead of enabling it, there is a small mod you can do to the scripts.

In change:

                # Apply steering speeds
                if not joystick.get_button(buttonFastTurn):
                    leftRight *= 0.5


                # Apply steering speeds
                if joystick.get_button(buttonFastTurn):
                    leftRight *= 0.5

the same change can be made to on line 309.

If you would rather they did turn slowly in the opposite direction you can adjust how much 'turning' is applied by changing the multiplier:

  • 0      - Turning is disabled
  • 0.25 - Turing only slows the motor to 50%
  • 0.5   - Turning stops the motors (current behaviour)
  • 0.75 - Turning uses the motors the opposite direction at 50%
  • 1      - Full tank steering (R2 button will have no effect)

For example:

                # Apply steering speeds
                if not joystick.get_button(buttonFastTurn):
                    leftRight *= 0.75

would provide 50% speed in the opposite direction with R2 released, and full tank steering with R2 held.

Thanks for the fast response. I was misinterpreting leftRight values, thinking that 0.5 should be half speed. Perhaps I hadn't read far enough. Lowering the speed of the inner wheels did not have the effect that I had hoped for, so I get why stopping them from turning is the default option.

Subscribe to Comments for "PS3 controller"