rock candy controller

Forums:

Hello,

I am using the UltraBorg to control the servo and ultrasonics on my PiWars robot. All is working well and your GUI allows me to control the servo with precision. At the moment I am using the GUI via my phone and a VNC connection to the Pi on the robot.
While this works fine with just the tiniest lag the rest of the robot is controlled via a rock candy game controller using a python script. So I'm having to use two controllers and as the event the servo is involved in is timed its not ideal.
So to my question. Is it possible to control the servo and UltraBorg using the game controller?
I reckon it is as I've done it with the servo attached to the Pi's GPIO but trying to adapt the GUI/controller code has me stumped. Any hints? Id like to work it out myself but looking at the example I'm having brain melt.
Or is it better just to go the way I have it set up?

Thanks Neal

piborg's picture

It is definitely possible to control servos connected to UltraBorg from a game controller :)

We have an existing example for a PS3 controller which controls robot movement using the joysticks and four servos from an UltraBorg using the D-pad and the symbol buttons:
DiddyBorg v2 - Examples - MeArm Claw.

It should be possible to adapt this script to work with a Rock Candy controller instead by changing the button values to match the correct buttons.

The robot control will probably work as-is with a robot using ThunderBorg to control the motors, but it might need some slight tweaking (motor speed / direction).

If you are using a different motor controller instead you can either:

  1. Remove the lines which control the ThunderBorg / motor output. This will hopefully let you run this script at the same time as your current robot control script.
  2. Replace the lines which control the ThunderBorg output with the code necessary to control your robot. This will take a bit more effort but it keeps everything as a single script :)
Subscribe to Comments for "rock candy controller "