def goOffPose(self, request, context): try: self.__robot.goOffPose() return nxtmsg.Status(value=nxtmsg.Status.DONE) except Exception as e: print(e, type(e)) return nxtmsg.Status(value=nxtmsg.Status.ERROR)
def ejectHandToolLft(self, request, context): try: self.__robot.handtool_l_eject() return nxtmsg.Status(value=nxtmsg.Status.DONE) except Exception as e: print(e, type(e)) return nxtmsg.Status(value=nxtmsg.Status.ERROR)
def checkEncoders(self, request, context): try: self.__robot.checkEncoders() return nxtmsg.Status(value=nxtmsg.Status.DONE) except Exception as e: print(e, type(e)) return nxtmsg.Status(value=nxtmsg.Status.ERROR)
def attachHandToolRgt(self, request, context): try: self.__robot.handtool_r_attach() return nxtmsg.Status(value=nxtmsg.Status.DONE) except Exception as e: print(e, type(e)) return nxtmsg.Status(value=nxtmsg.Status.ERROR)
def openHandToolLft(self, request, context): try: self.__robot.gripper_l_open() return nxtmsg.Status(value=nxtmsg.Status.DONE) except Exception as e: print(e, type(e)) return nxtmsg.Status(value=nxtmsg.Status.ERROR)
def closeHandToolRgt(self, request, context): try: self.__robot.gripper_r_close() return nxtmsg.Status(value=nxtmsg.Status.DONE) except Exception as e: print(e, type(e)) return nxtmsg.Status(value=nxtmsg.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 nxtmsg.Status(value=nxtmsg.Status.DONE) except Exception as e: print(e, type(e)) return nxtmsg.Status(value=nxtmsg.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 nxtmsg.Status(value=nxtmsg.Status.DONE) except Exception as e: print(e, type(e)) return nxtmsg.Status(value=nxtmsg.Status.ERROR)