Beispiel #1
0
    def handle_message(self, msg):
        msg_time = msg.timestamp * 1e-3  # convert from milliseconds

        # Since the plugin can remain open during multiple simulations, we
        # clear the lists of times if we receive a message with a time earlier
        # than the last time received (which indicates that a new simulation
        # has been run).
        if self._msg_time and self._msg_time[-1] > msg_time:
            self._real_time.clear()
            self._msg_time.clear()

        self._real_time.append(time.time())
        self._msg_time.append(msg_time)

        my_text = 'sim time: %.3f' % msg_time

        if (len(self._real_time) >= self._num_msg_for_average):
            self._real_time.pop(0)
            self._msg_time.pop(0)

            dt = self._msg_time[-1] - self._msg_time[0]
            dt_real_time = self._real_time[-1] - self._real_time[0]

            rt_ratio = dt / dt_real_time

            my_text = my_text + ', real time factor: %.2f' % rt_ratio
        else:
            my_text = my_text + ', real time factor: (still computing)'

        updateText(my_text, 'text')
Beispiel #2
0
    def remove_subscriber(self):
        if (self._subscriber is None):
            return

        lcmUtils.removeSubscriber(self._subscriber)
        self._subscriber = None
        updateText('', 'text')
Beispiel #3
0
    def remove_subscriber(self):
        if (self._subscriber is None):
            return

        lcmUtils.removeSubscriber(self._subscriber)
        self._subscriber = None
        updateText('', 'Simulation time [s]')
    def update_screen_text(self):
        folder = om.getOrCreateContainer(self._folder_name)
        my_text = 'Point contact vector: {}'.format(
            ContactVisModes.get_mode_string(self.magnitude_mode))

        # TODO(SeanCurtis-TRI): Figure out how to anchor this in the bottom-
        #  right corner as opposed to floating in the middle.
        w = applogic.getCurrentRenderView().size.width()
        vis.updateText(my_text, 'contact_text',
                       **{'position': (w/2, 10), 'parent': folder})
Beispiel #5
0
    def __init__(self, robotStateJointController, view, cameraview,
                 mapServerSource):

        self.robotStateJointController = robotStateJointController
        self.view = view
        self.cameraview = cameraview
        self.mapServerSource = mapServerSource

        self.lastCameraMessageTime = 0
        self.lastScanBundleMessageTime = 0

        self.lastBlackoutLengths = []
        self.lastBlackoutLength = 0
        self.inBlackout = False
        self.averageBlackoutLength = 0.0

        self.txt = vis.updateText("DATA AGE: 0 sec",
                                  "Data Age Text",
                                  view=self.view)
        self.txt.addProperty('Show Avg Duration', False)
        self.txt.setProperty('Visible', False)

        self.updateTimer = TimerCallback(self.UPDATE_RATE)
        self.updateTimer.callback = self.update
        self.updateTimer.start()
Beispiel #6
0
    def handle_message(self, msg):
        msg_time = msg.timestamp * 1e-3  # convert from milliseconds
        self._real_time.append(time.time())
        self._msg_time.append(msg_time)

        my_text = 'sim time: %.3f' % msg_time

        if (len(self._real_time) >= self._num_msg_for_average):
            self._real_time.pop(0)
            self._msg_time.pop(0)

            dt = self._msg_time[-1] - self._msg_time[0]
            dt_real_time = self._real_time[-1] - self._real_time[0]

            rt_ratio = dt / dt_real_time

            my_text = my_text + ', real time factor: %.2f' % rt_ratio

        updateText(my_text, 'text')
Beispiel #7
0
    def __init__(self, robotStateJointController, view, cameraview, mapServerSource):

        self.robotStateJointController = robotStateJointController
        self.view = view
        self.cameraview = cameraview
        self.mapServerSource = mapServerSource

        self.lastCameraMessageTime = 0
        self.lastScanBundleMessageTime = 0

        self.lastBlackoutLengths = []
        self.lastBlackoutLength = 0
        self.inBlackout = False
        self.averageBlackoutLength = 0.0

        self.txt = vis.updateText("DATA AGE: 0 sec", "Data Age Text", view=self.view)
        self.txt.addProperty('Show Avg Duration', False)
        self.txt.setProperty('Visible', False)

        self.updateTimer = TimerCallback(self.UPDATE_RATE)
        self.updateTimer.callback = self.update
        self.updateTimer.start()
Beispiel #8
0
 def showText(self, neckPitch):
     if not self.view:
         return
     self.textObj = vis.updateText('Neck pitch: %d' % neckPitch, 'Neck Pitch Annotation', parent='spindle axis')
Beispiel #9
0
 def showText(self, neckPitch):
     if not self.view:
         return
     self.textObj = vis.updateText('Neck pitch: %d' % neckPitch, 'Neck Pitch Annotation', parent='spindle axis')
Beispiel #10
0
 def onViewerDraw(msg):
     t = msg.timestamp * 1e-3
     vis.updateText('sim time: %.3f' % t, 'sim time')