def __init__(self): self.lastButtonState = 0 self.buttonWasPressed = False rospy.Subscriber("/joy", Joy, self.joyChanged)