Go to the documentation of this file.00001 from jsk_teleop_joy.joy_plugin import JSKJoyPlugin
00002 try:
00003 from jsk_rviz_plugins.msg import OverlayText
00004 except:
00005 import roslib; roslib.load_manifest("jsk_teleop_joy")
00006 from jsk_rviz_plugins.msg import OverlayText
00007 from std_msgs.msg import ColorRGBA
00008 import rospy
00009
00010 class Usage(JSKJoyPlugin):
00011 def __init__(self, name, args):
00012 JSKJoyPlugin.__init__(self, name, args)
00013 self.pub = rospy.Publisher("/overlay_text", OverlayText)
00014 self.usage = self.getArg("text")
00015 self.width = self.getArg("width", 400)
00016 self.height = self.getArg("width", 600)
00017 self.left = self.getArg("left", 10)
00018 self.top = self.getArg("top", 10)
00019 self.line_width = self.getArg("line_width", 2)
00020 self.text_size = self.getArg("text_size", 20)
00021 self.font = self.getArg("font", "DejaVu Sans Mono")
00022 def joyCB(self, status, history):
00023 msg = OverlayText()
00024 if status.left:
00025 self.left = self.left - 10
00026 if status.right:
00027 self.left = self.left + 10
00028 if status.up:
00029 self.top = self.top - 10
00030 if status.down:
00031 self.top = self.top + 10
00032 msg.text_size = self.text_size
00033 msg.width = self.width
00034 msg.height = self.height
00035 msg.left = self.left
00036 msg.top = self.top
00037 msg.line_width = self.line_width
00038 msg.font = self.font
00039 msg.fg_color = ColorRGBA(25 / 255.0, 1.0, 240.0 / 255.0, 1.0)
00040 msg.bg_color = ColorRGBA(0.0, 0.0, 0.0, 0.2)
00041 msg.text = self.usage
00042 self.pub.publish(msg)
00043 def disable(self):
00044 msg = OverlayText()
00045 msg.action = OverlayText.DELETE
00046 self.pub.publish(msg)
00047
00048