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 
jsk_teleop_joy.plugin.util.Usage.pub
pub
Definition: util.py:13
jsk_teleop_joy.plugin.util.Usage.height
height
Definition: util.py:16
jsk_teleop_joy.plugin.util.Usage.joyCB
def joyCB(self, status, history)
Definition: util.py:22
jsk_teleop_joy.plugin.util.Usage.width
width
Definition: util.py:15
jsk_teleop_joy.plugin.util.Usage.left
left
Definition: util.py:17
jsk_teleop_joy.plugin.util.Usage
Definition: util.py:10
jsk_teleop_joy.joy_plugin.JSKJoyPlugin.getArg
def getArg(self, key, default=None)
Definition: joy_plugin.py:19
jsk_teleop_joy.joy_plugin
Definition: joy_plugin.py:1
jsk_teleop_joy.joy_plugin.JSKJoyPlugin
Definition: joy_plugin.py:5
jsk_teleop_joy.plugin.util.Usage.usage
usage
Definition: util.py:14
jsk_teleop_joy.plugin.util.Usage.text_size
text_size
Definition: util.py:20
jsk_teleop_joy.plugin.util.Usage.__init__
def __init__(self, name, args)
Definition: util.py:11
jsk_teleop_joy.plugin.util.Usage.disable
def disable(self)
Definition: util.py:43
jsk_teleop_joy.plugin.util.Usage.font
font
Definition: util.py:21
jsk_teleop_joy.plugin.util.Usage.line_width
line_width
Definition: util.py:19
jsk_teleop_joy.plugin.util.Usage.top
top
Definition: util.py:18


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