def __init__(self, title=""): self.g = termgraphics.TermGraphics() self.xmax = 20 self.ymax = 20 self.last_update_time = 0 self.image = None self.title = title self.last_update_shape_time = 0
def __init__(self, title=""): self.g = termgraphics.TermGraphics() self.scale = 20 self.spin = 0.0 self.tilt = 3.14159 * 2 / 3 self.target_scale = self.scale self.target_spin = self.spin self.target_tilt = self.tilt self.target_time = 0 self.calculate_rotation() self.msg = None self.last_update_shape_time = 0 self.title = title
def __init__(self, topic, ascii_enable=None, color_mode=None): super().__init__('ros2show') if ascii_enable is None: self.ascii_enable = True else: self.ascii_enable = ascii_enable if color_mode is None: self.color_mode = None else: self.color_mode = color_mode time.sleep(3) topic_types = dict(self.get_topic_names_and_types()) topic_type=', '.join(topic_types[topic]) if topic not in topic_types: print("Topic {0} does not appear to be published yet.".format(topic)) sys.exit(0) if topic_type not in VIEWER_MAPPING: print("Unsupported message type.") exit() # Create the canvas and viewer accordingly self.canvas = termgraphics.TermGraphics( \ mode = (termgraphics.MODE_EASCII if ascii_enable else termgraphics.MODE_UNICODE), color_support = color_mode) module_name, class_name, viewer_kwargs = VIEWER_MAPPING[topic_type] viewer_class = getattr(__import__(module_name, fromlist=(class_name)), class_name) self.viewer = viewer_class(self.canvas, title = topic, **viewer_kwargs) message_package, message_name = topic_type.split("/msg/", 2) message_class = getattr(__import__(message_package + ".msg", fromlist=(message_name)), message_name) self.sub = self.create_subscription(message_class, topic, self.viewer.update, 10) self.getch = Getch() self._thread = threading.Thread(target=self._run, args=(), daemon=False) self._thread.start()
def __init__(self, title="", data_field="data"): self.g = termgraphics.TermGraphics() self.msg = None self.xmax = 10 self.title = title self.data_field = data_field self.last_value = 0.0 self.last_update_shape_time = 0 hmargin = self.g.shape[0] / 40. vmargin = self.g.shape[1] / 20. hsize = (self.g.shape[0] - 4 * hmargin) vsize = (self.g.shape[1] - 4 * vmargin) self.scope_plotter = ScopePlotter( self.g, left=hmargin, top=vmargin, right=hmargin + hsize, bottom=vmargin + vsize, ymin=None, ymax=None, )
def __init__(self, title=""): self.g = termgraphics.TermGraphics() self.last_update_shape_time = 0 self.title = title self.right = 10 self.yaws = [0.] * 128 self.yaws_p = 0 self.pitches = [0.] * 128 self.pitches_p = 0 self.rolls = [0.] * 128 self.rolls_p = 0 hmargin = self.g.shape[0] / 40. vmargin = self.g.shape[1] / 20. hsize = (self.g.shape[0] - 4 * hmargin) / 3 vsize = (self.g.shape[1] - 4 * vmargin) / 3 self.yaw_scope_plotter = ScopePlotter( self.g, left=hmargin, top=vmargin, right=hmargin + hsize, bottom=vmargin + vsize, ymin=-math.pi, ymax=math.pi, ) self.pitch_scope_plotter = ScopePlotter( self.g, left=hmargin, top=2 * vmargin + vsize, right=hmargin + hsize, bottom=2 * vmargin + 2 * vsize, ymin=-math.pi / 2, ymax=math.pi / 2, ) self.roll_scope_plotter = ScopePlotter( self.g, left=hmargin, top=3 * vmargin + 2 * vsize, right=hmargin + hsize, bottom=3 * vmargin + 3 * vsize, ymin=0, ymax=2 * math.pi, ) self.avx_scope_plotter = ScopePlotter( self.g, left=2 * hmargin + hsize, top=vmargin, right=2 * hmargin + 2 * hsize, bottom=vmargin + vsize, ymin=-math.pi, ymax=math.pi, ) self.avy_scope_plotter = ScopePlotter( self.g, left=2 * hmargin + hsize, top=2 * vmargin + vsize, right=2 * hmargin + 2 * hsize, bottom=2 * vmargin + 2 * vsize, ymin=-math.pi, ymax=math.pi, ) self.avz_scope_plotter = ScopePlotter( self.g, left=2 * hmargin + hsize, top=3 * vmargin + 2 * vsize, right=2 * hmargin + 2 * hsize, bottom=3 * vmargin + 3 * vsize, ymin=-math.pi, ymax=math.pi, ) self.lax_scope_plotter = ScopePlotter( self.g, left=3 * hmargin + 2 * hsize, top=vmargin, right=3 * hmargin + 3 * hsize, bottom=vmargin + vsize, ymin=-9.8, ymax=9.8, ) self.lay_scope_plotter = ScopePlotter(self.g, left=3 * hmargin + 2 * hsize, top=2 * vmargin + vsize, right=3 * hmargin + 3 * hsize, bottom=2 * vmargin + 2 * vsize, ymin=-9.8, ymax=9.8) self.laz_scope_plotter = ScopePlotter( self.g, left=3 * hmargin + 2 * hsize, top=3 * vmargin + 2 * vsize, right=3 * hmargin + 3 * hsize, bottom=3 * vmargin + 3 * vsize, ymin=-9.8, ymax=9.8, )
def __init__(self, title=""): self.g = termgraphics.TermGraphics() self.location_plotter = LocationPlotter(self.g) self.title = title