def send(self, data, size): data = data + '\n' data = data.encode() self.mysoc.send(data) message = self.mysoc.receive() #print(message) #sys.stdout.flush() return getDoubleFromString(message, size)
def sendJointsPositionsGetExTorque(self, x): if (len(x) != 7): print('Error in sender function [sendJointsPositionsGetExTorque]') print('Joint positions shall be an array of 7 elements') return num = 10000 buff = StringIO() buff.write('jpExT_') counter = 0 while counter < 7: buff.write(str(math.ceil(x[counter] * num) / num)) buff.write('_') counter = counter + 1 buff.write('\n') command = buff.getvalue() return getDoubleFromString(self.send(command), 7)