Most of the services I created manually, and used the gui to connect the services methods together.
Like joy.xaXisRaw - > panServo.move()
Here is a Python script to listen for the a certain button press:
-
joy= runtime.createAndStart("joy","Joystick")
-
from java.lang import Integer
-
from java.lang import System
-
-
python.send("trigger","moveTo",90)
-
-
def input(): #function gets called when button is pressed
-
joybutton = msg_joy_button1.data[0]
-
System.out.println(joybutton==0) #print value of button
-
if (joybutton==0):
-
python.send("trigger","moveTo",100)
-
else: python.send("trigger","moveTo",20)
-
return object
-
-
#create a message route from joy to python so we can listen for button
-
joy.addListener("button1", python.name, "input", Integer(1).getClass());