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
Mon, 05/18/2015 - 19:42
Permalink
UltraBorg and Joysticks
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:import UltraBorg
DIABLO.SetMotorX
should be replaced withUB.SetServoPositionX
DIABLO.MotorsOff
can either be removed, or replaced with a set position moveDIABLO.ResetEpo
should be removed, it is not needed for UltraBorgThis 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.v.tokic.phone@g...
Mon, 05/18/2015 - 20:27
Permalink
wow, thanks for that quick an
wow, thanks for that quick answer.
ultraborg is already ordered :)
thanks
vjeko