Here is the (Python) code I used for getting my Saitek Pro Flight Yoke (http://www.saitek.com/uk/prod/yoke.htm) data from the device into something usable. Python has a fantasic pygame library which reads joystick data. This is just a simple script that is short and sweet. This code reads all the motion axis (ie. the yoke, hat and throttles, ) and all of the buttons. Feel free to play around with it. I really dont want to use a RC transmitter for my UAV as I can so so much more with this device. Let me know what you think.And you don't need the Pro Flight Yoke to use this - any joystick will do :)USAGE NOTE: to execute type 'python filenameyousavethecodeas.py'######################## START CODE ##############################import pygamejoy = []# Handel the joystick eventdef handleJoyEvent(e):# Check for joystick axis movementif e.type == pygame.JOYAXISMOTION:axis = "unknown"if (e.dict['axis'] >= 0):axis = 'a' + str(e.dict['axis'])if (axis != "unknown"):s = "%s|%f" % (axis, e.dict['value'])print s# Check for buttonsif e.type == pygame.JOYBUTTONDOWN:if(e.dict['button'] >= 0):print 'b' + str(e.dict['button'])# wait for joystick inputdef joystickControl():while True:e = pygame.event.wait()if (e.type == pygame.JOYAXISMOTION or e.type == pygame.JOYBUTTONDOWN):handleJoyEvent(e)# main methoddef main():# initialize pygamepygame.joystick.init()pygame.display.init()if not pygame.joystick.get_count():print "\nPlease connect a joystick and run again.\n"quit()print "\n%d joystick(s) detected." % pygame.joystick.get_count()for i in range(pygame.joystick.get_count()):myjoy = pygame.joystick.Joystick(i)myjoy.init()joy.append(myjoy)print "Joystick %d: " % (i) + joy[i].get_name()print "Depress trigger (button 0) to quit.\n"# run joystick listener loopjoystickControl()# allow use as a module or standalone scriptif __name__ == "__main__":main()
I'm using the same system that you are with different code from and I am trying to connect it with two xbees.and it's not really working. We are using one of them in the developer board and trying to send the commands to the other xbee which is hooked up to the rx pins in the other end in the arduino connected to the servos. I was wondering if you had tried experimenting with that and if you had any suggestions.
Noth666, I haven't decided yet. I was going to go with the longest range system I could find. I have been putting alot of time into researching my wireless communication system since I don't want to fork a ton of cash for one I regret getting a week later.
Which XBee are you using for this? I am working on something very similar but using Saitek Hotas joystick and throttle/rudder with XBee 868. Will prolly make my own tranceivers as I am not impressed with the XBees tho.
Well I have to say if your willing to pay for it. The Saitek ProFlight Series has really nice stuff. I have the throttle box and yoke system as mentioned above.
As for data relay delay, because I have around 80 inputs just from my joystick device I am planning on only sending updates of positions that have changed since their last recognized. That way the whole 3KB/s limit on the XBee is met, well, I hope. I will let you know once I get some more test results with beefier code.
Hi Matt, nice job.
I'd like to do something similar, i.e. replacing the RC with PC + joystick + Xbee
but I'm wondering about the delays introduced by the whole system.
Have you got any figures about the time delays ?
thank you
Comments
Hello
can Someone help to connect
Saitek Joystick X56 + Scherrer Tx700 Pro + Rx700 LR +PSU
in order to fly a quadcopter ?
And if it is impossible
How to connect the TX700 Pro and the Quanum V52 Ground Control System, please?
https://hobbyking.com/en_us/winbox-ground-control-system-v52.html https://hobbyking.com/en_us/rx700lr-psu-reseller.html
https://hobbyking.com/en_us/tx700-pro-reseller.html
Thanks
I'd like to do something similar, i.e. replacing the RC with PC + joystick + Xbee
but I'm wondering about the delays introduced by the whole system.
Have you got any figures about the time delays ?
thank you