util.py
Go to the documentation of this file.
1 from jsk_teleop_joy.joy_plugin import JSKJoyPlugin
2 try:
3  from jsk_rviz_plugins.msg import OverlayText
4 except:
5  import roslib; roslib.load_manifest("jsk_teleop_joy")
6  from jsk_rviz_plugins.msg import OverlayText
7 from std_msgs.msg import ColorRGBA
8 import rospy
9 
11  def __init__(self, name, args):
12  JSKJoyPlugin.__init__(self, name, args)
13  self.pub = rospy.Publisher("/overlay_text", OverlayText)
14  self.usage = self.getArg("text")
15  self.width = self.getArg("width", 400)
16  self.height = self.getArg("width", 600)
17  self.left = self.getArg("left", 10)
18  self.top = self.getArg("top", 10)
19  self.line_width = self.getArg("line_width", 2)
20  self.text_size = self.getArg("text_size", 20)
21  self.font = self.getArg("font", "DejaVu Sans Mono")
22  def joyCB(self, status, history):
23  msg = OverlayText()
24  if status.left:
25  self.left = self.left - 10
26  if status.right:
27  self.left = self.left + 10
28  if status.up:
29  self.top = self.top - 10
30  if status.down:
31  self.top = self.top + 10
32  msg.text_size = self.text_size
33  msg.width = self.width
34  msg.height = self.height
35  msg.left = self.left
36  msg.top = self.top
37  msg.line_width = self.line_width
38  msg.font = self.font
39  msg.fg_color = ColorRGBA(25 / 255.0, 1.0, 240.0 / 255.0, 1.0)
40  msg.bg_color = ColorRGBA(0.0, 0.0, 0.0, 0.2)
41  msg.text = self.usage
42  self.pub.publish(msg)
43  def disable(self):
44  msg = OverlayText()
45  msg.action = OverlayText.DELETE
46  self.pub.publish(msg)
47 
48 
def joyCB(self, status, history)
Definition: util.py:22
def __init__(self, name, args)
Definition: util.py:11
def getArg(self, key, default=None)
Definition: joy_plugin.py:19


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