Log in

View Full Version : A library to simulate joystick button press events?


hyprvx
13-07-2014, 07:16
So basically, I have an idea involving my team's robot, music, and LED light strips. My code is going to be in two parts, Python and LabVIEW (what the robot is currently coded in, moving to C++ in 2015). A Python script will have an animation, pressing one of four "buttons" that gets sent to the DS software, sending it to the robot. On these "button" presses, one of four LED light strips light up. And it all gets timed to music! I'll post a video if/when I get it working on a robot. My only bottleneck is that I don't know of any python libraries for simulating virtual joystick buttonpress events. Do you know of any?

TL;DR: I'm making a light flashy thing for our robot, and I need a joystick button press library for python.

apologies for grammar, I haven't slept last night :/

virtuald
13-07-2014, 10:07
Pressing buttons virtually is one way of accomplishing the task. Other ways I can think of, from easiest to hardest.


Use networktables (http://firstforge.wpi.edu/sf/frs/do/viewRelease/projects.robotpy/frs.pynetworktables.2014_4) to send a value to the LabVIEW code. Remember, your code can do more than one thing. ;)
Or just use sockets for communications. Should be easy to find an example somewhere on Chief Delphi.
If you're using python, you could try just sending raw driver station data instead using the driver station protocol. RobotPy has some code (https://github.com/robotpy/robotpy/tree/2014/sim/netcomm) that may work for doing this.
You could simulate joystick buttons, this looks promising (https://code.google.com/p/fscode/wiki/SimScript). I'd bet it's harder than the other alternatives.