trackpoint_status.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import rospy
4 import roslib
5 
7  def __init__(self, msg):
8  if msg.buttons[0] == 1:
9  self.left = True
10  else:
11  self.left = False
12  if msg.buttons[1] == 1:
13  self.middle = True
14  else:
15  self.middle = False
16  if msg.buttons[2] == 1:
17  self.right = True
18  else:
19  self.right = False
20  self.x = msg.axes[0]
21  self.y = msg.axes[1]
22 
23 
24 import pprint
25 
26 def joyCB(msg):
27  status = TrackpointStatus(msg)
28  pprint.PrettyPrinter().pprint(status.__dict__)
29 
30 
31 def main():
32  import roslib
33  import rospy
34  from sensor_msgs.msg import Joy
35 
36  rospy.sleep(1)
37  rospy.init_node('trackpoint_controller')
38  s = rospy.Subscriber('/trackpoint/joy', Joy, joyCB)
39 
40  rospy.spin()
41 
42 if __name__ == '__main__':
43  main()
44 
45 


jsk_teleop_joy
Author(s): Ryohei Ueda
autogenerated on Sun May 28 2023 03:03:37