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.trackpoint_status.main
def main()
Definition: trackpoint_status.py:31
jsk_teleop_joy.trackpoint_status.TrackpointStatus.right
right
Definition: trackpoint_status.py:17
jsk_teleop_joy.trackpoint_status.TrackpointStatus
Definition: trackpoint_status.py:6
jsk_teleop_joy.trackpoint_status.TrackpointStatus.left
left
Definition: trackpoint_status.py:9
jsk_teleop_joy.trackpoint_status.TrackpointStatus.__init__
def __init__(self, msg)
Definition: trackpoint_status.py:7
jsk_teleop_joy.trackpoint_status.joyCB
def joyCB(msg)
Definition: trackpoint_status.py:26
jsk_teleop_joy.trackpoint_status.TrackpointStatus.middle
middle
Definition: trackpoint_status.py:13
jsk_teleop_joy.trackpoint_status.TrackpointStatus.y
y
Definition: trackpoint_status.py:21
jsk_teleop_joy.trackpoint_status.TrackpointStatus.x
x
Definition: trackpoint_status.py:20
msg


jsk_teleop_joy
Author(s): Ryohei Ueda
autogenerated on Wed Jan 24 2024 04:05:49