def checkEncoders(self, request, context): try: self._robot.checkEncoders() return nxt_msg.Status(value=nxt_msg.Status.DONE) except Exception as e: print(e, type(e)) return nxt_msg.Status(value=nxt_msg.Status.ERROR)
def goOffPose(self, request, context): try: self._robot.goOffPose() return nxt_msg.Status(value=nxt_msg.Status.DONE) except Exception as e: print(e, type(e)) return nxt_msg.Status(value=nxt_msg.Status.ERROR)
def ejectHandToolLft(self, request, context): try: self._robot.handtool_l_eject() return nxt_msg.Status(value=nxt_msg.Status.DONE) except Exception as e: print(e, type(e)) return nxt_msg.Status(value=nxt_msg.Status.ERROR)
def attachHandToolRgt(self, request, context): try: self._robot.handtool_r_attach() return nxt_msg.Status(value=nxt_msg.Status.DONE) except Exception as e: print(e, type(e)) return nxt_msg.Status(value=nxt_msg.Status.ERROR)
def openHandToolLft(self, request, context): try: self._robot.gripper_l_open() return nxt_msg.Status(value=nxt_msg.Status.DONE) except Exception as e: print(e, type(e)) return nxt_msg.Status(value=nxt_msg.Status.ERROR)
def closeHandToolRgt(self, request, context): try: self._robot.gripper_r_close() return nxt_msg.Status(value=nxt_msg.Status.DONE) except Exception as e: print(e, type(e)) return nxt_msg.Status(value=nxt_msg.Status.ERROR)
def playPattern(self, request, context): try: if self._oldyaml: angleslist, tmlist = yaml.load(request.data) else: angleslist, tmlist = yaml.load(request.data, Loader=yaml.UnsafeLoader) self._robot.playPattern(angleslist, [], [], tmlist) return nxt_msg.Status(value=nxt_msg.Status.DONE) except Exception as e: print(e, type(e)) return nxt_msg.Status(value=nxt_msg.Status.ERROR)
def setJointAngles(self, request, context): """ :param request: request.data is in degree :param context: :return: author: weiwei date: 20190419 """ try: if self._oldyaml: angles, tm = yaml.load(request.data) else: angles, tm = yaml.load(request.data, Loader=yaml.UnsafeLoader) if tm is None: tm = 10.0 self._robot.playPattern([self._deg2rad(angles), [tm]]) return nxt_msg.Status(value=nxt_msg.Status.DONE) except Exception as e: print(e, type(e)) return nxt_msg.Status(value=nxt_msg.Status.ERROR)