def changeSubscriptionBDI(self, newBDIChannel="POSE_BDI"): # used to monitor a different pose e.g. POSE_BODY_LOGGED in playback self.bdiChannel = newBDIChannel lcmUtils.removeSubscriber ( self.bdiSubcribe ) self.bdiSubcribe = lcmUtils.addSubscriber( self.bdiChannel , pose_t, self.onPoseBDI) self.bdiSubcribe.setSpeedLimit(60)
def setEnabled(self, enabled): if enabled and not self.subscriber: self.subscriber = lcmUtils.addSubscriber('LCMGL.*', callback=self.onMessage) elif not enabled and self.subscriber: lcmUtils.removeSubscriber(self.subscriber) self.subscriber = None
def _removeSubscribers(self): for sub in self.subscribers: lcmUtils.removeSubscriber(sub) self.subscribers = []
def removeLCMUpdater(self): lcmUtils.removeSubscriber(self.subscriber) self.subscriber = None
def __del__(self): lcmUtils.removeSubscriber(self.sub)
def stop(self): for sub in self.subs: lcmUtils.removeSubscriber(sub)
def __exit__(self): if self.lcmsub is not None: lcmUtils.removeSubscriber(self.lcmsub)