Control Servos with UltraBorg and joystick

Forums:

Hi,

i´m currently building an robot with an diablo board who is controlled with the joystick and over 3G or WIFI.
I used your joystick example for the main code. Thanks for this. This is working fine.

My next step was to control an pan/tilt cam with two servos, i´ve written a script who allows me co control the servos with the keyboard. it´s working ok, but not the best soultion. Now i´m think about buying an ultraborg for this and i would be great to control the servos with the joystick (ps2 controller) too.

Do you have any experience with controlling servos an joystick? is this possbile?
It would be interesting for me before buying the ultraborg. any help is highly appreciated.

thanks a lot
vjeko

piborg's picture

It should be fairly easy to modify existing Diablo or PicoBorg Reverse scripts to work with UltraBorg instead.

If we take diabloJoystick,py as an example:

  • The import should be changed to import UltraBorg
  • The setup section should be replaced with the UltraBorg version
  • DIABLO.SetMotorX should be replaced with UB.SetServoPositionX
  • DIABLO.MotorsOff can either be removed, or replaced with a set position move
  • DIABLO.ResetEpo should be removed, it is not needed for UltraBorg

This will link the servo position(s) to the joystick position(s).

You can extend this with some variables to make the joysticks slow change the position instead, like I imagine you are doing with the keyboard already.
Simply add the joystick value to the current position (UB.GetServoPositionX), but multiplied by some small value, like 0.1 for instance.

wow, thanks for that quick answer.
ultraborg is already ordered :)

thanks
vjeko

Subscribe to Comments for "Control Servos with UltraBorg and joystick"