def set_commands(self, commands, commands_source): # need to get timestamp if self.last_obs is None: self.last_obs = self.robot.get_observations() t = self.last_obs.timestamp # self.info('EquivRobotCausal:set_commands()') self.last_commands = (commands, commands_source) self.pre.put((t, self.last_commands)) bb_pump(self.pre, self.robotw)
def get_observations(self): # self.info('EquivRobotCausal:get_observations()') bb_pump(self.robotw, self.post) try: _, obs1 = self.post.get(block=False) if self.last_commands is None: warnings.warn('Should get default value from spec otherwise fail') pass else: obs1.commands, obs1.commands_source = self.last_commands return obs1 except SimpleBlackBox.NotReady: raise RobotObservations.NotReady()