def handle_read(self): try: data = self.recv(1024) if not data: return datalist = data.split(',') timestamp = datalist[2] for i in range( (len(datalist) - 3 )/4): if str(self.order) == datalist[ 3 + i*4]: x = np.double(datalist[4 + i*4]) y = np.double(datalist[5 + i*4]) """ create and pubish tranmerc """ gps_message = gpgga_tranmerc() gps_message.time = timestamp gps_message.northing = y/100 gps_message.easting = x/100 gps_message.fix = np.uint8(4) gps_message.sat = np.uint8(6) gps_message.hdop = np.double(1.0) self.gps_pub.publish(gps_message) except: pass
def onMsg(msg): pubMsg = gpgga_tranmerc() pubMsg.header = msg.header pubMsg.time = str(msg.header.stamp) pubMsg.northing = msg.pose.pose.position.y pubMsg.easting = msg.pose.pose.position.x pubMsg.fix = np.uint8(4) pubMsg.sat = np.uint8(6) pubMsg.hdop = np.double(1.0) pub.publish(pubMsg)
def handle_read(self): try: data = self.recv(1024) if not data: return datalist = data.split(',') timestamp = datalist[2] for i in range((len(datalist) - 3) / 4): if str(self.order) == datalist[3 + i * 4]: x = np.double(datalist[4 + i * 4]) y = np.double(datalist[5 + i * 4]) """ create and pubish tranmerc """ gps_message = gpgga_tranmerc() gps_message.time = timestamp gps_message.northing = y / 100 gps_message.easting = x / 100 gps_message.fix = np.uint8(4) gps_message.sat = np.uint8(6) gps_message.hdop = np.double(1.0) self.gps_pub.publish(gps_message) except: pass